I have repeated cross-sectional observations from a survey that ran from 2010 to 2016. Suppose I'm interested in making a psuedo-panel, using region and birth year as cohorts. I want to get the cohort mean of x1, x3, x3 (some relevant variables.).
How would I go about doing this cleanly?
For reference, *age_cohort* and *region_cohort* are my cohort variables, with cohorts numbered 0-3. And *year* is year the survey was conducted.
How would I go about doing this cleanly?
For reference, *age_cohort* and *region_cohort* are my cohort variables, with cohorts numbered 0-3. And *year* is year the survey was conducted.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double caseid long year byte region float(birth_year x1 x2 x3 age_cohort region_cohort) 20100101100020 2010 3 1983 175 48.11478 4.7088127 3 3 20100101100045 2010 2 1990 362 82.99108 5.856155 3 1 20100101100050 2010 4 1941 300 72.08434 5.535239 0 3 20100101100053 2010 2 1979 678 132.86858 7.069178 3 1 20100101100087 2010 3 1947 325 76.54424 5.669765 0 3 end label values region region_lbl label def region_lbl 2 "Midwest", modify label def region_lbl 3 "South", modify label def region_lbl 4 "West", modify

Comment