Uloading
This commit is contained in:
2025-08-02 05:26:16 +07:00
commit 8c43da1d1c
529 changed files with 189689 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
clear
cd e:\chililabdata\data
use individual
sort individid
save, replace
use birth
sort individid
duplicates drop individid, force
merge 1:1 individid using individual, keepusing(gender motherid)
rename gender sex
rename individid childid
rename motherid individid
gen socialgpid = substr(observeid,1,9)
replace bth_date= bth_date/86400000
format bth_date %td
gen year = year( bth_date)
gen h = halfyear(bth_date)
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 observeid individidGuid _merge h
drop if round < 0
save rBirths, replace

View File

@@ -0,0 +1,17 @@
clear
cd e:\chililabdata\data
use death
gen socialgpid = substr(observeid,1,9)
replace dth_date=dth_date/86400000
format dth_date %td
gen year = year( dth_date)
gen h = halfyear(dth_date)
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 EID h eventid observeid year individidGuid
duplicates drop individkey, force
drop if round < 0
save rDeaths, replace

View File

@@ -0,0 +1,16 @@
clear
cd e:\chililabdata\data
use inmigration
replace img_date=img_date/86400000
format img_date %td
gen year = year( img_date)
gen h = halfyear(img_date)
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 EID h socialgpidGuid rounds eventid observeid year
duplicates drop individkey, force
drop if round < 0
save rImmigration, replace

View File

@@ -0,0 +1,25 @@
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)
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
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen socialkeys = socialgpid + rounds
drop period p
save rMembership, replace

View File

@@ -0,0 +1,32 @@
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)
gen h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
sort individid round
gen period = round[_n+1]-round
replace period = 109-round if individid!=individid[_n+1]
expand period
replace round = round-89
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop h 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 rOccupation, replace

View File

@@ -0,0 +1,16 @@
clear
cd e:\chililabdata\data
use outmigration
replace out_date=out_date/86400000
format out_date %td
gen year = year( out_date)
gen h = halfyear(out_date)
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 EID h socialgpidGuid eventid observeid year
duplicates drop individkey, force
drop if round < 0
save rOutmigration, replace

View File

@@ -0,0 +1,31 @@
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!=3
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 rounds h year
sort individid round
drop if round < 0
save rPregnance, replace

View File

@@ -0,0 +1,34 @@
clear all
cd data
use observation
sort observeid
save, replace
use education
rename edu_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)
gen h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
gen r = round
sort individid round
gen period = round[_n+1]-round
replace period = 109-round if individid!=individid[_n+1]
expand period
replace round = round-89
gen m = round
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop _merge
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen individkey = individid + rounds
sort individkey
duplicates drop individkey, force
drop edu_episodeid observeid edu_eobserveid
save rEducation, replace

View File

@@ -0,0 +1,33 @@
clear all
cd data
use observation
sort observeid
save, replace
use householdinfo
sort observeid
merge m:1 observeid using observation, keepusing(obs_entry_date)
drop round
keep if _merge ==3
drop if socialgpid ==""
gen year = year( obs_entry_date/86400000)
gen h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
sort socialgpid round
gen period = round[_n+1]-round
replace period = 109-round if socialgpid!=socialgpid[_n+1]
expand period
replace round = round-89
sort socialgpid round
by socialgpid round: gen p= _n-1
replace round = round + p
drop h period p _merge obs_entry_date
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen socialkey = socialgpid+ rounds
drop hhinforid
sort socialkey
duplicates drop socialkey, force
save rHouseholdInfo, replace

View File

@@ -0,0 +1,38 @@
clear all
cd e:\chililabdata\data
use individual
sort individid
save, replace
use observation
sort observeid
save, replace
use indmarstatus
rename mar_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)
gen h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
sort individid round
gen period = round[_n+1]-round
replace period = 109-round if individid!=individid[_n+1]
expand period
replace round = round-89
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop period p _merge
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen individkey = individid + rounds
sort individkey
duplicates drop individkey, force
sort individid
merge m:1 individid using individual, keepusing(gender ethnicid)
drop mar_episodeid observeid mar_eobserveid obs_entry_date year h _merge
save rMarstatus, replace

View File

@@ -0,0 +1,26 @@
clear
cd e:\chililabdata\data
use individual
sort individid
save, replace
use birth
sort individid
duplicates drop individid, force
merge 1:1 individid using individual, keepusing(gender motherid)
rename gender sex
rename individid childid
rename motherid individid
gen socialgpid = substr(observeid,1,9)
replace bth_date= bth_date/86400000
format bth_date %td
gen year = year( bth_date)
gen h = halfyear(bth_date)
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 observeid individidGuid _merge h
drop if round < 0
save rBirths, replace

View File

@@ -0,0 +1,17 @@
clear
cd e:\chililabdata\data
use death
gen socialgpid = substr(observeid,1,9)
replace dth_date=dth_date/86400000
format dth_date %td
gen year = year( dth_date)
gen h = halfyear(dth_date)
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 EID h eventid observeid year individidGuid
duplicates drop individkey, force
drop if round < 0
save rDeaths, replace

View File

@@ -0,0 +1,18 @@
clear
cd e:\chililabdata\data
use inmigration
replace img_date=img_date/86400000
format img_date %td
gen year = year( img_date)
drop if year < 2004
gen h = halfyear(img_date)
gen round = yh(year,h)-89
drop if round > 19
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) ==1
gen socialkey = socialgpid+ rounds
gen individkey = individid+ rounds
drop EID h socialgpidGuid rounds eventid observeid year
duplicates drop individkey, force
drop if round < 0
save rImmigration, replace

View 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

View 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 h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
sort individid round
gen period = round[_n+1]-round
replace period = 109-round if individid!=individid[_n+1]
expand period
replace round = round-89
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop if round > 19
drop h 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 rOccupation, replace

View File

@@ -0,0 +1,17 @@
clear
cd e:\chililabdata\data
use outmigration
replace out_date=out_date/86400000
format out_date %td
gen year = year( out_date)
drop if year < 2004
gen round = year-2004
drop if round > 10
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) ==1
gen socialkey = socialgpid+ rounds
gen individkey = individid+ rounds
drop EID socialgpidGuid eventid observeid year
duplicates drop individkey, force
drop if round < 0
save rYOutmigration, replace

View File

@@ -0,0 +1,31 @@
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!=3
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 rounds h year
sort individid round
drop if round < 0
save rPregnance, replace

View File

@@ -0,0 +1,17 @@
clear
cd e:\chililabdata\data
use inmigration
replace img_date=img_date/86400000
format img_date %td
gen year = year( img_date)
drop if year < 2004
gen round = year-2004
drop if round > 10
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) ==1
gen socialkey = socialgpid+ rounds
gen individkey = individid+ rounds
drop EID socialgpidGuid rounds eventid observeid year
duplicates drop individkey, force
drop if round < 0
save rImmigration, replace

View 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

View 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

View File

@@ -0,0 +1,37 @@
clear all
cd data
use observation
sort observeid
save, replace
use education
rename edu_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 h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
gen r = round
sort individid round
gen period = round[_n+1]-round
replace period = 109-round if individid!=individid[_n+1]
expand period
replace round = round-89
gen m = round
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop if round > 19
drop _merge
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen individkey = individid + rounds
sort individkey
duplicates drop individkey, force
drop edu_episodeid observeid edu_eobserveid
save rEducation, replace

View File

@@ -0,0 +1,35 @@
clear all
cd data
use observation
sort observeid
save, replace
use householdinfo
sort observeid
merge m:1 observeid using observation, keepusing(obs_entry_date)
drop round
keep if _merge ==3
drop if socialgpid ==""
gen year = year( obs_entry_date/86400000)
drop if year < 2004
gen h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
sort socialgpid round
gen period = round[_n+1]-round
replace period = 109-round if socialgpid!=socialgpid[_n+1]
expand period
replace round = round-89
sort socialgpid round
by socialgpid round: gen p= _n-1
replace round = round + p
drop if round > 19
drop h period p _merge obs_entry_date
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen socialkey = socialgpid+ rounds
drop hhinforid
sort socialkey
duplicates drop socialkey, force
save rHouseholdInfo, replace

View File

@@ -0,0 +1,44 @@
clear all
cd e:\chililabdata\data
use individual
sort individid
save, replace
use observation
sort observeid
save, replace
use indmarstatus
rename mar_sobserveid observeid
sort observeid
merge m:1 observeid using observation, keepusing(obs_entry_date)
keep if _merge ==3
gen visitdate = obs_entry_date/86400000
gen year = year( obs_entry_date/86400000)
drop if year < 2004
gen h = halfyear(obs_entry_date/86400000)
gen round = yh(year,h)
sort individid round
gen period = round[_n+1]-round
replace period = 109-round if individid!=individid[_n+1]
expand period
replace round = round-89
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop if round > 19
drop period p _merge
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen individkey = individid + rounds
sort individkey
duplicates drop individkey, force
sort individid
merge m:1 individid using individual, keepusing(gender ethnicid bod)
gen firstdate = mdy(7,1,2004)
gen roundtime = firstdate+ 180*round
gen age = (roundtime-bod)/365.25
drop mar_episodeid observeid mar_eobserveid obs_entry_date year h _merge
save rMarstatus, replace

View File

@@ -0,0 +1,38 @@
clear all
cd data
use observation
sort observeid
save, replace
use education
rename edu_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 r = round
sort individid round
gen period = round[_n+1]-round
replace period = 2014-round if individid!=individid[_n+1]
expand period
replace round = round-2004
gen m = round
sort individid round
by individid round: gen p= _n-1
replace round = round + p
drop if round > 10
drop _merge
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen individkey = individid + rounds
sort individkey
duplicates drop individkey, force
drop edu_episodeid observeid edu_eobserveid
save rYEducation, replace

View File

@@ -0,0 +1,36 @@
clear all
cd data
use observation
sort observeid
save, replace
use householdinfo
sort observeid
merge m:1 observeid using observation, keepusing(obs_entry_date)
drop round
keep if _merge ==3
drop if socialgpid ==""
gen year = year( obs_entry_date/86400000)
drop if year < 2004
gen round = year
sort socialgpid round
duplicates drop socialgpid round, force
gen period = round[_n+1]-round
replace period = 2014-round if socialgpid!=socialgpid[_n+1]
expand period
replace round = round-2004
sort socialgpid round
by socialgpid 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 socialkey = socialgpid+ rounds
drop hhinforid
sort socialkey
duplicates drop socialkey, force
save rYHouseholdInfo, replace

View File

@@ -0,0 +1,42 @@
clear all
cd e:\chililabdata\data
use individual
sort individid
save, replace
use observation
sort observeid
save, replace
use indmarstatus
rename mar_sobserveid observeid
sort observeid
merge m:1 observeid using observation, keepusing(obs_entry_date)
keep if _merge ==3
gen visitdate = obs_entry_date/86400000
gen year = year( obs_entry_date/86400000)
drop if year < 2004
gen round = year
sort individid round
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 > 19
drop period p _merge
tostring round, generate(rounds)
replace rounds = "0" + rounds if strlen(rounds) == 1
gen individkey = individid + rounds
sort individkey
duplicates drop individkey, force
sort individid
merge m:1 individid using individual, keepusing(gender ethnicid bod)
gen firstyear = 2004
gen roundyear = firstyear+ round
gen age = roundyear-year(bod)
drop mar_episodeid observeid mar_eobserveid obs_entry_date year _merge
save rYMarstatus, replace