Good Morning Stata Members,
Below is an example of my data structure:
SchoolCode,CourseCode, V1, V2, V3,Program1,Program2,Program3,Program4
1,ERT23,10,12,2, 1,0,0,1
2,EMS45,5,6,11,0,1,0,1
1,MNT34,7,8,2,1,0,0,1
Each row is unique.
The example below is where I would like to go. A new row is generated if there is 1 in the Program Variable Colums
#1
SchoolCode,ProgramName,CourseCode,V1,V2,V3
1,Program1,ERT23,10,12,2
1,Program4,ERT23,10,12,2
2,Program2,EMS45,5,6,11
2,Program4,EMS45,5,6,11
1,Program1,MNT34,7,8,2,
1,Program,4,MNT34,7,8,2
#2 Sort
SchoolCode,ProgramName,CourseCode,V1,V2,V3
1,Program1,ERT23,10,12,2
1,Program1,MNT34,7,8,2
1,Program4,ERT23,10,12,2
1,Program,4,MNT34,7,8,2
2,Program2,EMS45,5,6,11
2,Program4,EMS45,5,6,11
#Sum by ProgramCode and SchoolCode -
SchoolCode,ProgramName,CourseCode,V1,V2,V3
1,Program1,57,17,20,4
1,Program4,57,17,20,4
2,Program2,EMS45,5,6,11
2,Program4,EMS45,5,6,11
Thanks in advance!
Related Posts with Transpose and Collapse
Overlay corrtable and graph matrixDear all, I wonder if there is an easy way to draw a graph by overlaying the output from graph matr…
Adding a list of variables to each observationHow do I add a list of variables from a “using” file to every observation (for a list of entities) i…
Measures to compare distributions and the Probability-Probability-PlotHi Statalisters, I want to compare the distributional fit of predicted values with the original dat…
learning Stata's postestimation toolsHi Statalist I recently watched Kristin MacDonald's webinar 'Stata Tips and Tricks' and there was a…
new var calculated from group means of survey dataGreetings, I working on Stata 15 with survey data using pweights. I have created the bar graph belo…
Subscribe to:
Post Comments (Atom)
0 Response to Transpose and Collapse
Post a Comment