I am relatively new to Stata and have a question regarding the generation of a new variable. Basically I have a list of observations that could be simply illustrated as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(year_event c2015 c2014 c2013 c2012 c2011) 2015 7 2 3 4 7 2014 6 8 8 8 8 2013 4 9 9 4 9 2014 5 7 4 7 5 2016 8 5 7 3 1 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(year_event c2015 c2014 c2013 c2012 c2011 cyear_1 cyear_2) 2015 7 2 3 4 7 2 3 2014 6 8 8 8 8 8 8 2013 4 9 9 4 9 4 9 2014 5 7 4 7 5 4 7 2016 8 5 7 3 1 8 5 end
Kind regards
0 Response to using egen to generate a variable based on a list of potential existing variables
Post a Comment