Uloading
Uloading
This commit is contained in:
29
Chililabdata/GenLongYMembership.do
Normal file
29
Chililabdata/GenLongYMembership.do
Normal file
@@ -0,0 +1,29 @@
|
||||
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 round = year
|
||||
sort individid round
|
||||
duplicates drop individid round, force
|
||||
|
||||
gen period = round[_n+1]-round
|
||||
replace period = 2014-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 year
|
||||
expand period
|
||||
replace round = round-2004
|
||||
sort individid round
|
||||
by individid round: gen p=_n-1
|
||||
replace round = round+p
|
||||
drop if round > 10
|
||||
tostring round, generate(rounds)
|
||||
replace rounds = "0" + rounds if strlen(rounds) == 1
|
||||
gen socialkeys = socialgpid + rounds
|
||||
gen individkey = individid + rounds
|
||||
drop period p
|
||||
save rYMembership, replace
|
Reference in New Issue
Block a user