|
|
|
|
| clear all
|
| set more off
|
| set maxvar 10000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| cd raw_data
|
|
|
|
|
| do IND2011ER.do
|
|
|
|
|
|
|
|
|
|
|
| gen hid=ER30001*1000+ER30002
|
|
|
| cd ..
|
| cd proc_data
|
| save temp_master.dta,replace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| use temp_master.dta,clear
|
| drop if ER33503!=10
|
| drop if ER33502!=1
|
| rename ER33501 fam_ID_year
|
| joinby fam_ID_year using temp1999.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER33504
|
| drop ER*
|
| save p1999.dta, replace
|
|
|
| use temp_master.dta,clear
|
| drop if ER33603!=10
|
| drop if ER33602!=1
|
| rename ER33601 fam_ID_year
|
| joinby fam_ID_year using temp2001.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER33604
|
| drop if ER33608!=0
|
| drop ER*
|
| save p2001.dta, replace
|
|
|
| use temp_master.dta,clear
|
| drop if ER33703!=10
|
| drop if ER33702!=1
|
| rename ER33701 fam_ID_year
|
| joinby fam_ID_year using temp2003.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER33704
|
| drop if ER33708!=0
|
| drop ER*
|
| save p2003.dta, replace
|
|
|
| use temp_master.dta,clear
|
| drop if ER33803!=10
|
| drop if ER33802!=1
|
| rename ER33801 fam_ID_year
|
| joinby fam_ID_year using temp2005.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER33804
|
| drop if ER33808!=0
|
| drop ER*
|
| save p2005.dta, replace
|
|
|
| use temp_master.dta,clear
|
| drop if ER33903!=10
|
| drop if ER33902!=1
|
| rename ER33901 fam_ID_year
|
| joinby fam_ID_year using temp2007.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER33904
|
| drop if ER33908!=0
|
| drop ER*
|
| save p2007.dta, replace
|
|
|
| use temp_master.dta,clear
|
| drop if ER34003!=10
|
| drop if ER34002!=1
|
| rename ER34001 fam_ID_year
|
| joinby fam_ID_year using temp2009.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER34004
|
| drop if ER34008!=0
|
| drop ER*
|
| save p2009.dta, replace
|
|
|
| use temp_master.dta,clear
|
| drop if ER34103!=10
|
| drop if ER34102!=1
|
| rename ER34101 fam_ID_year
|
| joinby fam_ID_year using temp2011.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| drop if age_head!=ER34104
|
| drop if ER34108!=0
|
| drop ER*
|
| save p2011.dta, replace
|
|
|
|
|
|
|
|
|
|
|
|
|
| forval x=1999(2)2011{
|
| use p`x'.dta, clear
|
| ren aftertax_income_defl_equiv inc`x'
|
| ren age_head age`x'
|
| ren ed_head edu`x'
|
| ren marital_status_head mstat`x'
|
| ren fam_ID_year fam_ID`x'
|
| ren size_fam size_fam`x'
|
| drop fam_ID_1968 year_survey
|
| save pk`x'.dta,replace
|
| }
|
|
|
|
|
| use pk1999.dta, clear
|
| forval x=2001(2)2011{
|
| joinby hid using pk`x'.dta, unmatched(both)
|
| drop if _merge!=3
|
| drop _merge
|
| local i=`x'-2
|
| di "`i'"
|
| gen b=age`x'-age`i'
|
| tab b
|
| drop if b!=2 & b!=1 & b!=3
|
| drop b
|
| gen a=edu`x'-edu`i'
|
| tab a
|
| drop if a<0
|
| drop a
|
| }
|
|
|
|
|
| reshape long inc age edu mstat fam_ID size_fam, i(hid) j(year)
|
|
|
| save for_reg.dta, replace
|
|
|