clear set mem 600m set more off /* Regressions without occupational dummies */ use CPS6203.dta, clear keep if wage_sample==1 keep if year>=1964 gen byte ed1=(educ==1) gen byte ed3=(educ==3) gen byte ed4=(educ==4) gen byte ed5=(educ==5) gen byte r2=(region==2) gen byte r3=(region==3) gen byte r4=(region==4) gen byte nonwhite=(race~=1) gen exp=age-6-10 if educ==1 replace exp=age-6-12 if educ==2 replace exp=age-6-14 if educ==3 replace exp=age-6-16 if educ==4 replace exp=age-6-18 if educ==5 replace exp=0 if exp<0 gen exp2=exp*exp gen lnwage=ln(real_wage) gen coef_cons=. gen coef_ed1=. gen coef_ed3=. gen coef_ed4=. gen coef_ed5=. gen coef_exp=. gen coef_exp2=. gen rsquare=. gen resid=. local i 1964 while `i' <= 2003 { reg lnwage ed1 ed3 ed4 ed5 exp exp2 r2 r3 r4 nonwhite [aw=wgt] if sex==1 & year==`i' replace coef_cons=_b[_cons] if sex==1 & year==`i' replace coef_ed1=_b[ed1] if sex==1 & year==`i' replace coef_ed3=_b[ed3] if sex==1 & year==`i' replace coef_ed4=_b[ed4] if sex==1 & year==`i' replace coef_ed5=_b[ed5] if sex==1 & year==`i' replace coef_exp=_b[exp] if sex==1 & year==`i' replace coef_exp2=_b[exp2] if sex==1 & year==`i' replace rsquare=e(r2) if sex==1 & year==`i' predict plnwage if sex==1 & year==`i', xb replace resid=lnwage-plnwage if sex==1 & year==`i' drop plnwage reg lnwage ed1 ed3 ed4 ed5 exp exp2 r2 r3 r4 nonwhite [aw=wgt] if sex==2 & year==`i' replace coef_cons=_b[_cons] if sex==2 & year==`i' replace coef_ed1=_b[ed1] if sex==2 & year==`i' replace coef_ed3=_b[ed3] if sex==2 & year==`i' replace coef_ed4=_b[ed4] if sex==2 & year==`i' replace coef_ed5=_b[ed5] if sex==2 & year==`i' replace coef_exp=_b[exp] if sex==2 & year==`i' replace coef_exp2=_b[exp2] if sex==2 & year==`i' replace rsquare=e(r2) if sex==2 & year==`i' predict plnwage if sex==2 & year==`i', xb replace resid=lnwage-plnwage if sex==2 & year==`i' drop plnwage local i = `i'+ 1 } save reg_result1.dta, replace sort sex year collapse (mean) coef_ed1 coef_ed3 coef_ed4 coef_ed5 coef_exp coef_exp2 rsquare /* */ (sd) sd_resid=resid (p10) p10_resid=resid (p90) p90_resid=resid [aw=wgt] if wgt>=0, by(sex year) outsheet using "Results/reg_no_occ.out", replace /* Regressions with occupational dummies */ use CPS6203.dta, clear keep if wage_sample==1 keep if year>=1971 drop if occat==. gen byte ed1=(educ==1) gen byte ed3=(educ==3) gen byte ed4=(educ==4) gen byte ed5=(educ==5) gen byte occman=(occat==1) gen byte occwhite=(occat==2) gen byte r2=(region==2) gen byte r3=(region==3) gen byte r4=(region==4) gen byte nonwhite=(race~=1) gen exp=age-6-10 if educ==1 replace exp=age-6-12 if educ==2 replace exp=age-6-14 if educ==3 replace exp=age-6-16 if educ==4 replace exp=age-6-18 if educ==5 replace exp=0 if exp<0 gen exp2=exp*exp gen lnwage=ln(real_wage) gen coef_cons=. gen coef_ed1=. gen coef_ed3=. gen coef_ed4=. gen coef_ed5=. gen coef_exp=. gen coef_exp2=. gen coef_man=. gen coef_white=. gen rsquare=. gen resid=. local i 1971 while `i' <= 2002 { reg lnwage ed1 ed3 ed4 ed5 exp exp2 occman occwhite r2 r3 r4 nonwhite [aw=wgt] if sex==1 & year==`i' replace coef_cons=_b[_cons] if sex==1 & year==`i' replace coef_ed1=_b[ed1] if sex==1 & year==`i' replace coef_ed3=_b[ed3] if sex==1 & year==`i' replace coef_ed4=_b[ed4] if sex==1 & year==`i' replace coef_ed5=_b[ed5] if sex==1 & year==`i' replace coef_exp=_b[exp] if sex==1 & year==`i' replace coef_exp2=_b[exp2] if sex==1 & year==`i' replace coef_man=_b[occman] if sex==1 & year==`i' replace coef_white=_b[occwhite] if sex==1 & year==`i' replace rsquare=e(r2) if sex==1 & year==`i' predict plnwage if sex==1 & year==`i', xb replace resid=lnwage-plnwage if sex==1 & year==`i' drop plnwage reg lnwage ed1 ed3 ed4 ed5 exp exp2 occman occwhite r2 r3 r4 nonwhite [aw=wgt] if sex==2 & year==`i' replace coef_cons=_b[_cons] if sex==2 & year==`i' replace coef_ed1=_b[ed1] if sex==2 & year==`i' replace coef_ed3=_b[ed3] if sex==2 & year==`i' replace coef_ed4=_b[ed4] if sex==2 & year==`i' replace coef_ed5=_b[ed5] if sex==2 & year==`i' replace coef_exp=_b[exp] if sex==2 & year==`i' replace coef_exp2=_b[exp2] if sex==2 & year==`i' replace coef_man=_b[occman] if sex==2 & year==`i' replace coef_white=_b[occwhite] if sex==2 & year==`i' replace rsquare=e(r2) if sex==2 & year==`i' predict plnwage if sex==2 & year==`i', xb replace resid=lnwage-plnwage if sex==2 & year==`i' drop plnwage local i = `i'+ 1 } save reg_result2.dta, replace sort sex year collapse (mean) coef_ed1 coef_ed3 coef_ed4 coef_ed5 coef_exp coef_exp2 coef_man coef_white rsquare /* */ (sd) sd_resid=resid (p10) p10_resid=resid (p90) p90_resid=resid [aw=wgt] if wgt>=0, by(sex year) outsheet using "Results/reg_occ.out", replace