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
multi level ordinal regression ?crossed effectHi, Hi, I want to run a multi-level ordinal logistic regression in which people have completed an…
combine variable names Hello statalisters, I have a question regarding stata operation. I have 2 lists of variable names a…
Result in binary logistic regression significant but not in multilevel modelDear all, I have run a binary logistic regression analysis (good versus poor health) and my results…
Possible issue with diff in diff regression?Hello, I am trying to do a diff in diff approach where my regression code looks like this Code: …
Piecewise regressionDear Statalist. I was wondering how to know what intial value to enter when doing a piecewise regres…
Subscribe to:
Post Comments (Atom)
0 Response to Transpose and Collapse
Post a Comment