Uloading
Uloading
This commit is contained in:
34
Chililabdata/GenLongYOccupation.do
Normal file
34
Chililabdata/GenLongYOccupation.do
Normal file
@@ -0,0 +1,34 @@
|
||||
clear all
|
||||
cd data
|
||||
use observation
|
||||
sort observeid
|
||||
save, replace
|
||||
use occupation
|
||||
rename occ_sobserveid observeid
|
||||
sort observeid
|
||||
merge m:1 observeid using observation, keepusing(obs_entry_date)
|
||||
keep if _merge ==3
|
||||
gen year = year( obs_entry_date/86400000)
|
||||
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 individid!=individid[_n+1]
|
||||
expand period
|
||||
replace round = round-2004
|
||||
sort individid round
|
||||
by individid round: gen p= _n-1
|
||||
replace round = round + p
|
||||
drop if round > 10
|
||||
drop period p _merge obs_entry_date
|
||||
tostring round, generate(rounds)
|
||||
replace rounds = "0" + rounds if strlen(rounds) == 1
|
||||
gen individkey = individid + rounds
|
||||
sort individkey
|
||||
duplicates drop individkey, force
|
||||
drop occ_episodeid observeid occ_eobserveid
|
||||
save rYOccupation, replace
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user