27 lines
689 B
Plaintext
27 lines
689 B
Plaintext
clear
|
|
|
|
cd e:\chililabdata\data
|
|
use individual
|
|
sort individid
|
|
save, replace
|
|
use birth
|
|
sort individid
|
|
duplicates drop individid, force
|
|
merge 1:1 individid using individual, keepusing(gender motherid)
|
|
rename gender sex
|
|
rename individid childid
|
|
rename motherid individid
|
|
gen socialgpid = substr(observeid,1,9)
|
|
replace bth_date= bth_date/86400000
|
|
format bth_date %td
|
|
gen year = year( bth_date)
|
|
gen h = halfyear(bth_date)
|
|
gen round = yh(year,h)-89
|
|
tostring round, generate(rounds)
|
|
replace rounds = "0" + rounds if strlen(rounds) ==1
|
|
gen socialkey = socialgpid+ rounds
|
|
gen individkey = individid+ rounds
|
|
drop eventid observeid individidGuid _merge h
|
|
drop if round < 0
|
|
save rBirths, replace
|