Hello,
I am using Stata 17.0/BE for Mac and I’m trying to reshape my data for a panel. I want the following:
And this is what I want it to look like after the reshape:
Thank you for your help,
Nicolas Charette
I am using Stata 17.0/BE for Mac and I’m trying to reshape my data for a panel. I want the following:
- put all the _course* variables as observations under a new variable (newvar1);
- all the observations for _course* variables to be under a new variable (newvar2);
- all the observations for variables year and stuff* to adjust
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int(id year) double stuff int stufff2 byte(_course1 _course2 _course3 _course4 _course5) 333 2010 6 45 83 90 . . . 333 2011 6 16 . . . . . 333 2011 7 117 . . 84 66 73 333 2012 8 117 . . 83 . 83 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int id str8 newvar1 int year double stuff int stufff2 byte _newvar2 333 "_course1" 2010 6 45 83 333 "_course2" 2010 6 45 90 333 "." 2011 6 16 . 333 "_course3" 2011 7 117 84 333 "_course4" 2011 7 117 66 333 "_course5" 2011 7 117 73 333 "_course3" 2012 8 117 83 333 "_course5" 2012 8 117 83 end
Nicolas Charette
Comment