------------------------------------------------------------------------------------- name: log: C:\Users\doxxx087\Desktop\immigration.log log type: text opened on: 7 Mar 2016, 13:48:37 . . *Download data from the IHIS website: inlcude variable AGE and USBORN . use immigration.dta, clear . . *Age structure . *27.25% children and 72.75% adults . gen age_r = (age >= 18) . tab age_r, missing age_r | Freq. Percent Cum. ------------+----------------------------------- 0 | 465,989 27.25 27.25 1 | 1,244,070 72.75 100.00 ------------+----------------------------------- Total | 1,710,059 100.00 . . *Flag US-born: born in the US and its territories . gen bornhere = . (1710059 missing values generated) . replace bornhere = 1 if usborn == 11 | usborn == 20 /*born in US or its territories > */ (1424239 real changes made) . replace bornhere = 0 if usborn == 10 | usborn == 12 /*born outside the US or its te > rritories*/ (277587 real changes made) . . *Flag sampled PERSONS (both adults and children) . gen samperson = . (1710059 missing values generated) . replace samperson = 0 if (age < 18 & cstatflg >= 3 & cstatflg <= 5) | (age >= 18 & > astatflg >= 3 & astatflg <= 5) (791561 real changes made) . replace samperson = 1 if (age < 18 & cstatflg >= 1 & cstatflg <= 2) | (age >= 18 & > ((astatflg >= 1 & astatflg <= 2) | astatflg == 6)) (918498 real changes made) . . *Estimation in 1997-2014: immigration status of sampled and non-sampled ADULTS . *18.02% sampled adults are immigrants . *23.04% of non-sampled adults are immigrants . tab samperson bornhere if age >= 18 & bornhere != ., row +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | bornhere samperson | 0 1 | Total -----------+----------------------+---------- 0 | 130,013 434,401 | 564,414 | 23.04 76.96 | 100.00 -----------+----------------------+---------- 1 | 121,276 551,897 | 673,173 | 18.02 81.98 | 100.00 -----------+----------------------+---------- Total | 251,289 986,298 | 1,237,587 | 20.30 79.70 | 100.00 . end of do-file