Uloading
Uloading
This commit is contained in:
32
Chililabdata/GenPregnance.do
Normal file
32
Chililabdata/GenPregnance.do
Normal file
@@ -0,0 +1,32 @@
|
||||
clear
|
||||
|
||||
cd e:\chililabdata\data
|
||||
use individual
|
||||
sort individid
|
||||
save, replace
|
||||
use pregnance
|
||||
sort individid
|
||||
merge m:1 individid using individual, keepusing(birthdate)
|
||||
drop if _merge!=2
|
||||
drop _merge
|
||||
gen socialgpid = substr(sobserveid,1,9)
|
||||
replace preg_sdate= preg_sdate/86400000
|
||||
rename preg_sdate sdate
|
||||
replace preg_edate= preg_edate/86400000
|
||||
rename preg_edate edate
|
||||
replace birthdate= birthdate/86400000
|
||||
rename birthdate bod
|
||||
format bod %td
|
||||
format sdate %td
|
||||
format edate %td
|
||||
gen year = year( sdate)
|
||||
gen h = halfyear(sdate)
|
||||
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 sobserveid fatherid fatheridGuid EID
|
||||
sort individid round
|
||||
drop if round < 0
|
||||
save rPregnance, replace
|
Reference in New Issue
Block a user