Code:
clear input str25 sub1 marks1obt marks1max str30 sub2 marks2obt marks2max str30 sub3 marks3obt marks3max "Mathematics" 83 100 "English" 92 100 "Statistics" 98 100 "Hindi" 93 100 "English" 99 100 "Economics" 98 100 "Geography " 85 100 "Mathematics" 88 100 "Economics" 89 100 end
I want to convert the form of the data in such a way that the column name is the name of the subject and if the student has studied the subject, then marks are recorded. Otherwise , its a missing value.
So, in the above example , I would have columns named "Mathematics_Marks_Obtained" "Mathematics_Marks_Max" "English_Marks_Obtained" "English_Marks_Max" "Statistics_Marks_Obtained" "Statistics_Marks_Max" "Hindi_Marks_Obtained" "Hindi_Marks_Max" "Economics_Marks_Obtained" "Economics_Marks_Max" "Geography_Marks_Obtained" "Geography_Marks_Max"
How can this be done in Stata
0 Response to Rearranging Data
Post a Comment