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
-lnoffset- and -exposure- options from -glm-Dear All, Good afternoon. I do hope this one finds you well. While challenging myself with the examp…
converting string variables to numericI have a string variable that I want to change to numeric but I can't. Can you help me please stora…
xtdcce2 not allowing me to run the HaumanDear members, I am a user of Stata/15.1 SE. I am employing the Panel ARDL Technique using XTDCCE2 …
Curious histogram glitch?Array I can't find this reported before, and I am pretty sure it's NOT my data. Array Above, the re…
How to convert daily data to yearly dataHi, I am currently having daily data and I would like to convert it to yearly data. Ultimately, I wo…
Subscribe to:
Post Comments (Atom)
0 Response to Transpose and Collapse
Post a Comment