/*** prepare 2004 Census migration projections 2004 migration projection is a combination of two series from the Census' 2000 migration projections See Census projection methodology document from 2004 for description: https://www2.census.gov/programs-surveys/popproj/technical-documentation/methodology/idbsummeth.pdf This program calculates total migration and compares to published targets in these two documents: https://www2.census.gov/programs-surveys/popproj/technical-documentation/methodology/idbsummeth.pdf https://www.census.gov/content/dam/Census/library/working-papers/2000/demo/POP-twps0038.pdf This code does not match the published Census numbers exactly. It is off by 5% to 10% across males and females of all ages */ include ../../../fem_env.do foreach ps in middle high { clear import delimited using $indata/census_migration_proj_2000_`ps'.txt, delimiters(" ",collapse) varnames(nonames) * keep total projections not for specific races keep if substr(v1,2,1) == "A" gen year = substr(v1,6,4) destring(year), replace * for age=="100" the first and second column of the input file run together and Stata doesn't read it properly * need to shift everything one column to the right gen badread = strlen(v1)==12 & substr(v1,10,3)=="100" * li if badread forvalues c=5(-1)3 { local srccol = `c' - 1 replace v`c' = v`srccol' if badread } replace v2 = 100 if badread * li if badread drop badread rename v2 age rename v3 migration_`ps'_t rename v4 migration_`ps'_m rename v5 migration_`ps'_f keep year age migration* reshape long migration_`ps', i(year age) j(sexlab) string gen sex = strupper(substr(sexlab,2,1)) drop sexlab tempfile migration_`ps' save `migration_`ps'' } use `migration_middle', clear merge 1:1 year age sex using `migration_high' tab _merge drop _merge gen netmigration = 0.938*migration_middle + 0.062*migration_high * li if year==2025 * li if year==2050 * confirm that this calculation matches the Census methodology document figures * netmigration target (2004 projection): * 996,000 in 2025 * 1,097,000 in 2050 * migration_middle target (2000 projection): * 954,000 in 1999 * 912,000 in 2025 * 984,000 in 2050 * 926,000 in 2100 * migration_high target (2000 projection): * 1,191,000 in 1999 * 2,268,000 in 2025 * 2,812,000 in 2050 * 3,039,000 in 2100 preserve collapse (sum) netmigration migration_middle migration_high, by(year sex) gen diff2004 = round(netmigration,1000) - 996000 if year==2025 replace diff2004 = round(netmigration,1000) - 1097000 if year==2050 gen diff2000_middle = round(migration_middle,1000) - 912000 if year==2025 replace diff2000_middle = round(migration_middle,1000) - 984000 if year==2050 gen diff2000_high = round(migration_high,1000) - 2268000 if year==2025 replace diff2000_high = round(migration_high,1000) - 2812000 if year==2050 li year netmigration migration_middle migration_high diff* if sex=="T" & inlist(year,1999,2025,2050.2100) restore drop if sex=="T" gen male = sex=="M" drop sex keep if year >= 2004 & age >= 51 & age < 100 keep year age male netmigration sort year male age order year age male netmigration save $outdata/immigration_projection_2004.dta, replace outsheet using immigration_projection_2004.txt, replace