|
clear all
|
|
set more off
|
|
cd "/Users/vriddhi/Desktop/Data"
|
|
global data "/Users/vriddhi/Desktop/Data"
|
|
foreach w in b c d e f g h i j k l {
|
|
local waveno = strpos("abcdefghijkl", "`w'")
|
|
use pidp `w'_psu `w'_strata `w'_indin91_lw `w'_age_dv `w'_birthy `w'_qfhigh_dv `w'_paygu_dv `w'_age_dv_f `w'_age_dv_m `w'_birthy_f `w'_birthy_m `w'_qfhigh_dv_f `w'_qfhigh_dv_m `w'_ethn_dv `w'_gor_dv `w'_sex `w'_gor_dv using "$data/`w'_matched", clear
|
|
rename `w'_* *
|
|
gen wave = `waveno'
|
|
gen time = wave
|
|
save `w'_appended, replace
|
|
}
|
|
|
|
use b_appended, clear
|
|
|
|
foreach w in c d e f g h i j k l {
|
|
append using `w'_appended
|
|
}
|
|
tab wave
|
|
|
|
save finalappendedfile, replace
|
|
|
|
foreach w in b c d e f g h i j k l {
|
|
erase `w'_appended.dta
|
|
}
|
|
|
|
duplicates tag pidp, gen(dupl)
|
|
keep if dupl==1
|
|
for var _all: replace X=. if X<0
|
|
sort pidp wave
|
|
bys pidp: replace indin91_lw=indin91_lw[_N]
|
|
bys pidp: replace psu=psu[_N]
|
|
bys pidp: replace strata=strata[_N]
|
|
svyset psu, str(strata) singleunit(scaled)
|
|
|
|
recode paygu_dv age_dv birthy age_dv_f age_dv_m qfhigh_dv (-9/-1=.)
|
|
ssc install tsspell
|
|
xtset pidp time
|
|
xtdes
|
|
tsspell time, cond (D.time==1)
|
|
replace _spell=F._spell if _spell==0
|
|
egen maxspell = max (_seq+1), by (pidp _spell)
|
|
drop if maxspell <2
|
|
|
|
gen parent_income = paygu_dv*12/4 if wave<=4
|
|
gen child_income = paygu_dv*12/4 if wave>=8
|
|
|
|
sum parent_income child_income
|