Uloading
Uloading
This commit is contained in:
44
Chililabdata/GenCrossEducation.do
Normal file
44
Chililabdata/GenCrossEducation.do
Normal file
@@ -0,0 +1,44 @@
|
||||
use observation
|
||||
sort observeid
|
||||
save observation, replace
|
||||
use education
|
||||
keep individid eduid edu_sobserveid
|
||||
rename edu_sobserveid observeid
|
||||
sort observeid
|
||||
merge observeid using observation, nokeep keep (obs_de_date)
|
||||
gen refdate = $refdate + 180
|
||||
|
||||
drop if refdate < obs_de_date
|
||||
gen period = qofd(refdate )-qofd(obs_de_date ) +1
|
||||
expand period
|
||||
sort individid obs_de_date
|
||||
by individid obs_de_date: gen p= _n-1
|
||||
gen quarterdate = qofd(obs_de_date) + p
|
||||
gen refquarter = qofd(refdate )
|
||||
sort individid quarterdate
|
||||
egen maxobs_de_date = max(obs_de_date), by(individid quarterdate)
|
||||
keep if obs_de_date == maxobs_de_date
|
||||
sort individid
|
||||
gen fatherid = individid
|
||||
gen motherid = individid
|
||||
gen partnerid = individid
|
||||
gen feduid = eduid
|
||||
gen meduid = eduid
|
||||
gen peduid= eduid
|
||||
tostring quarterdate, generate(key)
|
||||
replace key = individid + key
|
||||
duplicates drop key, force
|
||||
drop _merge
|
||||
sort key
|
||||
save crosseducationtemp, replace
|
||||
keep if refquarter == quarterdate
|
||||
format refdate %td
|
||||
keep individid fatherid motherid partnerid eduid feduid meduid peduid refdate obs_de_date observeid
|
||||
duplicates drop individid, force
|
||||
sort individid
|
||||
|
||||
save cross\crosseducation, replace
|
||||
keep partnerid peduid
|
||||
sort partnerid
|
||||
save cross\crosspeducation, replace
|
||||
|
Reference in New Issue
Block a user