Uloading
Uloading
This commit is contained in:
28
Chililabdata/GenLongMembership.do
Normal file
28
Chililabdata/GenLongMembership.do
Normal file
@@ -0,0 +1,28 @@
|
||||
clear
|
||||
cd e:\chililabdata\data
|
||||
use membership
|
||||
sort individid
|
||||
drop if individid==""
|
||||
replace mem_sdate=mem_sdate/86400000
|
||||
rename mem_sdate sdate
|
||||
format sdate %td
|
||||
gen year = year( sdate)
|
||||
drop if year < 2004
|
||||
gen h = halfyear(sdate)
|
||||
gen round = yh(year,h)-89
|
||||
sort individid round
|
||||
duplicates drop individid round, force
|
||||
gen period = round[_n+1]-round
|
||||
replace period = 109-89 -round if individ != individid[_n+1]
|
||||
drop mem_episodeid mem_sobserveid mem_seventtype mem_eobserveid mem_edate mem_eeventtype mem_no socialgpidGuid mem_sobserveidGuid mem_eobserveidGuid h year
|
||||
expand period
|
||||
sort individid round
|
||||
by individid round: gen p=_n-1
|
||||
replace round = round+p
|
||||
drop if round > 19
|
||||
tostring round, generate(rounds)
|
||||
replace rounds = "0" + rounds if strlen(rounds) == 1
|
||||
gen socialkeys = socialgpid + rounds
|
||||
gen individkey = individid + rounds
|
||||
drop period p
|
||||
save rMembership, replace
|
Reference in New Issue
Block a user