/** Compare 2004 Census population projections to Census population estimates */ global census_dir /sch-data-library/public-data/Census /*** Load Census population estimates starting in 2004 until latest year available (2017) ***/ * load 2000-2010 Census pop estimates, throw out 2010 estimates because we have actual count from 2010 census insheet using $census_dir/2000_2010_Intercensal_Estimates/US-EST00INT-ALLDATA.csv, clear * Keep years 2000 - 2009 keep if year >= 2000 & year <= 2009 * Keep population estimates for July keep if month == 7 * Drop total age observations drop if age == 999 keep year age tot_male tot_female reshape long tot, i(year age) j(sexlab) string gen sex = "M" if sexlab=="_male" replace sex = "F" if sexlab=="_female" drop sexlab rename tot popsizeest drop if year < 2004 | year==2010 tempfile popest0409 save `popest0409' * load 2010-2017 Census pop estimates and append to earlier estimates insheet using $census_dir/2017_Pop_Estimates/nc-est2017-agesex-res.csv, clear keep sex age popestimate* drop if sex==0 | age==999 reshape long popestimate, i(sex age) j(year) rename popestimate popsizeest gen sexch = "M" if sex==1 replace sexch = "F" if sex==2 drop sex rename sexch sex append using `popest0409' * keep population size estimates for age range corresponding to 2004 FEM stock population gen stockagemin = 51 + year - 2004 replace popsizeest = 0.0 if age < stockagemin collapse (sum) stockpopsizeest=popsizeest (first) stockagemin, by(year sex) keep year sex stockagemin stockpopsizeest * drop odd-numbered years that are not simulated in FEM drop if mod(year,2) == 1 save data/census_popsizeest.dta, replace