formatmpds function

Format the main data set