I am looking to reshape the dataset below (i used dataex but the variable names are not matching up with the columns properly). Right now, each row is a count of a particular demographic within a given state. There are 10 years of data though i only included 3 years below (popestimate 2010-2012. What i want is each row to be a state and year (instead of the popestimate* there would just be a column for "year") and all the columns to be the demographics. So, instead of the variable name "demographics," the variable names would be "FemaleHispanicAsian0to4," "FemaleHispanicAsian5to14," etc...
Hopefully that made sense. Can anyone help with this?
Thanks!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear state popestimate2010 popestimate2011 popestimate2012 demographics "Alabama" 207 191 174 "FemaleHispanicAsian0to4" "Alabama" 254 266 282 "FemaleHispanicAsian5to14" "Alabama" 57 63 56 "FemaleHispanicAsian15to17" "Alabama" 164 149 137 "FemaleHispanicAsian18to24" "Alabama" 258 239 209 "FemaleHispanicAsian25to34" end
0 Response to reshape help please
Post a Comment