Dear statalisters:
I have census data that is organized so that there is an observation for each
race-sex-year category in a state. In other words, there is one observation for
white men in Alabama in 1981, one for white women in Alabama 1981, etc., etc.
Further, there are separate variables for several age groups. The data looks like
this.
Fips Year Race Sex age04 age59 . . . age8084 age8500
1 1 1 1 101151 102545 12032
12032
where fips are state fips codes, year is the last digit in the year (the data only
spans 1981 to 1989), race is a categorical variable, sex a dummy, and the number
in age04 is the number of (in this case) white boys aged 0 - 4 in Alabama in 1981
(the number in age8500 is the number of white men over 85 in Alabama in 1981).
What i want is to reshape the age long, so that i have an observation for each
individual in the sample. Thus, I would have 101151 observations of white men in
Alabama in 1981.
i tried:
reshape long age, i( fips year race sex)
but this does not work. it creates an age variable that has the values that were
in each age variable, rather than an observation for each of the individuals
counted in each age group. of course, this means the race and sex counts are also
not correct. How do i get what I am looking for? Do i need to generate a
different age variable first? Any advise would be appreciated!
thanks in advance for your help!
traci a schlesinger
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/