41 lines
1020 B
Plaintext
41 lines
1020 B
Plaintext
use individual
|
|
sort individid
|
|
save individual, replace
|
|
use observation
|
|
sort observeid
|
|
save observation, replace
|
|
use membership
|
|
drop if (mem_edate != . & mem_edate < $refdate)
|
|
drop if (mem_sdate != . & mem_sdate > $refdate)
|
|
gen refdate = $refdate
|
|
rename mem_sobserveid observeid
|
|
duplicates drop individid, force
|
|
sort observeid
|
|
merge observeid using observation
|
|
tab _merge
|
|
drop if _merge!=3
|
|
drop _merge
|
|
rename locationid sociallocid
|
|
keep socialgpid individid sociallocid refdate
|
|
sort individid
|
|
format refdate %td
|
|
merge individid using individual
|
|
tab _merge
|
|
drop if _merge != 3
|
|
drop _merge
|
|
rename birthdate bod
|
|
drop appround
|
|
drop ind_name
|
|
duplicates drop individid, force
|
|
replace fatherid = "00000000000" if strlen(fatherid) !=11
|
|
replace motherid = "00000000000" if strlen(motherid) !=11
|
|
save cross\crossmembership, replace
|
|
use individual
|
|
keep individid birthdate
|
|
rename individid fatherid
|
|
rename birthdate fbod
|
|
save cross\crossfbod, replace
|
|
rename fatherid motherid
|
|
rename fbod mbod
|
|
save cross\crossmbod, replace
|
|
close |