*Syntax to create the MTUS World 5.53 files for the Netherlands 2005. Written by Dr. José Ignacio Gimenez Nadal, University of Zaragoza (Spain) and Center for Time Use Research (University of Oxford). December 2010 *Cleaning the workspace and extending the size of the memory clear set more off set mem 900m set maxvar 15000 *Creating a working directory where all the files will be stored. The output data is in the working directory and all the original files must be in this directory before starting with the xharmonization process. local path="F:\Nacho\Data\MTUS_harmonization\Netherlands_95" cd `path' /* ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ************************************************************* WE READ THE DATA AND SAVE IT ************************************************************************************* ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** clear use Netherlands_a_95.dta capture rename v001 resp sort resp save Netherlands_a_95.dta, replace clear use Netherlands_h_95.dta capture rename respnr resp sort resp save Netherlands_h_95.dta, replace clear use Netherlands_a_95.dta merge resp using Netherlands_h_95.dta drop _merge save Netherlands_1995.dta, replace ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** */ clear use Netherlands_1995.dta drop akt* xakt* ********************************************************************* DEMOGRAPHIC CHARACTERISTICS *************************************************************************** *COUNTREG generate countrya=22 *SURVEY generate survey=1995 *SWAVE generate swave=0 *MSAMP generate msamp=0 **PERSID generate persid=resp **YEAR generate year=1995 **MONTH generate month=10 *HLDID generate hldid=0 **SEX generate sex=sexe **AGE generate age=v317 replace age=80 if age>=80 **REFREFP generate relrefp=1 if v312==1 | v312==2 replace relrefp=2 if v312==4 replace relrefp=3 if v312==3 replace relrefp=9 if v312==9 replace relrefp=10 if v312==10 **HHLDSIZE generate hhldsize=v319 **NCHILD generate nchild=v321 replace nchild=nchild+1 if age==17 replace nchild=0 if nchild>0 & v326==4 **AGEKIDX generate agekidx=1 if v326==1 replace agekidx=2 if v326==2 replace agekidx=3 if v326==3 replace agekidx=4 if v326==4 replace agekidx=-8 if v326==. generate marker_child_18=1 if age>=18 & relrefp==3 replace marker_child_18=0 if marker_child_18==. replace agekidx=-7 if nchild==0 & marker_child_18==0 **URBAN generate urban=1 if v356>=4 replace urban=2 if v356<4 **STUDENT generate student=1 if werkzaam==5 replace student=0 if student==. replace student=-8 if werkzaam==. **RETIRED generate retired=1 if werkzaam==2 replace retired=0 if retired==. replace retired=-8 if werkzaam==. **UNEMP generate unemp=1 if werkzaam==3 replace unemp=0 if unemp==. replace unemp=-8 if werkzaam==. **WORKHRS generate workhrs=v346 replace workhrs=-8 if workhrs==. & werkzam3==1 replace workhrs=-7 if werkzam3!=1 & workhrs==. **EMPSTAT generate empstat=1 if (workhrs>=40 & workhrs!=.) & werkzam3==1 replace empstat=2 if (workhrs>0 & workhrs<40) & werkzam3==1 replace empstat=3 if empstat==. & werkzam3==1 replace empstat=4 if empstat==. **EMP generate emp=1 if empstat>=1 & empstat<=3 replace emp=0 if emp==. **adjust for unemployed, retired and students having positive hours of work replace empstat=3 if (empstat==1 | empstat==2) & (unemp==1 | retired==1 | student==1) **EDUCA generate educa=oplhh3 replace educa=-8 if educa==. **EDTRY generate edtry=1 if oplhh3==1 replace edtry=2 if oplhh3==2 replace edtry=3 if oplhh3==3 replace edtry=-8 if edtry==. *CIVSTAT generate civstat=1 if burgsta==2 replace civstat=2 if burgsta==1 | burgsta==3 | burgsta==4 replace civstat=1 if relrefp==2 & civstat==. replace civstat=2 if relrefp==4 & civstat==. replace civstat=2 if age<18 & civstat==. replace civstat=1 if v315==1 & burgsta==. replace civstat=-8 if civstat==. replace civstat=2 if age<17 ***COHAB generate cohab=1 if v315==1 & v314!=1 replace cohab=0 if cohab==. replace cohab=0 if cohab==1 & age<17 **EMPSP generate empsp=4 if partwerk==2 replace empsp=3 if partwerk==3 replace empsp=-7 if civstat==2 replace empsp=2 if v149>0 & v149<35 & empsp==. replace empsp=1 if v149>35 & v149!=. & empsp==. replace empsp=-8 if empsp==. replace empsp=-8 if relrefp==2 & empsp==-7 **FAMSTAT generate famstat=0 if (nchild==0) & (age>=18 & age<=39) replace famstat=3 if (nchild==0) & age>=40 replace famstat=4 if age<18 & relrefp==3 replace famstat=5 if age<18 & relrefp!=3 replace famstat=1 if (age>=18) & agekidx==1 replace famstat=2 if (age>=18) & (agekidx==2 | agekidx==3) **VEHICLE generate vehicle=4 if (v222>2 & v222!=.) | (v221==1 & v220==1) replace vehicle=3 if (v221==1 | v220==1) & vehicle==. replace vehicle=2 if v219==1 & vehicle==. replace vehicle=0 if vehicle==. & v221!=. replace vehicle=-8 if vehicle==. **PARNTID1 gen parntid1=-9 **PARNTID2 gen parntid2=-9 **PARTID gen partid=-9 **COMPUTER generate computer=1 if v216==1 replace computer=0 if v216==2 replace computer=-8 if computer==. **INCORIG generate incorig=v258 replace incorig=-8 if incorig==. **INCOME generate income=1 if v258<=2450 replace income=2 if v258>2450 & v258<5000 replace income=3 if v258>=5000 & v258!=. replace income=-8 if income==. **SINGPAR generate singpar=1 if civstat==2 & nchild>0 & relrefp==1 replace singpar=0 if singpar==. **CPHOME generate cphome=1 if relrefp==3 & civstat==2 replace cphome=0 if cphome==. *HHTYPE generate hhtype=1 if hhldsize==1 replace hhtype=2 if civstat==1 & hhldsize==2 replace hhtype=3 if hhldsize>2 & civstat==1 & hhtype==. replace hhtype=4 if hhtype==. replace hhtype=3 if (hhtype==4 & famstat==4) & hhldsize>=nchild+2 ** VARIABLES THAT CANNOT BE CREATED generate agekid2=-9 generate empinclm=-9 generate citizen=-9 generate occup=-9 generate ownhome=-9 generate sector=-9 generate rushed=-9 generate health=-9 generate disab=-9 **ROBUSTNESS CHECKS TO SEE THAT VARIABLES ARE PREFECTLY CODED ************************************************************* **THERE ARE CASES WHERE RETIRED==-8 OR STUDENT==-8 & WORKHRS>35 replace student=0 if student==-8 & workhrs>0 replace retired=0 if retired==-8 & workhrs>0 replace retired=0 if age<50 replace student=0 if age>50 replace hhldsize=3 if hhtype==2 & (famstat==1 | famstat==2) replace hhtype=3 if hhtype==2 & (famstat==1 | famstat==2) replace agekidx=3 if famstat==5 & agekidx==-8 replace agekidx=3 if agekidx==-7 & famstat==5 replace famstat=-8 if famstat==. replace nchild=1 if nchild==0 & age<18 & famstat==5 replace hhldsize=hhldsize+1 if hhldsize==nchild & hhldsize>1 **WORKHRS AND UNEMP, RETIRED AND STUDENT replace empstat=1 if workhrs>=35 & (unemp==1 | retired==1 | student==1) replace empstat=2 if (workhrs>0 & workhrs<35) & (unemp==1 | retired==1 | student==1) replace emp=1 if (empstat==1 | empstat==2) & emp!=1 replace civstat=2 if civstat==-8 & hhldsize==1 replace cohab=-7 if civstat==2 replace emp=1 if workhrs>=10 & emp==0 replace empstat=1 if empstat==4 & workhrs>=35 replace empstat=2 if empstat==4 & (workhrs>=10 & workhrs<35) replace empstat=3 if empstat==4 & (retired==1 | student==1) & workhrs>0 replace empsp=-7 if civstat==2 & empsp==-8 replace cohab=-8 if cohab==0 & civstat==-8 ****************************************************************************************************************************************************************************** ****************************************************************************************************************************************************************************** ********************************************************************************* TIME USE VARIABLES ************************************************************************* ****************************************************************************************************************************************************************************** ****************************************************************************************************************************************************************************** *************************************************************************** DATA PREPARATION ********************************************************************************* **IMPUTED SLEEP==4710 local k=1 while `k'<8{ local i=2 while `i'<10{ local j=`i'-1 replace xha`k'0`i'=4710 if xha`k'0`i'==9999 & (xha`k'0`j'==4050 | xha`k'0`j'==4060 | xha`k'0`j'==4070) local i=`i'+1 } replace xha`k'10=4710 if xha`k'10==9999 & (xha`k'09==4050 | xha`k'09==4060 | xha`k'09==4070) local i=11 while `i'<97{ local j=`i'-1 replace xha`k'`i'=4710 if xha`k'`i'==9999 & (xha`k'`j'==4050 | xha`k'`j'==4060 | xha`k'`j'==4070) local i=`i'+1 } local k=`k'+1 } local k=1 while `k'<8{ local i=2 while `i'<9{ local j=`i'+1 replace xha`k'0`i'=4710 if xha`k'0`i'==9999 & (xha`k'0`j'==4050 | xha`k'0`j'==4060 | xha`k'0`j'==4070) local i=`i'+1 } replace xha`k'09=4710 if xha`k'09==9999 & (xha`k'10==4050 | xha`k'10==4060 | xha`k'10==4070) local i=11 while `i'<96{ local j=`i'+1 replace xha`k'`i'=4710 if xha`k'`i'==9999 & (xha`k'`j'==4050 | xha`k'`j'==4060 | xha`k'`j'==4070) local i=`i'+1 } local k=`k'+1 } local k=1 while `k'<8{ local i=2 while `i'<9{ local j=`i'+1 replace xha`k'0`i'=4710 if xha`k'0`i'==9999 & xha`k'0`j'==4710 local i=`i'+1 } replace xha`k'09=4710 if xha`k'09==9999 & xha`k'10==4710 local i=11 while `i'<96{ local j=`i'+1 replace xha`k'`i'=4710 if xha`k'`i'==9999 & xha`k'`j'==4710 local i=`i'+1 } local k=`k'+1 } local k=1 while `k'<8{ local i=2 while `i'<9{ local j=`i'-1 replace xha`k'0`i'=4710 if xha`k'0`i'==9999 & xha`k'0`j'==4710 local i=`i'+1 } replace xha`k'10=4710 if xha`k'10==9999 & xha`k'09==4710 local i=11 while `i'<97{ local j=`i'-1 replace xha`k'`i'=4710 if xha`k'`i'==9999 & xha`k'`j'==4710 local i=`i'+1 } local k=`k'+1 } **IMPUTED TIME AWAY FROM HOME (7820) local k=1 while `k'<8{ local i=2 while `i'<10{ replace xha`k'0`i'=7820 if xha`k'0`i'==9999 & (pl`k'0`i'==2 | pl`k'0`i'==3) local i=`i'+1 } local i=10 while `i'<97{ replace xha`k'`i'=7820 if xha`k'`i'==9999 & (pl`k'`i'==2 | pl`k'`i'==3) local i=`i'+1 } local k=`k'+1 } **IMPUTED PERSONAL AND HOUSEHOLD CARE==4001 local k=1 while `k'<8{ local i=2 while `i'<10{ local j=`i'-1 replace xha`k'0`i'=4001 if xha`k'0`i'==9999 & ((xha`k'0`j'>=31 | xha`k'0`j'<40) | (xha`k'0`j'>=91 | xha`k'0`j'<96) | (xha`k'0`j'>=131 | xha`k'0`j'<1000) | (xha`k'0`j'>=1091 | xha`k'0`j'<1099) | (xha`k'0`j'>=1191 | xha`k'0`j'<=1194) | (xha`k'0`j'>=2091 | xha`k'0`j'<2099) | (xha`k'0`j'>=3091 | xha`k'0`j'<3099) | (xha`k'0`j'>=4091 | xha`k'0`j'<4099) | (xha`k'0`j'>=5091 | xha`k'0`j'<5099) | (xha`k'0`j'>=6091 | xha`k'0`j'<6099) | (xha`k'0`j'>=7091 | xha`k'0`j'<7099) | (xha`k'0`j'>=8091 | xha`k'0`j'<8099) | xha`k'0`j'==8091 | xha`k'0`j'==2191 | xha`k'0`j'==2194 | xha`k'0`j'==3191 | xha`k'0`j'==3194 | xha`k'0`j'==4191 | xha`k'0`j'==4194 | xha`k'0`j'==5191 | xha`k'0`j'==5194 | xha`k'0`j'==6191 | xha`k'0`j'==6194 | xha`k'0`j'==7191 | xha`k'0`j'==7194 | xha`k'0`j'==8191 | xha`k'0`j'==8194) local i=`i'+1 } replace xha`k'10=4001 if xha`k'10==9999 & ((xha`k'09>=31 | xha`k'09<40) | (xha`k'09>=91 | xha`k'09<96) | (xha`k'09>=131 | xha`k'09<1000) | (xha`k'09>=1091 | xha`k'09<1099) | (xha`k'09>=1191 | xha`k'09<=1194) | (xha`k'09>=2091 | xha`k'09<2099) | (xha`k'09>=3091 | xha`k'09<3099) | (xha`k'09>=4091 | xha`k'09<4099) | (xha`k'09>=5091 | xha`k'09<5099) | (xha`k'09>=6091 | xha`k'09<6099) | (xha`k'09>=7091 | xha`k'09<7099) | (xha`k'09>=8091 | xha`k'09<8099) | xha`k'09==8091 | xha`k'09==2191 | xha`k'09==2194 | xha`k'09==3191 | xha`k'09==3194 | xha`k'09==4191 | xha`k'09==4194 | xha`k'09==5191 | xha`k'09==5194 | xha`k'09==6191 | xha`k'09==6194 | xha`k'09==7191 | xha`k'09==7194 | xha`k'09==8191 | xha`k'09==8194) local i=11 while `i'<97{ local j=`i'-1 replace xha`k'`i'=4001 if xha`k'`i'==9999 & ((xha`k'`j'>=31 | xha`k'`j'<40) | (xha`k'`j'>=91 | xha`k'`j'<96) | (xha`k'`j'>=131 | xha`k'`j'<1000) | (xha`k'`j'>=1091 | xha`k'`j'<1099) | (xha`k'`j'>=1191 | xha`k'`j'<=1194) | (xha`k'`j'>=2091 | xha`k'`j'<2099) | (xha`k'`j'>=3091 | xha`k'`j'<3099) | (xha`k'`j'>=4091 | xha`k'`j'<4099) | (xha`k'`j'>=5091 | xha`k'`j'<5099) | (xha`k'`j'>=6091 | xha`k'`j'<6099) | (xha`k'`j'>=7091 | xha`k'`j'<7099) | (xha`k'`j'>=8091 | xha`k'`j'<8099) | xha`k'`j'==8091 | xha`k'`j'==2191 | xha`k'`j'==2194 | xha`k'`j'==3191 | xha`k'`j'==3194 | xha`k'`j'==4191 | xha`k'`j'==4194 | xha`k'`j'==5191 | xha`k'`j'==5194 | xha`k'`j'==6191 | xha`k'`j'==6194 | xha`k'`j'==7191 | xha`k'`j'==7194 | xha`k'`j'==8191 | xha`k'`j'==8194) local i=`i'+1 } local k=`k'+1 } local k=1 while `k'<8{ local i=2 while `i'<9{ local j=`i'+1 replace xha`k'0`i'=4001 if xha`k'0`i'==9999 & ((xha`k'0`j'>=31 | xha`k'0`j'<40) | (xha`k'0`j'>=91 | xha`k'0`j'<96) | (xha`k'0`j'>=131 | xha`k'0`j'<1000) | (xha`k'0`j'>=1091 | xha`k'0`j'<1099) | (xha`k'0`j'>=1191 | xha`k'0`j'<=1194) | (xha`k'0`j'>=2091 | xha`k'0`j'<2099) | (xha`k'0`j'>=3091 | xha`k'0`j'<3099) | (xha`k'0`j'>=4091 | xha`k'0`j'<4099) | (xha`k'0`j'>=5091 | xha`k'0`j'<5099) | (xha`k'0`j'>=6091 | xha`k'0`j'<6099) | (xha`k'0`j'>=7091 | xha`k'0`j'<7099) | (xha`k'0`j'>=8091 | xha`k'0`j'<8099) | xha`k'0`j'==8091 | xha`k'0`j'==2191 | xha`k'0`j'==2194 | xha`k'0`j'==3191 | xha`k'0`j'==3194 | xha`k'0`j'==4191 | xha`k'0`j'==4194 | xha`k'0`j'==5191 | xha`k'0`j'==5194 | xha`k'0`j'==6191 | xha`k'0`j'==6194 | xha`k'0`j'==7191 | xha`k'0`j'==7194 | xha`k'0`j'==8191 | xha`k'0`j'==8194) local i=`i'+1 } replace xha`k'10=4001 if xha`k'10==9999 & ((xha`k'11>=31 | xha`k'11<40) | (xha`k'11>=91 | xha`k'11<96) | (xha`k'11>=131 | xha`k'11<1000) | (xha`k'11>=1091 | xha`k'11<1099) | (xha`k'11>=1191 | xha`k'11<=1194) | (xha`k'11>=2091 | xha`k'11<2099) | (xha`k'11>=3091 | xha`k'11<3099) | (xha`k'11>=4091 | xha`k'11<4099) | (xha`k'11>=5091 | xha`k'11<5099) | (xha`k'11>=6091 | xha`k'11<6099) | (xha`k'11>=7091 | xha`k'11<7099) | (xha`k'11>=8091 | xha`k'11<8099) | xha`k'11==8091 | xha`k'11==2191 | xha`k'11==2194 | xha`k'11==3191 | xha`k'11==3194 | xha`k'11==4191 | xha`k'11==4194 | xha`k'11==5191 | xha`k'11==5194 | xha`k'11==6191 | xha`k'11==6194 | xha`k'11==7191 | xha`k'11==7194 | xha`k'11==8191 | xha`k'11==8194) local i=11 while `i'<96{ local j=`i'+1 replace xha`k'`i'=4001 if xha`k'`i'==9999 & ((xha`k'`j'>=31 | xha`k'`j'<40) | (xha`k'`j'>=91 | xha`k'`j'<96) | (xha`k'`j'>=131 | xha`k'`j'<1000) | (xha`k'`j'>=1091 | xha`k'`j'<1099) | (xha`k'`j'>=1191 | xha`k'`j'<=1194) | (xha`k'`j'>=2091 | xha`k'`j'<2099) | (xha`k'`j'>=3091 | xha`k'`j'<3099) | (xha`k'`j'>=4091 | xha`k'`j'<4099) | (xha`k'`j'>=5091 | xha`k'`j'<5099) | (xha`k'`j'>=6091 | xha`k'`j'<6099) | (xha`k'`j'>=7091 | xha`k'`j'<7099) | (xha`k'`j'>=8091 | xha`k'`j'<8099) | xha`k'`j'==8091 | xha`k'`j'==2191 | xha`k'`j'==2194 | xha`k'`j'==3191 | xha`k'`j'==3194 | xha`k'`j'==4191 | xha`k'`j'==4194 | xha`k'`j'==5191 | xha`k'`j'==5194 | xha`k'`j'==6191 | xha`k'`j'==6194 | xha`k'`j'==7191 | xha`k'`j'==7194 | xha`k'`j'==8191 | xha`k'`j'==8194) local i=`i'+1 } local k=`k'+1 } local k=1 while `k'<8{ local i=2 while `i'<9{ local j=`i'+1 replace xha`k'0`i'=4001 if xha`k'0`i'==9999 & xha`k'0`j'==4001 local i=`i'+1 } replace xha`k'09=4001 if xha`k'09==9999 & xha`k'10==4001 local i=10 while `i'<96{ local j=`i'+1 replace xha`k'`i'=4001 if xha`k'`i'==9999 & xha`k'`j'==4001 local i=`i'+1 } local k=`k'+1 } local k=1 while `k'<8{ local i=2 while `i'<10{ local j=`i'-1 replace xha`k'0`i'=4001 if xha`k'0`i'==9999 & xha`k'0`j'==4001 local i=`i'+1 } replace xha`k'10=4001 if xha`k'10==9999 & xha`k'09==4001 local i=11 while `i'<97{ local j=`i'-1 replace xha`k'`i'=4001 if xha`k'`i'==9999 & xha`k'`j'==4001 local i=`i'+1 } local k=`k'+1 } **AV VARIABLES **************** ** AV 1 ** local i=1 while `i'<8{ for num 1/9: gen av1_`i'_X=15 if (xha`i'0X==0 | xha`i'0X==20 | xha`i'0X==40 | xha`i'0X==55 | xha`i'0X==60 | xha`i'0X==70 | xha`i'0X==80 | xha`i'0X==99) for num 10/96: gen av1_`i'_X=15 if (xha`i'X==0 | xha`i'X==20 | xha`i'X==40 | xha`i'X==55 | xha`i'X==60 | xha`i'X==70 | xha`i'X==80 | xha`i'X==99) egen av1_`i'=rsum(av1_`i'_*) drop av1_`i'_* local i=`i'+1 } ** AV 2 ** local i=1 while `i'<8{ for num 1/9: gen av2_`i'_X=15 if (xha`i'0X==10) for num 10/96: gen av2_`i'_X=15 if (xha`i'X==10) egen av2_`i'=rsum(av2_`i'_*) drop av2_`i'_* local i=`i'+1 } ** AV 3 ** local i=1 while `i'<8{ for num 1/9: gen av3_`i'_X=15 if (xha`i'0X==50) for num 10/96: gen av3_`i'_X=15 if (xha`i'X==50) egen av3_`i'=rsum(av3_`i'_*) drop av3_`i'_* local i=`i'+1 } ** AV 4 ** local i=1 while `i'<8{ for num 1/9: gen av4_`i'_X=15 if (xha`i'0X==5000 | xha`i'0X==5010 | xha`i'0X==5020 | xha`i'0X==5021 | xha`i'0X==5030 | xha`i'0X==5041 | xha`i'0X==5050 | xha`i'0X==5060 | xha`i'0X==5070 | xha`i'0X==5075 | xha`i'0X==5099) for num 10/96: gen av4_`i'_X=15 if (xha`i'X==5000 | xha`i'X==5010 | xha`i'X==5020 | xha`i'X==5021 | xha`i'X==5030 | xha`i'X==5041 | xha`i'X==5050 | xha`i'X==5060 | xha`i'X==5070 | xha`i'X==5075 | xha`i'X==5099) egen av4_`i'=rsum(av4_`i'_*) drop av4_`i'_* local i=`i'+1 } ** AV 5 ** local i=1 while `i'<8{ for num 1/9: gen av5_`i'_X=15 if (xha`i'0X==0031 | xha`i'0X==0032 | xha`i'0X==0033 | xha`i'0X==0034 | xha`i'0X==0035 | xha`i'0X==0036 | xha`i'0X==0091 | xha`i'0X==0092 | xha`i'0X==0093 | xha`i'0X==0094 | xha`i'0X==0095 | xha`i'0X==0096 | xha`i'0X==131 | xha`i'0X==134 | xha`i'0X==191 | xha`i'0X==194 | xha`i'0X==5091 | xha`i'0X==5092 | xha`i'0X==5093 | xha`i'0X==5094 | xha`i'0X==5095 | xha`i'0X==5096 | xha`i'0X==5191 | xha`i'0X==5194) for num 10/96: gen av5_`i'_X=15 if (xha`i'X==0031 | xha`i'X==0032 | xha`i'X==0033 | xha`i'X==0034 | xha`i'X==0035 | xha`i'X==0036 | xha`i'X==0091 | xha`i'X==0092 | xha`i'X==0093 | xha`i'X==0094 | xha`i'X==0095 | xha`i'X==0096 | xha`i'X==131 | xha`i'X==134 | xha`i'X==191 | xha`i'X==194 | xha`i'X==5091 | xha`i'X==5092 | xha`i'X==5093 | xha`i'X==5094 | xha`i'X==5095 | xha`i'X==5096 | xha`i'X==5191 | xha`i'X==5194) egen av5_`i'=rsum(av5_`i'_*) drop av5_`i'_* local i=`i'+1 } ** AV 6 ** local i=1 while `i'<8{ for num 1/9: gen av6_`i'_X=15 if (xha`i'0X==1000 | xha`i'0X==1010 | xha`i'0X==1011 | xha`i'0X==1110) for num 10/96: gen av6_`i'_X=15 if (xha`i'X==1000 | xha`i'X==1010 | xha`i'X==1011 | xha`i'X==1110) egen av6_`i'=rsum(av6_`i'_*) drop av6_`i'_* local i=`i'+1 } ** AV 7** local i=1 while `i'<8{ for num 1/9: gen av7_`i'_X=15 if (xha`i'0X==1021 | xha`i'0X==1022 | xha`i'0X==1023 | xha`i'0X==1024 | xha`i'0X==1025 | xha`i'0X==1041 | xha`i'0X==1042 | xha`i'0X==1099) for num 10/96: gen av7_`i'_X=15 if (xha`i'X==1021 | xha`i'X==1022 | xha`i'X==1023 | xha`i'X==1024 | xha`i'X==1025 | xha`i'X==1041 | xha`i'X==1042 | xha`i'X==1099) egen av7_`i'=rsum(av7_`i'_*) drop av7_`i'_* local i=`i'+1 } ** AV 8** local i=1 while `i'<8{ for num 1/9: gen av8_`i'_X=15 if (xha`i'0X==1030 | xha`i'0X==1031 | xha`i'0X==1032 | xha`i'0X==1050 | xha`i'0X==1060 | xha`i'0X==1072 | xha`i'0X==1080 | xha`i'0X==4020 | xha`i'0X==6030 | xha`i'0X==6066 | xha`i'0X==9906 | xha`i'0X==1071) for num 10/96: gen av8_`i'_X=15 if (xha`i'X==1030 | xha`i'X==1031 | xha`i'X==1032 | xha`i'X==1050 | xha`i'X==1060 | xha`i'X==1072 | xha`i'X==1080 | xha`i'X==4020 | xha`i'X==6030 | xha`i'X==6066 | xha`i'X==9906 | xha`i'X==1071) egen av8_`i'=rsum(av8_`i'_*) drop av8_`i'_* local i=`i'+1 } ** AV 9** local i=1 while `i'<8{ for num 1/9: gen av9_`i'_X=15 if (xha`i'0X==1051) for num 10/96: gen av9_`i'_X=15 if (xha`i'X==1051) egen av9_`i'=rsum(av9_`i'_*) drop av9_`i'_* local i=`i'+1 } ** AV 10** local i=1 while `i'<8{ for num 1/9: gen av10_`i'_X=15 if (xha`i'0X==3001 | xha`i'0X==3002 | xha`i'0X==3003 | xha`i'0X==3010 | xha`i'0X==3011 | xha`i'0X==3012 | xha`i'0X==3013 | xha`i'0X==3014 | xha`i'0X==3015 | xha`i'0X==3016 | xha`i'0X==3040 | xha`i'0X==3041 | xha`i'0X==3042 | xha`i'0X==3050 | xha`i'0X==3051 | xha`i'0X==3060 | xha`i'0X==3070 | xha`i'0X==3099) for num 10/96: gen av10_`i'_X=15 if (xha`i'X==3001 | xha`i'X==3002 | xha`i'X==3003 | xha`i'X==3010 | xha`i'X==3011 | xha`i'X==3012 | xha`i'X==3013 | xha`i'X==3014 | xha`i'X==3015 | xha`i'X==3016 | xha`i'X==3040 | xha`i'X==3041 | xha`i'X==3042 | xha`i'X==3050 | xha`i'X==3051 | xha`i'X==3060 | xha`i'X==3070 | xha`i'X==3099) egen av10_`i'=rsum(av10_`i'_*) drop av10_`i'_* local i=`i'+1 } ** AV 11** local i=1 while `i'<8{ for num 1/9: gen av11_`i'_X=15 if (xha`i'0X==2000 | xha`i'0X==2010 | xha`i'0X==2020 | xha`i'0X==2030 | xha`i'0X==2040 | xha`i'0X==2050 | xha`i'0X==2060 | xha`i'0X==2070 | xha`i'0X==2099) for num 10/96: gen av11_`i'_X=15 if (xha`i'X==2000 | xha`i'X==2010 | xha`i'X==2020 | xha`i'X==2030 | xha`i'X==2040 | xha`i'X==2050 | xha`i'X==2060 | xha`i'X==2070 | xha`i'X==2099) egen av11_`i'=rsum(av11_`i'_*) drop av11_`i'_* local i=`i'+1 } ** AV 12** local i=1 while `i'<8{ for num 1/9: gen av12_`i'_X=15 if (xha`i'0X==1091 | xha`i'0X==1092 | xha`i'0X==1093 | xha`i'0X==1094 | xha`i'0X==1095 | xha`i'0X==1096 | xha`i'0X==1191 | xha`i'0X==1194 | xha`i'0X==2091 | xha`i'0X==2092 | xha`i'0X==2093 | xha`i'0X==2094 | xha`i'0X==2095 | xha`i'0X==2096 | xha`i'0X==2191 | xha`i'0X==2194 | xha`i'0X==3091 | xha`i'0X==3092 | xha`i'0X==3093 | xha`i'0X==3094 | xha`i'0X==3095 | xha`i'0X==3096 | xha`i'0X==3140 | xha`i'0X==3191 | xha`i'0X==3194 | xha`i'0X==4091 | xha`i'0X==4092 | xha`i'0X==4093 | xha`i'0X==4094 | xha`i'0X==4095 | xha`i'0X==4096 | xha`i'0X==4191 | xha`i'0X==4194) for num 10/96: gen av12_`i'_X=15 if (xha`i'X==1091 | xha`i'X==1092 | xha`i'X==1093 | xha`i'X==1094 | xha`i'X==1095 | xha`i'X==1096 | xha`i'X==1191 | xha`i'X==1194 | xha`i'X==2091 | xha`i'X==2092 | xha`i'X==2093 | xha`i'X==2094 | xha`i'X==2095 | xha`i'X==2096 | xha`i'X==2191 | xha`i'X==2194 | xha`i'X==3091 | xha`i'X==3092 | xha`i'X==3093 | xha`i'X==3094 | xha`i'X==3095 | xha`i'X==3096 | xha`i'X==3140 | xha`i'X==3191 | xha`i'X==3194 | xha`i'X==4091 | xha`i'X==4092 | xha`i'X==4093 | xha`i'X==4094 | xha`i'X==4095 | xha`i'X==4096 | xha`i'X==4191 | xha`i'X==4194) egen av12_`i'=rsum(av12_`i'_*) drop av12_`i'_* local i=`i'+1 } ** AV 13** local i=1 while `i'<8{ for num 1/9: gen av13_`i'_X=15 if (xha`i'0X==4000 | xha`i'0X==4001 | xha`i'0X==4080 | xha`i'0X==4099) for num 10/96: gen av13_`i'_X=15 if (xha`i'X==4000 | xha`i'X==4001 | xha`i'X==4080 | xha`i'X==4099) egen av13_`i'=rsum(av13_`i'_*) drop av13_`i'_* local i=`i'+1 } ** AV 14** local i=1 while `i'<8{ for num 1/9: gen av14_`i'_X=15 if (xha`i'0X==3020 | xha`i'0X==3030 | xha`i'0X==4010) for num 10/96: gen av14_`i'_X=15 if (xha`i'X==3020 | xha`i'X==3030 | xha`i'X==4010) egen av14_`i'=rsum(av14_`i'_*) drop av14_`i'_* local i=`i'+1 } ** AV 15** local i=1 while `i'<8{ for num 1/9: gen av15_`i'_X=15 if (xha`i'0X==4030) for num 10/96: gen av15_`i'_X=15 if (xha`i'X==4030) egen av15_`i'=rsum(av15_`i'_*) drop av15_`i'_* local i=`i'+1 } ** AV 16** local i=1 while `i'<8{ for num 1/9: gen av16_`i'_X=15 if (xha`i'0X==4050 | xha`i'0X==4060 | xha`i'0X==4070 | xha`i'0X==4710) for num 10/96: gen av16_`i'_X=15 if (xha`i'X==4050 | xha`i'X==4060 | xha`i'X==4070 | xha`i'X==4710) egen av16_`i'=rsum(av16_`i'_*) drop av16_`i'_* local i=`i'+1 } ** AV 17** local i=1 while `i'<8{ for num 1/9: gen av17_`i'_X=15 if (xha`i'0X==6091 | xha`i'0X==6092 | xha`i'0X==6093 | xha`i'0X==6094 | xha`i'0X==6095 | xha`i'0X==6096 | xha`i'0X==6191 | xha`i'0X==6194 | xha`i'0X==7091 | xha`i'0X==7092 | xha`i'0X==7093 | xha`i'0X==7094 | xha`i'0X==7095 | xha`i'0X==7096 | xha`i'0X==7191 | xha`i'0X==7194 | xha`i'0X==8091 | xha`i'0X==8092 | xha`i'0X==8093 | xha`i'0X==8094 | xha`i'0X==8095 | xha`i'0X==8096 | xha`i'0X==8191 | xha`i'0X==8194 | xha`i'0X==7820) for num 10/96: gen av17_`i'_X=15 if (xha`i'X==6091 | xha`i'X==6092 | xha`i'X==6093 | xha`i'X==6094 | xha`i'X==6095 | xha`i'X==6096 | xha`i'X==6191 | xha`i'X==6194 | xha`i'X==7091 | xha`i'X==7092 | xha`i'X==7093 | xha`i'X==7094 | xha`i'X==7095 | xha`i'X==7096 | xha`i'X==7191 | xha`i'X==7194 | xha`i'X==8091 | xha`i'X==8092 | xha`i'X==8093 | xha`i'X==8094 | xha`i'X==8095 | xha`i'X==8096 | xha`i'X==8191 | xha`i'X==8194 | xha`i'X==7820) egen av17_`i'=rsum(av17_`i'_*) drop av17_`i'_* local i=`i'+1 } ** AV 18** local i=1 while `i'<8{ for num 1/9: gen av18_`i'_X=15 if (xha`i'0X==5080 | xha`i'0X==7010 | xha`i'0X==7011 | xha`i'0X==7040 | xha`i'0X==8030 | xha`i'0X==8088 | xha`i'0X==8099) for num 10/96: gen av18_`i'_X=15 if (xha`i'X==5080 | xha`i'X==7010 | xha`i'X==7011 | xha`i'X==7040 | xha`i'X==8030 | xha`i'X==8088 | xha`i'X==8099) egen av18_`i'=rsum(av18_`i'_*) drop av18_`i'_* local i=`i'+1 } ** AV 19** local i=1 while `i'<8{ for num 1/9: gen av19_`i'_X=15 if (xha`i'0X==8000 | xha`i'0X==8010) for num 10/96: gen av19_`i'_X=15 if (xha`i'X==8000 | xha`i'X==8010) egen av19_`i'=rsum(av19_`i'_*) drop av19_`i'_* local i=`i'+1 } ** AV 20 ** local i=1 while `i'<8{ for num 1/9: gen av20_`i'_X=15 if (xha`i'0X==7000) for num 10/96: gen av20_`i'_X=15 if (xha`i'X==7000) egen av20_`i'=rsum(av20_`i'_*) drop av20_`i'_* local i=`i'+1 } ** AV 21 ** local i=1 while `i'<8{ for num 1/9: gen av21_`i'_X=15 if (xha`i'0X==8020) for num 10/96: gen av21_`i'_X=15 if (xha`i'X==8020) egen av21_`i'=rsum(av21_`i'_*) drop av21_`i'_* local i=`i'+1 } ** AV 22 ** local i=1 while `i'<8{ for num 1/9: gen av22_`i'_X=15 if (xha`i'0X==6050) for num 10/96: gen av22_`i'_X=15 if (xha`i'X==6050) egen av22_`i'=rsum(av22_`i'_*) drop av22_`i'_* local i=`i'+1 } ** AV 23 ** local i=1 while `i'<8{ for num 1/9: gen av23_`i'_X=15 if (xha`i'0X==6000 | xha`i'0X==6010 | xha`i'0X==6020 | xha`i'0X==6040 | xha`i'0X==6055 | xha`i'0X==6099 | xha`i'0X==9905) for num 10/96: gen av23_`i'_X=15 if (xha`i'X==6000 | xha`i'X==6010 | xha`i'X==6020 | xha`i'X==6040 | xha`i'X==6055 | xha`i'X==6099 | xha`i'X==9905) egen av23_`i'=rsum(av23_`i'_*) drop av23_`i'_* local i=`i'+1 } ** AV 24 ** local i=1 while `i'<8{ for num 1/9: gen av24_`i'_X=15 if (xha`i'0X==7020 | xha`i'0X==7030) for num 10/96: gen av24_`i'_X=15 if (xha`i'X==7020 | xha`i'X==7030) egen av24_`i'=rsum(av24_`i'_*) drop av24_`i'_* local i=`i'+1 } ** AV 25 ** local i=1 while `i'<8{ for num 1/9: gen av25_`i'_X=15 if (xha`i'0X==7060 | xha`i'0X==7080 | xha`i'0X==7081 | xha`i'0X==7099) for num 10/96: gen av25_`i'_X=15 if (xha`i'X==7060 | xha`i'X==7080 | xha`i'X==7081 | xha`i'X==7099) egen av25_`i'=rsum(av25_`i'_*) drop av25_`i'_* local i=`i'+1 } ** AV 26 ** local i=1 while `i'<8{ for num 1/9: gen av26_`i'_X=15 if (xha`i'0X==7070) for num 10/96: gen av26_`i'_X=15 if (xha`i'X==7070) egen av26_`i'=rsum(av26_`i'_*) drop av26_`i'_* local i=`i'+1 } ** AV 27 ** for num 1/7: gen av27_X=0 ** AV 28 ** local i=1 while `i'<8{ for num 1/9: gen av28_`i'_X=15 if (xha`i'0X==4040) for num 10/96: gen av28_`i'_X=15 if (xha`i'X==4040) egen av28_`i'=rsum(av28_`i'_*) drop av28_`i'_* local i=`i'+1 } ** AV 29 ** local i=1 while `i'<8{ for num 1/9: gen av29_`i'_X=15 if (xha`i'0X==7050) for num 10/96: gen av29_`i'_X=15 if (xha`i'X==7050) egen av29_`i'=rsum(av29_`i'_*) drop av29_`i'_* local i=`i'+1 } ** AV 30 ** local i=1 while `i'<8{ for num 1/9: gen av30_`i'_X=15 if (xha`i'0X==9001 | xha`i'0X==9002 | xha`i'0X==9003 | xha`i'0X==9004 | xha`i'0X==9048 | xha`i'0X==9049) for num 10/96: gen av30_`i'_X=15 if (xha`i'X==9001 | xha`i'X==9002 | xha`i'X==9003 | xha`i'X==9004 | xha`i'X==9048 | xha`i'X==9049) egen av30_`i'=rsum(av30_`i'_*) drop av30_`i'_* local i=`i'+1 } ** AV 31 ** local i=1 while `i'<8{ for num 1/9: gen av31_`i'_X=15 if (xha`i'0X==9101 | xha`i'0X==9102 | xha`i'0X==9103 | xha`i'0X==9104 | xha`i'0X==9105 | xha`i'0X==9106 | xha`i'0X==9148 | xha`i'0X==9149 | xha`i'0X==9150 | xha`i'0X==9151 | xha`i'0X==9152) for num 10/96: gen av31_`i'_X=15 if (xha`i'X==9101 | xha`i'X==9102 | xha`i'X==9103 | xha`i'X==9104 | xha`i'X==9105 | xha`i'X==9106 | xha`i'X==9148 | xha`i'X==9149 | xha`i'X==9150 | xha`i'X==9151 | xha`i'X==9152) egen av31_`i'=rsum(av31_`i'_*) drop av31_`i'_* local i=`i'+1 } ** AV 32 ** local i=1 while `i'<8{ for num 1/9: gen av32_`i'_X=15 if (xha`i'0X==9200) for num 10/96: gen av32_`i'_X=15 if (xha`i'X==9200) egen av32_`i'=rsum(av32_`i'_*) drop av32_`i'_* local i=`i'+1 } ** AV 33 ** local i=1 while `i'<8{ for num 1/9: gen av33_`i'_X=15 if (xha`i'0X==5001 | xha`i'0X==5011 | xha`i'0X==5031) for num 10/96: gen av33_`i'_X=15 if (xha`i'X==5001 | xha`i'X==5011 | xha`i'X==5031) egen av33_`i'=rsum(av33_`i'_*) drop av33_`i'_* local i=`i'+1 } ** AV 34 ** local i=1 while `i'<8{ for num 1/9: gen av34_`i'_X=15 if (xha`i'0X==9300) for num 10/96: gen av34_`i'_X=15 if (xha`i'X==9300) egen av34_`i'=rsum(av34_`i'_*) drop av34_`i'_* local i=`i'+1 } ** AV 35 ** local i=1 while `i'<8{ for num 1/9: gen av35_`i'_X=15 if (xha`i'0X>=9401 & xha`i'0X<=9676) for num 10/96: gen av35_`i'_X=15 if (xha`i'X>=9401 & xha`i'X<=9676) egen av35_`i'=rsum(av35_`i'_*) drop av35_`i'_* local i=`i'+1 } ** AV 36 ** local i=1 while `i'<8{ for num 1/9: gen av36_`i'_X=15 if (xha`i'0X==9910 | xha`i'0X==9998) for num 10/96: gen av36_`i'_X=15 if (xha`i'X==9910 | xha`i'X==9998) egen av36_`i'=rsum(av36_`i'_*) drop av36_`i'_* local i=`i'+1 } ** AV 37 ** local i=1 while `i'<8{ for num 1/9: gen av37_`i'_X=15 if (xha`i'0X==9902 | xha`i'0X==9904) for num 10/96: gen av37_`i'_X=15 if (xha`i'X==9902 | xha`i'X==9904) egen av37_`i'=rsum(av37_`i'_*) drop av37_`i'_* local i=`i'+1 } ** AV 38 ** local i=1 while `i'<8{ for num 1/9: gen av38_`i'_X=15 if (xha`i'0X==7051) for num 10/96: gen av38_`i'_X=15 if (xha`i'X==7051) egen av38_`i'=rsum(av38_`i'_*) drop av38_`i'_* local i=`i'+1 } ** AV 39 ** local i=1 while `i'<8{ for num 1/9: gen av39_`i'_X=15 if (xha`i'0X==8041 | xha`i'0X==8042 | xha`i'0X==8140) for num 10/96: gen av39_`i'_X=15 if (xha`i'X==8041 | xha`i'X==8042 | xha`i'X==8140) egen av39_`i'=rsum(av39_`i'_*) drop av39_`i'_* local i=`i'+1 } ** AV 40 ** local i=1 while `i'<8{ for num 1/9: gen av40_`i'_X=15 if (xha`i'0X==8040 | xha`i'0X==8043 | xha`i'0X==8050 | xha`i'0X==8060 | xha`i'0X==8070 | xha`i'0X==8071 | xha`i'0X==8072 | xha`i'0X==8073 | xha`i'0X==8081 | xha`i'0X==8082 | xha`i'0X==8121 | xha`i'0X==8141 | xha`i'0X==9901 | xha`i'0X==9903 | xha`i'0X==9907) for num 10/96: gen av40_`i'_X=15 if (xha`i'X==8040 | xha`i'X==8043 | xha`i'X==8050 | xha`i'X==8060 | xha`i'X==8070 | xha`i'X==8071 | xha`i'X==8072 | xha`i'X==8073 | xha`i'X==8081 | xha`i'X==8082 | xha`i'X==8121 | xha`i'X==8141 | xha`i'X==9901 | xha`i'X==9903 | xha`i'X==9907) egen av40_`i'=rsum(av40_`i'_*) drop av40_`i'_* local i=`i'+1 } ** AV 41 ** local i=1 while `i'<8{ for num 1/9: gen av41_`i'_X=15 if (xha`i'0X==9999 | xha`i'0X==.) for num 10/96: gen av41_`i'_X=15 if (xha`i'X==9999 | xha`i'X==.) egen av41_`i'=rsum(av41_`i'_*) drop av41_`i'_* local i=`i'+1 } ** VBLE TO CHECK THAT TIME USE IS 1440 MINUTES ** local i=1 while `i'<8{ gen tottime_`i'=av1_`i' +av2_`i' +av3_`i' +av4_`i' +av5_`i' +av6_`i' +av7_`i' +av8_`i' +av9_`i' +av10_`i' +av11_`i' +av12_`i' +av13_`i' +av14_`i' +av15_`i' +av16_`i' +av17_`i' +av18_`i' +av19_`i' +av20_`i' +av21_`i' +av22_`i' +av23_`i' +av24_`i' +av25_`i' +av26_`i' +av27_`i' +av28_`i' +av29_`i' +av30_`i' +av31_`i' +av32_`i' +av33_`i' +av34_`i' +av35_`i' +av36_`i' +av37_`i' +av38_`i' +av39_`i' +av40_`i' +av41_`i' local i=`i'+1 } //**ALL THE OBSERVATIONS HAVE 1,440 MINUTES (ONE DAY) FOR ALL DAYS (7) **/ **WE CREATE THE 69 ACTIVITY CODES ********************************* /* **WE FIRST CREATE A MARKER TO INDICATE THAT THE ACTIVITY HAS BEEN CONSIDERED IN THE IMPUTATION local i=1 while `i'<8{ for num 1/96: generate marker_`i'_X=0 local i=`i'+1 } */ *MAIN 1 ******* local i=1 while `i'<8{ for num 1/9: gen main1_`i'_X=15 if (xha`i'0X==4001) for num 10/96: gen main1_`i'_X=15 if (xha`i'X==4001) egen main1_`i'=rsum(main1_`i'_*) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main1_`i'_X==15 drop main1_`i'_* local i=`i'+1 } *MAIN 2 ******* local i=1 while `i'<8{ for num 1/9: gen main2_`i'_X=15 if (xha`i'0X==4050 | xha`i'0X==4060 | xha`i'0X==4070) for num 10/96: gen main2_`i'_X=15 if (xha`i'X==4050 | xha`i'X==4060 | xha`i'X==4070) egen main2_`i'=rsum(main2_`i'_*) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main2_`i'_X==15 drop main2_`i'_* local i=`i'+1 } *MAIN 3 ******* local i=1 while `i'<8{ for num 1/9: gen main3_`i'_X=15 if (xha`i'0X==4710) for num 10/96: gen main3_`i'_X=15 if (xha`i'X==4710) egen main3_`i'=rsum(main3_`i'_*) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main3_`i'_X==15 drop main3_`i'_* local i=`i'+1 } *MAIN 4 ******* local i=1 while `i'<8{ for num 1/9: gen main4_`i'_X=15 if (xha`i'0X==4000 | xha`i'0X==4080 | xha`i'0X==4010 | xha`i'0X==4099) for num 10/96: gen main4_`i'_X=15 if (xha`i'X==4000 | xha`i'X==4080 | xha`i'X==4010 | xha`i'X==4099) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main4_`i'_X==15 egen main4_`i'=rsum(main4_`i'_*) drop main4_`i'_* local i=`i'+1 } *MAIN 5 ******* local i=1 while `i'<8{ for num 1/9: gen main5_`i'_X=15 if (xha`i'0X==60) for num 10/96: gen main5_`i'_X=15 if (xha`i'X==60) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main5_`i'_X==15 egen main5_`i'=rsum(main5_`i'_*) drop main5_`i'_* local i=`i'+1 } *MAIN 6 ******* local i=1 while `i'<8{ for num 1/9: gen main6_`i'_X=15 if (xha`i'0X==4030) for num 10/96: gen main6_`i'_X=15 if (xha`i'X==4030) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main6_`i'_X==15 egen main6_`i'=rsum(main6_`i'_*) drop main6_`i'_* local i=`i'+1 } *MAIN 7 ******* local i=1 while `i'<8{ for num 1/9: gen main7_`i'_X=15 if (xha`i'0X==0 | xha`i'0X==20 | xha`i'0X==55 | xha`i'0X==99) for num 10/96: gen main7_`i'_X=15 if (xha`i'X==0 | xha`i'X==20 | xha`i'X==55 | xha`i'X==99) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main7_`i'_X==15 egen main7_`i'=rsum(main7_`i'_*) drop main7_`i'_* local i=`i'+1 } *MAIN 8 ******* local i=1 while `i'<8{ for num 1/9: gen main8_`i'_X=15 if (xha`i'0X==10) for num 10/96: gen main8_`i'_X=15 if (xha`i'X==10) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main8_`i'_X==15 egen main8_`i'=rsum(main8_`i'_*) drop main8_`i'_* local i=`i'+1 } *MAIN 9 ******* local i=1 while `i'<8{ for num 1/9: gen main9_`i'_X=15 if (xha`i'0X==50) for num 10/96: gen main9_`i'_X=15 if (xha`i'X==50) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main9_`i'_X==15 egen main9_`i'=rsum(main9_`i'_*) drop main9_`i'_* local i=`i'+1 } *MAIN 10 ******** for num 1/7: gen main10_X=0 *MAIN 11 ******** local i=1 while `i'<8{ for num 1/9: gen main11_`i'_X=15 if (xha`i'0X>=31 & xha`i'0X<=36) | xha`i'0X==131 | xha`i'0X==134 for num 10/96: gen main11_`i'_X=15 if (xha`i'X>=31 & xha`i'X<=36) | xha`i'X==131 | xha`i'X==134 *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main11_`i'_X==15 egen main11_`i'=rsum(main11_`i'_*) drop main11_`i'_* local i=`i'+1 } *MAIN 12 ******** local i=1 while `i'<8{ for num 1/9: gen main12_`i'_X=15 if (xha`i'0X==80) for num 10/96: gen main12_`i'_X=15 if (xha`i'X==80) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main12_`i'_X==15 egen main12_`i'=rsum(main12_`i'_*) drop main12_`i'_* local i=`i'+1 } *MAIN 13 ******** local i=1 while `i'<8{ for num 1/9: gen main13_`i'_X=15 if (xha`i'0X==40 | xha`i'0X==70) for num 10/96: gen main13_`i'_X=15 if (xha`i'X==40 | xha`i'X==70) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main13_`i'_X==15 egen main13_`i'=rsum(main13_`i'_*) drop main13_`i'_* local i=`i'+1 } *MAIN 14 ******** for num 1/7: gen main14_X=0 *MAIN 15 ******** local i=1 while `i'<8{ for num 1/9: gen main15_`i'_X=15 if (xha`i'0X==5000 | xha`i'0X==5099) for num 10/96: gen main15_`i'_X=15 if (xha`i'X==5000 | xha`i'X==5099) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main15_`i'_X==15 egen main15_`i'=rsum(main15_`i'_*) drop main15_`i'_* local i=`i'+1 } *MAIN 16 ******** local i=1 while `i'<8{ for num 1/9: gen main16_`i'_X=15 if (xha`i'0X==5001 | xha`i'0X==5011 | xha`i'0X==5021 | xha`i'0X==5031 | xha`i'0X==5075) for num 10/96: gen main16_`i'_X=15 if (xha`i'X==5001 | xha`i'X==5011 | xha`i'X==5021 | xha`i'X==5031 | xha`i'X==5075) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main16_`i'_X==15 egen main16_`i'=rsum(main16_`i'_*) drop main16_`i'_* local i=`i'+1 } *MAIN 17 ******** local i=1 while `i'<8{ for num 1/9: gen main17_`i'_X=15 if (xha`i'0X==5010 | xha`i'0X==5020 | xha`i'0X==5030 | xha`i'0X==5041 | xha`i'0X==5050 | xha`i'0X==5060 | xha`i'0X==5070) for num 10/96: gen main17_`i'_X=15 if (xha`i'X==5010 | xha`i'X==5020 | xha`i'X==5030 | xha`i'X==5041 | xha`i'X==5050 | xha`i'X==5060 | xha`i'X==5070) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main17_`i'_X==15 egen main17_`i'=rsum(main17_`i'_*) drop main17_`i'_* local i=`i'+1 } *MAIN 18 ******** local i=1 while `i'<8{ for num 1/9: gen main18_`i'_X=15 if (xha`i'0X==1000) for num 10/96: gen main18_`i'_X=15 if (xha`i'X==1000) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main18_`i'_X==15 egen main18_`i'=rsum(main18_`i'_*) drop main18_`i'_* local i=`i'+1 } *MAIN 19 ******** local i=1 while `i'<8{ for num 1/9: gen main19_`i'_X=15 if (xha`i'0X==1010 | xha`i'0X==1011 | xha`i'0X==1110) for num 10/96: gen main19_`i'_X=15 if (xha`i'X==1010 | xha`i'X==1011 | xha`i'X==1110) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main19_`i'_X==15 egen main19_`i'=rsum(main19_`i'_*) drop main19_`i'_* local i=`i'+1 } *MAIN 20 ******** local i=1 while `i'<8{ for num 1/9: gen main20_`i'_X=15 if (xha`i'0X==1021 | xha`i'0X==1022 | xha`i'0X==1023 | xha`i'0X==1024 | xha`i'0X==1025) for num 10/96: gen main20_`i'_X=15 if (xha`i'X==1021 | xha`i'X==1022 | xha`i'X==1023 | xha`i'X==1024 | xha`i'X==1025) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main20_`i'_X==15 egen main20_`i'=rsum(main20_`i'_*) drop main20_`i'_* local i=`i'+1 } *MAIN 21 ******** local i=1 while `i'<8{ for num 1/9: gen main21_`i'_X=15 if (xha`i'0X==1041 | xha`i'0X==1042 | xha`i'0X==1050) for num 10/96: gen main21_`i'_X=15 if (xha`i'X==1041 | xha`i'X==1042 | xha`i'X==1050) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main21_`i'_X==15 egen main21_`i'=rsum(main21_`i'_*) drop main21_`i'_* local i=`i'+1 } *MAIN 22 ******** local i=1 while `i'<8{ for num 1/9: gen main22_`i'_X=15 if (xha`i'0X==1030 | xha`i'0X==1031 | xha`i'0X==1032 | xha`i'0X==1060) for num 10/96: gen main22_`i'_X=15 if (xha`i'X==1030 | xha`i'X==1031 | xha`i'X==1032 | xha`i'X==1060) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main22_`i'_X==15 egen main22_`i'=rsum(main22_`i'_*) drop main22_`i'_* local i=`i'+1 } *MAIN 23 ******** local i=1 while `i'<8{ for num 1/9: gen main23_`i'_X=15 if (xha`i'0X==1080 | xha`i'0X==1099 | xha`i'0X==9906) for num 10/96: gen main23_`i'_X=15 if (xha`i'X==1080 | xha`i'X==1099 | xha`i'X==9906) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main23_`i'_X==15 egen main23_`i'=rsum(main23_`i'_*) drop main23_`i'_* local i=`i'+1 } *MAIN 24 ******** local i=1 while `i'<8{ for num 1/9: gen main24_`i'_X=15 if (xha`i'0X==3001 | xha`i'0X==3002 | xha`i'0X==3003 | xha`i'0X==3010 | xha`i'0X==3011 | xha`i'0X==3012 | xha`i'0X==3013 | xha`i'0X==3014 | xha`i'0X==3015 | xha`i'0X==3016 | xha`i'0X==3099) for num 10/96: gen main24_`i'_X=15 if (xha`i'X==3001 | xha`i'X==3002 | xha`i'X==3003 | xha`i'X==3010 | xha`i'X==3011 | xha`i'X==3012 | xha`i'X==3013 | xha`i'X==3014 | xha`i'X==3015 | xha`i'X==3016 | xha`i'X==3099) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main24_`i'_X==15 egen main24_`i'=rsum(main24_`i'_*) drop main24_`i'_* local i=`i'+1 } *MAIN 25 ******** local i=1 while `i'<8{ for num 1/9: gen main25_`i'_X=15 if (xha`i'0X==3020 | xha`i'0X==3030) for num 10/96: gen main25_`i'_X=15 if (xha`i'X==3020 | xha`i'X==3030) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main25_`i'_X==15 egen main25_`i'=rsum(main25_`i'_*) drop main25_`i'_* local i=`i'+1 } *MAIN 26 ******** local i=1 while `i'<8{ for num 1/9: gen main26_`i'_X=15 if (xha`i'0X==3040 | xha`i'0X==3041 | xha`i'0X==3042 | xha`i'0X==3050 | xha`i'0X==3051 | xha`i'0X==3060 | xha`i'0X==3070) for num 10/96: gen main26_`i'_X=15 if (xha`i'X==3040 | xha`i'X==3041 | xha`i'X==3042 | xha`i'X==3050 | xha`i'X==3051 | xha`i'X==3060 | xha`i'X==3070) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main26_`i'_X==15 egen main26_`i'=rsum(main26_`i'_*) drop main26_`i'_* local i=`i'+1 } *MAIN 27 ******** local i=1 while `i'<8{ for num 1/9: gen main27_`i'_X=15 if (xha`i'0X==1071) for num 10/96: gen main27_`i'_X=15 if (xha`i'X==1071) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main27_`i'_X==15 egen main27_`i'=rsum(main27_`i'_*) drop main27_`i'_* local i=`i'+1 } *MAIN 28 ******** local i=1 while `i'<8{ for num 1/9: gen main28_`i'_X=15 if (xha`i'0X==2000 | xha`i'0X==2010 | xha`i'0X==2060) for num 10/96: gen main28_`i'_X=15 if (xha`i'X==2000 | xha`i'X==2010 | xha`i'X==2060) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main28_`i'_X==15 egen main28_`i'=rsum(main28_`i'_*) drop main28_`i'_* local i=`i'+1 } *MAIN 29 ******** local i=1 while `i'<8{ for num 1/9: gen main29_`i'_X=15 if (xha`i'0X==2020) for num 10/96: gen main29_`i'_X=15 if (xha`i'X==2020) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main29_`i'_X==15 egen main29_`i'=rsum(main29_`i'_*) drop main29_`i'_* local i=`i'+1 } *MAIN 30 ******** local i=1 while `i'<8{ for num 1/9: gen main30_`i'_X=15 if (xha`i'0X==2030 | xha`i'0X==2040 | xha`i'0X==2050) for num 10/96: gen main30_`i'_X=15 if (xha`i'X==2030 | xha`i'X==2040 | xha`i'X==2050) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main30_`i'_X==15 egen main30_`i'=rsum(main30_`i'_*) drop main30_`i'_* local i=`i'+1 } *MAIN 31 ******** local i=1 while `i'<8{ for num 1/9: gen main31_`i'_X=15 if (xha`i'0X==2070 | xha`i'0X==2099) for num 10/96: gen main31_`i'_X=15 if (xha`i'X==2070 | xha`i'X==2099) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main31_`i'_X==15 egen main31_`i'=rsum(main31_`i'_*) drop main31_`i'_* local i=`i'+1 } *MAIN 32 ******** local i=1 while `i'<8{ for num 1/9: gen main32_`i'_X=15 if (xha`i'0X==4020 | xha`i'0X==6030 | xha`i'0X==6066) for num 10/96: gen main32_`i'_X=15 if (xha`i'X==4020 | xha`i'X==6030 | xha`i'X==6066) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main32_`i'_X==15 egen main32_`i'=rsum(main32_`i'_*) drop main32_`i'_* local i=`i'+1 } *MAIN 33 ******** local i=1 while `i'<8{ for num 1/9: gen main33_`i'_X=15 if (xha`i'0X==6000 | xha`i'0X==6010 | xha`i'0X==6020 | xha`i'0X==6055 | xha`i'0X==6099 | xha`i'0X==9905 | xha`i'0X==6040) for num 10/96: gen main33_`i'_X=15 if (xha`i'X==6000 | xha`i'X==6010 | xha`i'X==6020 | xha`i'X==6055 | xha`i'X==6099 | xha`i'X==9905 | xha`i'X==6040) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main33_`i'_X==15 egen main33_`i'=rsum(main33_`i'_*) drop main33_`i'_* local i=`i'+1 } *MAIN 34 ******** local i=1 while `i'<8{ for num 1/9: gen main34_`i'_X=15 if (xha`i'0X==6050) for num 10/96: gen main34_`i'_X=15 if (xha`i'X==6050) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main34_`i'_X==15 egen main34_`i'=rsum(main34_`i'_*) drop main34_`i'_* local i=`i'+1 } *MAIN 35 ******** local i=1 while `i'<8{ for num 1/9: gen main35_`i'_X=15 if (xha`i'0X==7099 | xha`i'0X==8088 | xha`i'0X==8099) for num 10/96: gen main35_`i'_X=15 if (xha`i'X==7099 | xha`i'X==8088 | xha`i'X==8099) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main35_`i'_X==15 egen main35_`i'=rsum(main35_`i'_*) drop main35_`i'_* local i=`i'+1 } *MAIN 36 ******** local i=1 while `i'<8{ for num 1/9: gen main36_`i'_X=15 if (xha`i'0X==7000) for num 10/96: gen main36_`i'_X=15 if (xha`i'X==7000) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main36_`i'_X==15 egen main36_`i'=rsum(main36_`i'_*) drop main36_`i'_* local i=`i'+1 } *MAIN 37 ******** local i=1 while `i'<8{ for num 1/9: gen main37_`i'_X=15 if (xha`i'0X==7020 | xha`i'0X==7030) for num 10/96: gen main37_`i'_X=15 if (xha`i'X==7020 | xha`i'X==7030) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main37_`i'_X==15 egen main37_`i'=rsum(main37_`i'_*) drop main37_`i'_* local i=`i'+1 } *MAIN 38 ******** local i=1 while `i'<8{ for num 1/9: gen main38_`i'_X=15 if (xha`i'0X==7010 | xha`i'0X==7011 | xha`i'0X==7040 | xha`i'0X==8030 | xha`i'0X==5080) for num 10/96: gen main38_`i'_X=15 if (xha`i'X==7010 | xha`i'X==7011 | xha`i'X==7040 | xha`i'X==8030 | xha`i'X==5080) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main38_`i'_X==15 egen main38_`i'=rsum(main38_`i'_*) drop main38_`i'_* local i=`i'+1 } *MAIN 39 ******** local i=1 while `i'<8{ for num 1/9: gen main39_`i'_X=15 if (xha`i'0X==7070 | xha`i'0X==4040) for num 10/96: gen main39_`i'_X=15 if (xha`i'X==7070 | xha`i'X==4040) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main39_`i'_X==15 egen main39_`i'=rsum(main39_`i'_*) drop main39_`i'_* local i=`i'+1 } *MAIN 40 ******** local i=1 while `i'<8{ for num 1/9: gen main40_`i'_X=15 if (xha`i'0X==7060 | xha`i'0X==7080 | xha`i'0X==7081) for num 10/96: gen main40_`i'_X=15 if (xha`i'X==7060 | xha`i'X==7080 | xha`i'X==7081) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main40_`i'_X==15 egen main40_`i'=rsum(main40_`i'_*) drop main40_`i'_* local i=`i'+1 } *MAIN 41 ******** local i=1 while `i'<8{ for num 1/9: gen main41_`i'_X=15 if xha`i'0X==7820 for num 10/96: gen main41_`i'_X=15 if xha`i'X==7820 *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main41_`i'_X==15 egen main41_`i'=rsum(main41_`i'_*) drop main41_`i'_* local i=`i'+1 } *MAIN 42 ******** local i=1 while `i'<8{ for num 1/9: gen main42_`i'_X=15 if (xha`i'0X==8000 | xha`i'0X==8020) for num 10/96: gen main42_`i'_X=15 if (xha`i'X==8000 | xha`i'X==8020) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main42_`i'_X==15 egen main42_`i'=rsum(main42_`i'_*) drop main42_`i'_* local i=`i'+1 } *MAIN 43 ******** for num 1/7: gen main43_X=0 *MAIN 44 ******** for num 1/7: gen main44_X=0 *MAIN 45 ******** local i=1 while `i'<8{ for num 1/9: gen main45_`i'_X=15 if (xha`i'0X==8081) for num 10/96: gen main45_`i'_X=15 if (xha`i'X==8081) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main45_`i'_X==15 egen main45_`i'=rsum(main45_`i'_*) drop main45_`i'_* local i=`i'+1 } *MAIN 46 ******** local i=1 while `i'<8{ for num 1/9: gen main46_`i'_X=15 if (xha`i'0X==1051 | xha`i'0X==8010 | xha`i'0X==1072) for num 10/96: gen main46_`i'_X=15 if (xha`i'X==1051 | xha`i'X==8010 | xha`i'X==1072) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main46_`i'_X==15 egen main46_`i'=rsum(main46_`i'_*) drop main46_`i'_* local i=`i'+1 } *MAIN 47 ******** for num 1/7: gen main47_X=0 *MAIN 48 ******** local i=1 while `i'<8{ for num 1/9: gen main48_`i'_X=15 if (xha`i'0X==7050 | xha`i'0X==7051) for num 10/96: gen main48_`i'_X=15 if (xha`i'X==7050 | xha`i'X==7051) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main48_`i'_X==15 egen main48_`i'=rsum(main48_`i'_*) drop main48_`i'_* local i=`i'+1 } *MAIN 49 ******** local i=1 while `i'<8{ for num 1/9: gen main49_`i'_X=15 if (xha`i'0X==9902 | xha`i'0X==9904) for num 10/96: gen main49_`i'_X=15 if (xha`i'X==9902 | xha`i'X==9904) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main49_`i'_X==15 egen main49_`i'=rsum(main49_`i'_*) drop main49_`i'_* local i=`i'+1 } *MAIN 50 ******** local i=1 while `i'<8{ for num 1/9: gen main50_`i'_X=15 if (xha`i'0X==8070 | xha`i'0X==8071 | xha`i'0X==8072 | xha`i'0X==8073) for num 10/96: gen main50_`i'_X=15 if (xha`i'X==8070 | xha`i'X==8071 | xha`i'X==8072 | xha`i'X==8073) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main50_`i'_X==15 egen main50_`i'=rsum(main50_`i'_*) drop main50_`i'_* local i=`i'+1 } *MAIN 51 ******** local i=1 while `i'<8{ for num 1/9: gen main51_`i'_X=15 if (xha`i'0X==8082 | xha`i'0X==9907 | xha`i'0X==9998) for num 10/96: gen main51_`i'_X=15 if (xha`i'X==8082 | xha`i'X==9907 | xha`i'X==9998) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main51_`i'_X==15 egen main51_`i'=rsum(main51_`i'_*) drop main51_`i'_* local i=`i'+1 } *MAIN 52 ******** local i=1 while `i'<8{ for num 1/9: gen main52_`i'_X=15 if (xha`i'0X==8050 | xha`i'0X==8060) for num 10/96: gen main52_`i'_X=15 if (xha`i'X==8050 | xha`i'X==8060) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main52_`i'_X==15 egen main52_`i'=rsum(main52_`i'_*) drop main52_`i'_* local i=`i'+1 } *MAIN 53 ******** local i=1 while `i'<8{ for num 1/9: gen main53_`i'_X=15 if (xha`i'0X==9903) for num 10/96: gen main53_`i'_X=15 if (xha`i'X==9903) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main53_`i'_X==15 egen main53_`i'=rsum(main53_`i'_*) drop main53_`i'_* local i=`i'+1 } *MAIN 54 ******** local i=1 while `i'<8{ for num 1/9: gen main54_`i'_X=15 if (xha`i'0X==8040 | xha`i'0X==8041 | xha`i'0X==8042 | xha`i'0X==8043 | xha`i'0X==8121 | xha`i'0X==8140 | xha`i'0X==8141) for num 10/96: gen main54_`i'_X=15 if (xha`i'X==8040 | xha`i'X==8041 | xha`i'X==8042 | xha`i'X==8043 | xha`i'X==8121 | xha`i'X==8140 | xha`i'X==8141) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main54_`i'_X==15 egen main54_`i'=rsum(main54_`i'_*) drop main54_`i'_* local i=`i'+1 } *MAIN 55 ******** local i=1 while `i'<8{ for num 1/9: gen main55_`i'_X=15 if (xha`i'0X==9910) for num 10/96: gen main55_`i'_X=15 if (xha`i'X==9910) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main55_`i'_X==15 egen main55_`i'=rsum(main55_`i'_*) drop main55_`i'_* local i=`i'+1 } *MAIN 56 ******** local i=1 while `i'<8{ for num 1/9: gen main56_`i'_X=15 if (xha`i'0X>=9300 & xha`i'0X<=9676) for num 10/96: gen main56_`i'_X=15 if (xha`i'X>=9300 & xha`i'X<=9676) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main56_`i'_X==15 egen main56_`i'=rsum(main56_`i'_*) drop main56_`i'_* local i=`i'+1 } *MAIN 57 ******** local i=1 while `i'<8{ for num 1/9: gen main57_`i'_X=15 if (xha`i'0X==9200) for num 10/96: gen main57_`i'_X=15 if (xha`i'X==9200) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main57_`i'_X==15 egen main57_`i'=rsum(main57_`i'_*) drop main57_`i'_* local i=`i'+1 } *MAIN 58 ******** local i=1 while `i'<8{ for num 1/9: gen main58_`i'_X=15 if (xha`i'0X>=9001 & xha`i'0X<=9049) for num 10/96: gen main58_`i'_X=15 if (xha`i'X>=9001 & xha`i'X<=9049) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main58_`i'_X==15 egen main58_`i'=rsum(main58_`i'_*) drop main58_`i'_* local i=`i'+1 } *MAIN 59 ******** local i=1 while `i'<8{ for num 1/9: gen main59_`i'_X=15 if (xha`i'0X>=9101 & xha`i'0X<=9152) for num 10/96: gen main59_`i'_X=15 if (xha`i'X>=9101 & xha`i'X<=9152) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main59_`i'_X==15 egen main59_`i'=rsum(main59_`i'_*) drop main59_`i'_* local i=`i'+1 } *MAIN 60 ******** for num 1/7: gen main60_X=0 *MAIN 61 ******** local i=1 while `i'<8{ for num 1/9: gen main61_`i'_X=15 if (xha`i'0X==9901) for num 10/96: gen main61_`i'_X=15 if (xha`i'X==9901) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main60_`i'_X==15 egen main61_`i'=rsum(main61_`i'_*) drop main61_`i'_* local i=`i'+1 } *MAIN 62 ******** for num 1/7: gen main62_X=0 *MAIN 63 ******** local i=1 while `i'<8{ for num 1/9: gen main63_`i'_X=15 if (xha`i'0X==91 | xha`i'0X==92 | xha`i'0X==93 | xha`i'0X==94 | xha`i'0X==95 | xha`i'0X==96 | xha`i'0X==191 | xha`i'0X==194) for num 10/96: gen main63_`i'_X=15 if (xha`i'X==91 | xha`i'X==92 | xha`i'X==93 | xha`i'X==94 | xha`i'X==95 | xha`i'X==96 | xha`i'X==191 | xha`i'X==194) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main63_`i'_X==15 egen main63_`i'=rsum(main63_`i'_*) drop main63_`i'_* local i=`i'+1 } *MAIN 64 ******** local i=1 while `i'<8{ for num 1/9: gen main64_`i'_X=15 if (xha`i'0X==5091 | xha`i'0X==5092 | xha`i'0X==5093 | xha`i'0X==5094 | xha`i'0X==5095 | xha`i'0X==5096 | xha`i'0X==5191 | xha`i'0X==5194) for num 10/96: gen main64_`i'_X=15 if (xha`i'X==5091 | xha`i'X==5092 | xha`i'X==5093 | xha`i'X==5094 | xha`i'X==5095 | xha`i'X==5096 | xha`i'X==5191 | xha`i'X==5194) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main64_`i'_X==15 egen main64_`i'=rsum(main64_`i'_*) drop main64_`i'_* local i=`i'+1 } *MAIN 65 ******** local i=1 while `i'<8{ for num 1/9: gen main65_`i'_X=15 if (xha`i'0X==6091 | xha`i'0X==6092 | xha`i'0X==6093 | xha`i'0X==6094 | xha`i'0X==6095 | xha`i'0X==6096 | xha`i'0X==6191 | xha`i'0X==6194) for num 10/96: gen main65_`i'_X=15 if (xha`i'X==6091 | xha`i'X==6092 | xha`i'X==6093 | xha`i'X==6094 | xha`i'X==6095 | xha`i'X==6096 | xha`i'X==6191 | xha`i'X==6194) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main65_`i'_X==15 egen main65_`i'=rsum(main65_`i'_*) drop main65_`i'_* local i=`i'+1 } *MAIN 66 ******** local i=1 while `i'<8{ for num 1/9: gen main66_`i'_X=15 if (xha`i'0X==2091 | xha`i'0X==2092 | xha`i'0X==2093 | xha`i'0X==2094 | xha`i'0X==2095 | xha`i'0X==2096 | xha`i'0X==2191 | xha`i'0X==2194) for num 10/96: gen main66_`i'_X=15 if (xha`i'X==2091 | xha`i'X==2092 | xha`i'X==2093 | xha`i'X==2094 | xha`i'X==2095 | xha`i'X==2096 | xha`i'X==2191 | xha`i'X==2194) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main66_`i'_X==15 egen main66_`i'=rsum(main66_`i'_*) drop main66_`i'_* local i=`i'+1 } *MAIN 67 ******** local i=1 while `i'<8{ for num 1/9: gen main67_`i'_X=15 if (xha`i'0X==1091 | xha`i'0X==1092 | xha`i'0X==1093 | xha`i'0X==1094 | xha`i'0X==1095 | xha`i'0X==1096 | xha`i'0X==1191 | xha`i'0X==1194 | xha`i'0X==3091 | xha`i'0X==3092 | xha`i'0X==3093 | xha`i'0X==3094 | xha`i'0X==3095 | xha`i'0X==3096 | xha`i'0X==3191 | xha`i'0X==3194 | xha`i'0X==4091 | xha`i'0X==4092 | xha`i'0X==4093 | xha`i'0X==4094 | xha`i'0X==4095 | xha`i'0X==4096 | xha`i'0X==4191 | xha`i'0X==4194 | xha`i'0X==3140) for num 10/96: gen main67_`i'_X=15 if (xha`i'X==1091 | xha`i'X==1092 | xha`i'X==1093 | xha`i'X==1094 | xha`i'X==1095 | xha`i'X==1096 | xha`i'X==1191 | xha`i'X==1194 | xha`i'X==3091 | xha`i'X==3092 | xha`i'X==3093 | xha`i'X==3094 | xha`i'X==3095 | xha`i'X==3096 | xha`i'X==3191 | xha`i'X==3194 | xha`i'X==4091 | xha`i'X==4092 | xha`i'X==4093 | xha`i'X==4094 | xha`i'X==4095 | xha`i'X==4096 | xha`i'X==4191 | xha`i'X==4194 | xha`i'X==3140) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main67_`i'_X==15 egen main67_`i'=rsum(main67_`i'_*) drop main67_`i'_* local i=`i'+1 } *MAIN 68 ******** local i=1 while `i'<8{ for num 1/9: gen main68_`i'_X=15 if (xha`i'0X==7091 | xha`i'0X==7092 | xha`i'0X==7093 | xha`i'0X==7094 | xha`i'0X==7095 | xha`i'0X==7096 | xha`i'0X==7191 | xha`i'0X==7194 | xha`i'0X==8091 | xha`i'0X==8092 | xha`i'0X==8093 | xha`i'0X==8094 | xha`i'0X==8095 | xha`i'0X==8096 | xha`i'0X==8191 | xha`i'0X==8194) for num 10/96: gen main68_`i'_X=15 if (xha`i'X==7091 | xha`i'X==7092 | xha`i'X==7093 | xha`i'X==7094 | xha`i'X==7095 | xha`i'X==7096 | xha`i'X==7191 | xha`i'X==7194 | xha`i'X==8091 | xha`i'X==8092 | xha`i'X==8093 | xha`i'X==8094 | xha`i'X==8095 | xha`i'X==8096 | xha`i'X==8191 | xha`i'X==8194) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main68_`i'_X==15 egen main68_`i'=rsum(main68_`i'_*) drop main68_`i'_* local i=`i'+1 } *MAIN 69 ******** local i=1 while `i'<8{ for num 1/9: gen main69_`i'_X=15 if (xha`i'0X==9999) for num 10/96: gen main69_`i'_X=15 if (xha`i'X==9999) *for num 1/96: replace marker_`i'_X=marker_`i'_X+1 if main69_`i'_X==15 egen main69_`i'=rsum(main69_`i'_*) drop main69_`i'_* local i=`i'+1 } /* local i=1 while `i'<8{ for num 1/9: tab xha`i'0X if marker_`i'_X==0 for num 10/96: tab xha`i'X if marker_`i'_X==0 local i=`i'+1 } local i=1 while `i'<8{ for num 1/9: tab xha`i'0X if marker_`i'_X>1 for num 10/96: tab xha`i'X if marker_`i'_X>1 local i=`i'+1 } local i=1 while `i'<8{ for num 1/9: tab xha`i'0X if marker_`i'_X==0 for num 10/96: tab xha`i'X if marker_`i'_X==0 local i=`i'+1 } */ ***CHECK THAT ALL DIARIES SUM 1440 MINUTES ****************************************** local i=1 while `i'<8{ gen check_main`i'=main1_`i'+main2_`i'+main3_`i'+main4_`i'+main5_`i'+main6_`i'+main7_`i'+main8_`i'+main9_`i'+main10_`i'+main11_`i'+main12_`i'+main13_`i'+main14_`i'+main15_`i'+main16_`i'+main17_`i'+main18_`i'+main19_`i'+main20_`i'+main21_`i'+main22_`i'+main23_`i'+main24_`i'+main25_`i'+main26_`i'+main27_`i'+main28_`i'+main29_`i'+main30_`i'+main31_`i'+main32_`i'+main33_`i'+main34_`i'+main35_`i'+main36_`i'+main37_`i'+main38_`i'+main39_`i'+main40_`i'+main41_`i'+main42_`i'+main43_`i'+main44_`i'+main45_`i'+main46_`i'+main47_`i'+main48_`i'+main49_`i'+main50_`i'+main51_`i'+main52_`i'+main53_`i'+main54_`i'+main55_`i'+main56_`i'+main57_`i'+main58_`i'+main59_`i'+main60_`i'+main61_`i'+main62_`i'+main63_`i'+main64_`i'+main65_`i'+main66_`i'+main67_`i'+main68_`i'+main69_`i' local i=`i'+1 } **FINALLY, WE CREATE THE VARIABLE FOR THE TIME SPENT WITH SPOUSE/PARTNER ************************************************************************ **NO INFORMATION ON WHO ELSE WAS PRESENT DURING THE ACTIVITY. generate sppart=-9 *2+ OR MORE OF THESE BASIC ACTIVITIES MISSING: SLEEP OR REST, EATING OR DRINKING, PERSONAL CARE, TRAVEL/EXERCISE **************************************************************************************************************** ** eating_quality ** local i=1 while `i'<8{ for num 1/9: gen eating_quality_`i'_X=15 if (xha`i'0X==060 | xha`i'0X==1000 | xha`i'0X==1010 | xha`i'0X==1011 | xha`i'0X==3001 | xha`i'0X==3003 | xha`i'0X==4030 | xha`i'0X==4040 | xha`i'0X==7060 | xha`i'0X==7070 | xha`i'0X==7080) for num 10/96: gen eating_quality_`i'_X=15 if (xha`i'X==060 | xha`i'X==1000 | xha`i'X==1010 | xha`i'X==1011 | xha`i'X==3001 | xha`i'X==3003 | xha`i'X==4030 | xha`i'X==4040 | xha`i'X==7060 | xha`i'X==7070 | xha`i'X==7080) egen eating_quality_`i'=rsum(eating_quality_`i'_*) drop eating_quality_`i'_* local i=`i'+1 } ** sleeping_quality ** local i=1 while `i'<8{ for num 1/9: gen sleeping_quality_`i'_X=15 if (xha`i'0X==4050 | xha`i'0X==4060 | xha`i'0X==4070 | xha`i'0X==4071 | xha`i'0X==9910) for num 10/96: gen sleeping_quality_`i'_X=15 if (xha`i'X==4050 | xha`i'X==4060 | xha`i'X==4070 | xha`i'X==4071 | xha`i'X==9910) egen sleeping_quality_`i'=rsum(sleeping_quality_`i'_*) drop sleeping_quality_`i'_* local i=`i'+1 } ** personal_quality ** local i=1 while `i'<8{ for num 1/9: gen personal_quality_`i'_X=15 if (xha`i'0X==4000 | xha`i'0X==4080 | xha`i'0X==3020 | xha`i'0X==3030 | xha`i'0X==4001 | xha`i'0X==4010 | xha`i'0X==4099) for num 10/96: gen personal_quality_`i'_X=15 if (xha`i'X==4000 | xha`i'X==4080 | xha`i'X==3020 | xha`i'X==3030 | xha`i'X==4001 | xha`i'X==4010 | xha`i'X==4099) egen personal_quality_`i'=rsum(personal_quality_`i'_*) drop personal_quality_`i'_* local i=`i'+1 } ** travel_quality ** local i=1 while `i'<8{ for num 1/9: gen travel_quality_`i'_X=15 if (xha`i'0X==7011 | xha`i'0X==7040 | xha`i'0X==8030 | xha`i'0X==8000 | xha`i'0X==8010 | xha`i'0X==8020) | (xha`i'0X>=031 & xha`i'0X<=036) | (xha`i'0X>=091 & xha`i'0X<=096) | (xha`i'0X>=1091 & xha`i'0X<=1096) | (xha`i'0X>=291 & xha`i'0X<=2096) | (xha`i'0X>=3091 & xha`i'0X<=3096) | (xha`i'0X>=4091 & xha`i'0X<=4096) | (xha`i'0X>=5091 & xha`i'0X<=5096) | (xha`i'0X>=6091 & xha`i'0X<=6096) | (xha`i'0X>=7091 & xha`i'0X<=7096) | (xha`i'0X>=8091 & xha`i'0X<=8096) | xha`i'0X==131 | xha`i'0X==134 | xha`i'0X==191 | xha`i'0X==194 | xha`i'0X==1191 | xha`i'0X==1194 | xha`i'0X==2191 | xha`i'0X==2194 | xha`i'0X==3191 | xha`i'0X==3194 | xha`i'0X==4191 | xha`i'0X==4194 | xha`i'0X==5191 | xha`i'0X==5194 | xha`i'0X==6191 | xha`i'0X==6194 | xha`i'0X==7191 | xha`i'0X==7194 | xha`i'0X==8191 | xha`i'0X==8194 for num 10/96: gen travel_quality_`i'_X=15 if (xha`i'X==7011 | xha`i'X==7040 | xha`i'X==8030 | xha`i'X==8000 | xha`i'X==8010 | xha`i'X==8020) | (xha`i'X>=031 & xha`i'X<=036) | (xha`i'X>=091 & xha`i'X<=096) | (xha`i'X>=1091 & xha`i'X<=1096) | (xha`i'X>=2091 & xha`i'X<=2096) | (xha`i'X>=3091 & xha`i'X<=3096) | (xha`i'X>=4091 & xha`i'X<=4096) | (xha`i'X>=5091 & xha`i'X<=5096) | (xha`i'X>=6091 & xha`i'X<=6096) | (xha`i'X>=7091 & xha`i'X<=7096) | (xha`i'X>=8091 & xha`i'X<=8096) | xha`i'X==131 | xha`i'X==134 | xha`i'X==191 | xha`i'X==194 | xha`i'X==1191 | xha`i'X==1194 | xha`i'X==2191 | xha`i'X==2194 | xha`i'X==3191 | xha`i'X==3194 | xha`i'X==4191 | xha`i'X==4194 | xha`i'X==5191 | xha`i'X==5194 | xha`i'X==6191 | xha`i'X==6194 | xha`i'X==7191 | xha`i'X==7194 | xha`i'X==8191 | xha`i'X==8194 egen travel_quality_`i'=rsum(travel_quality_`i'_*) drop travel_quality_`i'_* local i=`i'+1 } ** care_quality ** local i=1 while `i'<8{ for num 1/9: gen care_quality_`i'_X=15 if ((xha`i'0X>=2000 & xha`i'0X<=2070) | xha`i'0X==2099 | xha`i'0X==4020 | xha`i'0X==6066) for num 10/96: gen care_quality_`i'_X=15 if ((xha`i'X>=2000 & xha`i'X<=2070) | xha`i'X==2099 | xha`i'X==4020 | xha`i'X==6066) egen care_quality_`i'=rsum(care_quality_`i'_*) drop care_quality_`i'_* local i=`i'+1 } **DIARIES WITH LESS THAN SEVEN EPISODES *************************************** *WE CONSTRUCT A VARIABLE FOR COUNTING THE NUMBER OF TOTAL EPISODES FOR EACH INDIVIDUAL, IN EACH DAY *FINALLY WE IDENTIFY THOSE DIARIES WITH LESS THAN SEVEN EPISODES *WE HAVE DIFFERENTS EPISODES IF THE PRIMARY ACTIVITIES ARE DIFFERENT, SO WE HAVE TO CONSTRUCT SOME INTERMEDIATE VARIABELS TO TAKE INTO ACCOUNT THE PREVIOUS ACTIVITY local i=1 while `i'<8{ local j=1 while `j'<10{ local k=`j'+1 generate lag`i'`k'=xha`i'0`j' local j=`j'+1 } local i=`i'+1 } local i=1 while `i'<8{ local j=10 while `j'<97{ local k=`j'+1 generate lag`i'`k'=xha`i'`j' local j=`j'+1 } local i=`i'+1 } local i=1 while `i'<8{ local j=2 while `j'<10{ generate EPISODE`i'`j'=1 if xha`i'0`j'!=lag`i'`j' replace EPISODE`i'`j'=0 if EPISODE`i'`j'==. local j=`j'+1 } local j=10 while `j'<97{ generate EPISODE`i'`j'=1 if xha`i'`j'!=lag`i'`j' replace EPISODE`i'`j'=0 if EPISODE`i'`j'==. local j=`j'+1 } egen number_episodes_`i'=rsum(EPISODE`i'2 - EPISODE`i'96) replace number_episodes_`i'=number_episodes_`i'+1 local i=`i'+1 } drop EPISODE* lag* **12 EPISODES AND REPORTS ALL DAY AT HOME ***************************************** local i=1 while `i'<8{ for num 1/9: gen at_home_`i'_X=15 if (pl`i'0X==1 | pl`i'0X==2) for num 10/96: gen at_home_`i'_X=15 if (pl`i'X==1 | pl`i'X==2) local i=`i'+1 } local i=1 while `i'<8{ egen at_home_`i'=rsum(at_home_`i'_*) drop at_home_`i'_* local i=`i'+1 } ****************************************************************************************************************************************************************************** ****************************************************************************************************************************************************************************** *************************************************** EXPANSION OF DATASET, TO HAVE SEVEN OBSERVATIONS PER DIARIST *************************************************************** ****************************************************************************************************************************************************************************** ****************************************************************************************************************************************************************************** expand 7 rename resp respnr sort respnr generate day=. replace day=1 if _n==1 local j=1 while `j'<=_N{ local i=`j'-1 replace day=day[`i']+1 if respnr[`i']==respnr[`j'] & _n==`j' replace day=1 if respnr[`i']!=respnr[`j'] & _n==`j' local i=`i'+1 local j=`j'+1 } generate diary=day generate id=day * WE COMPUTE EACH HARMONIXED ACTIVITY TO EACH DAY ** for num 1/41: gen avX=. for num 1/69: gen mainX=. generate eating_quality=. generate sleeping_quality=. generate travel_quality=. generate personal_quality=. generate care_quality=. generate number_episodes=. local i=1 while `i'<8{ local j=1 while `j'<42{ replace av`j'=av`j'_`i' if day==`i' local j=`j'+1 } local j=1 while `j'<70{ replace main`j'=main`j'_`i' if day==`i' local j=`j'+1 } replace eating_quality=eating_quality_`i' if day==`i' replace sleeping_quality=sleeping_quality_`i' if day==`i' replace travel_quality=travel_quality_`i' if day==`i' replace personal_quality=personal_quality_`i' if day==`i' replace care_quality=care_quality_`i' if day==`i' replace number_episodes=number_episodes_`i' if day==`i' local i=`i'+1 } egen tottime=rsum(av1-av41) **THERE ARE 15,428 OBSEVATIONS WITH 1440 MINUTES (2,204*7) gen paidetc =av1+av2+av3+av5 gen hwork=av7 gen cooking=av6 gen eating =av15 gen kidcare=av11 gen shopping=av10 gen dtravel=av12 gen otravel=av17+av18 gen perscare=av13+av16 gen eatout=av28 gen pubclubs=av26+av27 gen spectat=av20+av22+av23+av24+av25 gen asports=av19 gen walking=av21 gen visits=av29+av38 gen tvrad=av30+av31+av32 gen reading=av33+av34+av35 gen chatsetc=av36+av37 gen oddjobs=av8+av9 gen hobbies=av39+av40 gen medical=av14 gen educ=av4 gen tottime_bis=paidetc+hwork +cooking +eating +kidcare+ shopping +dtravel +otravel+ perscare+ eatout+ pubclubs+ spectat+ asports+ walking+ visits+ tvrad+ reading+ chatsetc+ oddjobs+ hobbies +medical +educ +av41 **THERE ARE 15,428 OBSEVATIONS WITH 1440 MINUTES (2,204*7) ** LOW QUALITY DIARIES ** gen badcase=. ** MISSING SEX OR AGE ** generate loss_sex_age=1 if sex<0 | age<0 replace loss_sex_age=0 if loss_sex_age==. **91+ MISSING MINUTES OF ACTIVITY ********************************* generate missing_91=1 if av41>90 replace missing_91=0 if missing_91==. ** DIARIES WITH MISSING DAY ** ****************************** **NO DIARIES WITH MISSING DAYS generate missing_day=0 ** 2+ MISSING BASIC ACTIVITIES ** replace travel_quality=1 if travel_quality>0 replace eating_quality=1 if eating_quality>0 replace sleeping_quality=1 if sleeping_quality>0 replace personal_quality=1 if personal_quality>0 replace care_quality=1 if care_quality>0 generate TOTAL_BASIC_ACTIVITIES=travel_quality+ eating_quality+ sleeping_quality+ personal_quality generate LOSS_ACTIVITIES_INTER=4-TOTAL_BASIC_ACTIVITIES generate loss_basic_activities=1 if LOSS_ACTIVITIES_INTER>=2 replace loss_basic_activities=0 if loss_basic_activities==. **WITH THE FOUR INDICATORS, WE COMPUTE THE "BADCASE" VARIABLE ************************************************************* /* BAD CASE MARKER */ replace badcase=0 if loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes>=7 & loss_basic_activities==0 replace badcase=1 if loss_sex_age==1 & missing_day==0 & missing_91==0 & number_episodes>=7 & loss_basic_activities==0 replace badcase=2 if loss_sex_age==0 & missing_day==1 & missing_91==0 & number_episodes>=7 & loss_basic_activities==0 replace badcase=3 if loss_sex_age==0 & missing_day==0 & missing_91==1 & number_episodes>=7 & loss_basic_activities==0 replace badcase=4 if loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes<7 & loss_basic_activities==0 replace badcase=5 if loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes>=7 & loss_basic_activities==1 replace badcase=6 if loss_sex_age==1 & missing_day==1 & missing_91==0 & number_episodes>=7 & loss_basic_activities==0 replace badcase=7 if loss_sex_age==1 & missing_day==0 & missing_91==1 & number_episodes>=7 & loss_basic_activities==0 replace badcase=8 if loss_sex_age==1 & missing_day==0 & missing_91==0 & number_episodes<7 & loss_basic_activities==0 replace badcase=9 if loss_sex_age==1 & missing_day==0 & missing_91==0 & number_episodes>=7 & loss_basic_activities==1 replace badcase=10 if loss_sex_age==0 & missing_day==1 & missing_91==1 & number_episodes>=7 & loss_basic_activities==0 replace badcase=11 if loss_sex_age==0 & missing_day==1 & missing_91==0 & number_episodes<7 & loss_basic_activities==0 replace badcase=12 if loss_sex_age==0 & missing_day==1 & missing_91==0 & number_episodes>=7 & loss_basic_activities==1 replace badcase=13 if loss_sex_age==0 & missing_day==0 & missing_91==1 & number_episodes<7 & loss_basic_activities==0 replace badcase=14 if loss_sex_age==0 & missing_day==0 & missing_91==1 & number_episodes>=7 & loss_basic_activities==1 replace badcase=15 if loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes<7 & loss_basic_activities==1 replace badcase=16 if loss_sex_age==1 & missing_day==1 & missing_91==1 & number_episodes>=7 & loss_basic_activities==0 replace badcase=17 if loss_sex_age==1 & missing_day==1 & missing_91==0 & number_episodes<7 & loss_basic_activities==0 replace badcase=18 if loss_sex_age==1 & missing_day==1 & missing_91==0 & number_episodes>=7 & loss_basic_activities==1 replace badcase=19 if loss_sex_age==1 & missing_day==0 & missing_91==1 & number_episodes<7 & loss_basic_activities==0 replace badcase=20 if loss_sex_age==1 & missing_day==0 & missing_91==1 & number_episodes>=7 & loss_basic_activities==1 replace badcase=21 if loss_sex_age==1 & missing_day==0 & missing_91==0 & number_episodes<7 & loss_basic_activities==1 replace badcase=22 if loss_sex_age==0 & missing_day==1 & missing_91==1 & number_episodes<7 & loss_basic_activities==0 replace badcase=23 if loss_sex_age==0 & missing_day==1 & missing_91==1 & number_episodes>=7 & loss_basic_activities==1 replace badcase=24 if loss_sex_age==0 & missing_day==1 & missing_91==0 & number_episodes<7 & loss_basic_activities==1 replace badcase=25 if loss_sex_age==0 & missing_day==0 & missing_91==1 & number_episodes<7 & loss_basic_activities==1 replace badcase=26 if loss_sex_age==1 & missing_day==1 & missing_91==1 & number_episodes<7 & loss_basic_activities==0 replace badcase=27 if loss_sex_age==1 & missing_day==1 & missing_91==1 & number_episodes>=7 & loss_basic_activities==1 replace badcase=28 if loss_sex_age==1 & missing_day==1 & missing_91==0 & number_episodes<7 & loss_basic_activities==1 replace badcase=29 if loss_sex_age==1 & missing_day==0 & missing_91==1 & number_episodes<7 & loss_basic_activities==1 replace badcase=30 if loss_sex_age==0 & missing_day==1 & missing_91==1 & number_episodes<7 & loss_basic_activities==1 replace badcase=31 if loss_sex_age==1 & missing_day==1 & missing_91==1 & number_episodes<7 & loss_basic_activities==1 /* WE HAVE THE FOLLOWING DISTRIBUTION OF BAD CASES marker of low quality cases | Freq. Percent Cum. ----------------------------------------+----------------------------------- good case | 18,976 99.30 99.30 <7 episodes only | 22 0.12 99.41 miss 2+ basic acts only | 64 0.33 99.75 <7 ep & miss 2+ basic acts | 48 0.25 100.00 ----------------------------------------+----------------------------------- Total | 19,110 100.00 */ **EXCEPTIONS TO THE MISSING BASIC ACTIVITIES *********************************************** *CARERS ******* **NO INFORMATION ON WHETHER THE PERSON IS A CARER **WE USE THE TIME DEVOTED TO ADULT CARE ACTIVITIES (MAIN32) sort persid by persid: egen sum_adult_care=sum(main32) generate carer=1 if sum_adult_care>0 replace carer=0 if sum_adult_care==0 generate carer_badcase=1 if care_quality>0 replace carer_badcase=1 if carer_badcase==. & carer==1 replace carer_badcase=0 if carer_badcase==. replace badcase=0 if carer_badcase==1 & loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes>=7 & loss_basic_activities==1 replace badcase=0 if carer_badcase==1 & loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes>=7 & loss_basic_activities==1 **BEING AT HOME ALL DAY *********************** gen at_home=. local i=1 while `i'<8{ replace at_home=at_home_`i' if day==`i' local i=`i'+1 } replace badcase=0 if badcase>0 & loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes>=12 & TOTAL_BASIC_ACTIVITIES==2 & travel_quality==0 & at_home>=1000 **15+ EPISODES *************** replace badcase=0 if loss_sex_age==0 & missing_day==0 & missing_91==0 & number_episodes>=15 & TOTAL_BASIC_ACTIVITIES==2 /* We obtain the following distribution of bad diaries: marker of low quality cases | Freq. Percent Cum. ----------------------------------------+----------------------------------- good case | 9,057 98.84 98.84 <7 episodes only | 12 0.13 98.97 miss 2+ basic acts only | 42 0.46 99.43 <7 ep & miss 2+ basic acts | 52 0.57 100.00 ----------------------------------------+----------------------------------- Total | 9,163 100.00 */ ** WEIGHTS ** generate ocombwt=gewakt egen count=count(badcase) egen countp_bis=count(badcase) if badcase==0 egen countp=min(countp_bis) sort sex age day egen daywt=group(sex age day) if badcase==0 egen ngroupsd=max(daywt) if badcase==0 by sex age day: egen daycount2=count(daywt) if badcase==0 sort sex age egen weekwt=group(sex age) if badcase==0 egen ngroupsp=max(weekwt) if badcase==0 by sex age: egen wkcount2=count(weekwt) if badcase==0 generate propwt=((wkcount2/7)/daycount2) replace propwt=0 if badcase!=0 egen mean_weight=mean(propwt) replace propwt=propwt/mean_weight **WE NOW CORRECT SOME VARIABLES replace retired=1 if age>=65 replace retired=0 if age<60 replace empstat=4 if retired==1 | student==1 replace emp=0 if retired==1 ***************************************************************************************************************************************************************************** ***************************************************************************************************************************************************************************** ******************************************************** checks of the 1440 minutes per diary ******************************************************************************* ***************************************************************************************************************************************************************************** ***************************************************************************************************************************************************************************** drop tottime tottime_bis gen tottime=av1+av2+av3+av4+av5+av6 +av7 +av8 +av9 +av10 +av11 +av12 +av13 +av14 +av15 +av16 +av17 +av18 +av19 +av20 +av21 +av22 +av23 +av24 +av25 +av26 +av27 +av28 +av29 +av30 +av31 +av32 +av33 +av34 +av35 +av36 +av37 +av38 +av39 +av40 +av41 gen tottime_bis=main1+main2+main3+main4+main5+main6+main7+main8+main9+main10+main11+main12+main13+main14+main15+main16+main17+main18+main19+main20+main21+main22+main23+main24+main25+main26+main27+main28+main29+main30+main31+main32+main33+main34+main35+main36+main37+main38+main39+main40+main41+main42+main43+main44+main45+main46+main47+main48+main49+main50+main51+main52+main53+main54+main55+main56+main57+main58+main59+main60+main61+main62+main63+main64+main65+main66+main67+main68+main69 **WITH THE TWO VARIABLES (tottime, tottime_bis) ALL DIARIES HAVE 1440 MINUTES OF ACTIVITY **WORKHRS FOR RETIRED, STUDENT AND UNEMPLOYED PEOPLE ***************************************************** gen workhrs_inter=main7 +main8 +main9 +main11 +main12 +main13 sort persid by persid: egen workhrs_bis=sum(workhrs_inter) replace workhrs_bis=workhrs_bis/60 gen workhrs_new=round(workhrs_bis) replace workhrs=workhrs_new if unemp==1 | student==1 | retired==1 replace workhrs=-7 if workhrs==0 & (unemp==1 | student==1 | retired==1) drop workhrs_* replace emp=0 if emp==-8 **REPLACE TIME USE VARIABLES NOT POSIBLE TO CREATE ************************************************** replace av27=-9 for num 10 14 43 44 47 60 62: replace mainX=-9 replace carer=-9 ***************************************************************************************************************************************************************************** ***************************************************************************************************************************************************************************** ************************************************************************* LABELS ******************************************************************************************** ***************************************************************************************************************************************************************************** ***************************************************************************************************************************************************************************** #delimit; lab var countrya "Country or region of survey"; lab def countrya 1 "Argentina" 2 "Austria" 3 "Australia" 4 "Belgium" 5 "Brazil" 6 "Bulgaria" 7 "Canada" 8 "China" 9 "Denmark" 10 "Estonia" 11 "Finland" 12 "France" 13 "Germany" 14 "Hungary" 15 "India" 16 "Ireland" 17 "Israel" 18 "Italy" 19 "Japan" 20 "Latvia" 21 "Lithuania" 22 "Netherlands" 23 "New Zealand" 24 "Norway" 25 "Peru" 26 "Poland" 27 "Portugal" 28 "Republic of Korea" 29 "Romania" 30 "Russia" 31 "Slovak Republic/Czechoslovakia" 32 "Slovenia/Yugoslavia" 33 "South Africa" 34 "Spain" 35 "Sweden" 36 "Turkey" 37 "United Kingdom" 38 "USA" ; lab val countrya countrya ; /*; lab var country "Old MTUS country of survey list"; lab def country 1 "Canada" 2 "Denmark" 3 "France" 4 "Netherlands" 5 "Norway" 6 "UK" 7 "USA" 8 "Hungary" 9 "West Germany - now combined with 9, use MSAMP to distinguish" 10 "Poland" 11 "Belgium" 12 "Bulgaria" 13 "Czech - old code no longer in use, see Slovak Republic" 14 "East Germany - now combined with 9, use MSAMP to distinguish" 15 "Peru" 16 "Yugoslavia - old code no longer in use, see Slovenia" 17 "Finland" 18 "Italy" 19 "Australia" 20 "Israel" 21 "Sweden" 22 "Germany" 23 "Austria" 24 "South Africa" 25 "Brazil" 26 "Estonia" 27 "India" 28 "Japan" 31 "New Zealand" 32 "Portugal" 33 "Romania" 34 "Slovenia" 35 "Spain" 36 "Lituania" 37 "Latvia" 38 "Argentina" 39 "China" 40 "Ireland" 41 "Republic of Korea" 42 "Russia" 43 "Slovak Republic" 44 "Turkey"; lab val country country; */; lab var survey "Year survey began (survey id)"; lab var swave "longitudinal study wave marker"; lab def swave 0 "not longitudinal study/case" 1 "Wave 1" 2 "Wave 2" 3 "Wave 3" 4 "Wave 4" ; lab val swave swave; lab var msamp "multiple samples in study"; lab def msamp 0 "1 sample" 1 "Szalai USA 65 sample" 2 "national USA 65 sample" 3 "original NHAPS" 4 "95 NHAPS supplement" 5 "USA 85 mail back sample" 6 "USA 85 phone interview" 7 "USA 85 personal interview" 8 "Szalai Slovenia" 9 "Szalai Serbia" 10 "West Germany" 11 "East Germany" ; lab val msamp msamp; lab var hldid "Household identifier"; lab def hldid 0 "1 person sampled per household"; lab val hldid hldid; lab var persid "Person/diarist identifier"; lab var id "Diary identifier"; lab var parntid1 "Person id 1st parent of diarist"; lab def parntid1 -9 "counld not be created" -8 "could not identify parent in hh" -7 "diarist does not live with parent"; lab val parntid1 parntid1; lab var parntid2 "Person id 2nd parent of diarist"; lab def parntid2 -9 "counld not be created" -8 "could not identify parent in hh" -7 "diarist does not live with parent"; lab val parntid2 parntid2; lab var partid "Person id of spouse or partner"; lab def partid -9 "counld not be created" -8 "could not identify partner in hh" -7 "diarist does not have partner"; lab val partid partid; lab var day "Day of week diary kept"; lab def day 1 "Sunday" 2 "Monday" 3 "Tuesday" 4 "Wednesday" 5 "Thursday" 6 "Friday" 7 "Saturday" 8 "Whole week average" 9 "Unspecified weekday" 10 "Unspecified weekend day" -8 "missing" -9 "could not be created"; lab val day day; lab var month "Month diary kept"; lab def month 1 "January" 2 "February" 3 "March" 4 "April" 5 "May" 6 "June" 7 "July" 8 "August" 9 "September" 10 "October" 11 "November" 12 "December" -8 "missing" -9 "could not be created"; lab val month month; lab var year "Year diary kept"; lab def year -8 "missing" -9 "could not be created"; lab val year year; lab var diary "Diary order"; lab def diary 1 "1st diary day" 2 "2nd diary day" 3 "3rd diary day" 4 "4th diary day" 5 "5th diary day" 6 "6th diary day" 7 "7th diary day" 8 "Weekly average" -8 "missing" -9 "could not be created"; lab val diary diary; lab var badcase "marker of low quality cases"; lab def badcase 0 "good case" 1 "miss age or sex only" 2 "miss day of week only" 3 "miss 91+ minutes only" 4 "<7 episodes only" 5 "miss 2+ basic acts only" 6 "miss age/sex + day of week" 7 "miss age/sex + 91+ min" 8 "miss age/sex + <7 episodes" 9 "miss age/sex + 2+ basic acts" 10 "miss day of week + 91+ min" 11 "miss day of week + <7 episodes" 12 "miss day of week + 2+ basic acts" 13 "miss 91+ min + <7 episodes" 14 "miss 91+ min + 2+ basic acts" 15 "<7 ep & miss 2+ basic acts" 16 "miss age/sex + day or week + 91+ min" 17 "miss age/sex + day or week + <7 episodes" 18 "miss age/sex + day or week + 2+ basic acts" 19 "miss age/sex + 91+ min + <7 eps" 20 "miss age/sex + 91+ min + 2+ basic acts" 21 "miss age/sex + 2+ basic acts + <7 eps" 22 "miss day or week + 91+ min + <7 eps" 23 "miss day or week + 91+ min + 2+ basic acts" 24 "miss day or week + 2+ basic acts + <7 eps" 25 "miss 91+ min + 2+ basic acts + <7 eps" 26 "miss age/sex + day or week + 91+ min + <7 episodes" 27 "miss age/sex + day or week + 91+ min + 2+ basic acts" 28 "miss age/sex + day or week + <7 episodes + 2+ basic acts" 29 "miss age/sex + 91+ min + <7 episodes + 2+ basic acts" 30 "day or week + 91+ min + <7 episodes + 2+ basic acts" 31 "bad on all five points"; lab val badcase badcase; lab var hhtype "Household type"; lab def hhtype 1 "1 person household" 2 "Married/cohabiting couple alone" 3 "Married/cohabiting couple + others" 4 "Other household types" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val hhtype hhtype; lab var hhldsize "# people in household"; lab def hhldsize -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val hhldsize hhldsize; lab var nchild "# child aged<18 in hhold"; lab def nchild -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val nchild nchild; lab var agekidx "Age youngest child in hhold"; lab def agekidx 1 "age 0-4" 2 "age 5-12" 3 "age 13-17" 4 "adult child" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val agekidx agekidx; lab var agekid2 "Actual age youngest child in hhold"; lab def agekid2 80 "80 or older" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val agekid2 agekid2; lab var incorig "Original household income"; lab def incorig -8 "missing"; lab val incorig incorig; lab var income "Total hhold income grouped"; lab def income 1 "lowest 25%" 2 "middle 50%" 3 "highest 25%" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val incorig incorig; lab var ownhome "owns or rents home"; lab def ownhome 1 "own outright or mortgage" 2 "rents" 3 "other" -8 "missing" -9 "could not be created"; lab val ownhome ownhome; lab var urban "Urban or rural hhold"; lab def urban 1 "urban/suburban" 2 "rural/semi-rural" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val urban urban; lab var computer "hhold has computer/internet access"; lab def computer 0 "no" 1 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val computer computer; lab var vehicle "hhold access to a private vehicle"; lab def vehicle 0 "no" 1 "animal only" 2 "non-motorised vehicle" 3 "1 car/motorcycle" 4 "2+ cars/motocycles" -8 "missing" -9 "could not be created" ; lab val vehicle vehicle; lab var sex "Sex"; lab def sex 1 "Man" 2 "Woman" -8 "missing"; lab val sex sex; lab var age "Age"; lab def age 80 "80 or older" -7 "not asked" -8 "missing"; lab val age age; lab var famstat "Individual level family status"; lab def famstat 0 "Aged 18 to 39 with no coresident children <18" 1 "Aged 18+ living with 1+ coresident children aged <5" 2 "Aged 18+ living with 1+ coresident children 5-17, none <5" 3 "Aged 40+ with no coresident children <18" 4 "Aged <18 and living with parent(s)/guardian(s)" 5 "Aged <18, living arrangement other or unknown" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val famstat famstat; lab var cphome "Unmarried child in parental home"; lab def cphome 0 "no" 1 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val cphome cphome; lab var singpar "diarist a single parent"; lab def singpar 0 "no" 1 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val singpar singpar; lab var relrefp "Relation to hhold ref person"; lab def relrefp 1 "person 1" 2 "spouse/partner" 3 "child" 4 "parent" 5 "sibling" 6 "son/daughter-in-law" 7 "parent-in-law" 8 "brother/sister-in-law" 9 "other relative" 10 "not related" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val relrefp relrefp; lab var civstat "Civic status"; lab def civstat 1 "couple (married/cohabiting/civ partnership)" 2 "not live with a spouse/partner" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val civstat civstat; lab var cohab "diarist cohabiting"; lab def cohab 0 "no, married" 1 "yes, cohabitting" -7 "not in couple" -8 "missing" -9 "could not be created"; lab val cohab cohab; lab var citizen "Diarist is citizen/national of country"; lab def citizen 0 "no, no work or vote right" 1 "no, has work or vote right" 2 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val citizen citizen; lab var empstat "employment status"; lab def empstat 1 "full-time" 2 "part-time" 3 "unknown job hours" 4 "not in paid work" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val empstat empstat; lab var emp "in paid work"; lab def emp 0 "not in paid work" 1 "in paid work" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val emp emp; lab var unemp "Unemployed"; lab def unemp 0 "no" 1 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val unemp unemp; lab var student "Student status"; lab def student 0 "not student" 1 "student" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val student student; lab var retired "Retirement status"; lab def retired 0 "not retired" 1 "retired" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val retired retired; lab var empsp "Emp status spouse/partner"; lab def empsp 1 "full-time" 2 "part-time" 3 "unknown job hours" 4 "not in paid work" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val empsp empsp; lab var empinclm "Orig monthly labour income"; lab def empinclm -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val empinclm empinclm; lab var occup "Occupation"; lab def occup 1 "management" 2 "finance/legal profsnl" 3 "science/engineering profsnl" 4 "civil and social services" 5 "education professional" 6 "medical professional" 7 "other professional" 8 "health/social care support" 9 "clerical or office support" 10 "security and armed forces" 11 "sales and services" 12 "farming or forestry" 13 "construction, assembly" 14 "self-employed non-professional" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val occup occup; lab var sector "Sector of employment"; lab def sector 1 "public sector" 2 "private sector" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val sector sector; lab var educa "Education-original study codes"; lab def educa 6 "doktoraal" 5 "hbo,semi univ" 4 "vhmo,mbo" 3 "ulo,mavo" 2 "lbo" 1 "lo,vglo,lavo"; lab val educa educa; lab var edtry "Harmonised education"; lab def edtry 1 "inc 2ndry or less" 2 "completed secondary" 3 "above 2ndry education" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val edtry edtry; lab var rushed "Whether diarist ususally feels rushed"; lab def rushed 0 "almost never" 1 "sometimes" 2 "often" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val rushed rushed; lab var health "Diarist's general health"; lab def health 0 "poor" 1 "fair" 2 "good" 3 "very good" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val health health; lab var carer "diarist provides adult care"; lab def carer 0 "no" 1 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val carer carer; lab var disab "has disability/l-term hlth cond"; lab def disab 0 "no" 1 "yes" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val disab disab; lab var main1 "imputed personal or household care"; lab var main2 "sleep and naps"; lab var main3 "imputed sleep"; lab var main4 "wash, dress, care for self"; lab var main5 "meals at work or school"; lab var main6 "other meals or snacks"; lab var main7 "paid work-lab var main job (not at home)"; lab var main8 "paid work at home"; lab var main9 "second or other job not at home"; lab var main10 "unpaid work to generate household income"; lab var main11 "travel as a part of work"; lab var main12 "work breaks"; lab var main13 "other time at workplace"; lab var main14 "look for work"; lab var main15 "regular schooling, education"; lab var main16 "homework"; lab var main17 "leisure/other education or training"; lab var main18 "food preparation, cooking"; lab var main19 "set table, wash/put away dishes"; lab var main20 "cleaning"; lab var main21 "laundry, ironing, clothing repair"; lab var main22 "maintain home/vehicle"; lab var main23 "other domestic work"; lab var main24 "purchase goods"; lab var main25 "consume personal care services"; lab var main26 "consume other services"; lab var main27 "pet care (not walk dog)"; lab var main28 "physical, medical child care"; lab var main29 "teach, help with homework"; lab var main30 "read to, talk or play with child"; lab var main31 "supervise, accompany, other child care"; lab var main32 "adult care"; lab var main33 "voluntary, civic, organisational act"; lab var main34 "worship and religion"; lab var main35 "general out-of-home leisure"; lab var main36 "attend sporting event"; lab var main37 "cinema, theatre, opera, concert"; lab var main38 "other public event, venue"; lab var main39 "restaurant, café, bar, pub"; lab var main40 "party, social event, gambling"; lab var main41 "imputed time away from home"; lab var main42 "general sport or exercise"; lab var main43 "walking"; lab var main44 "cycling"; lab var main45 "other outside recreation"; lab var main46 "gardening/pick mushrooms"; lab var main47 "walk dogs"; lab var main48 "receive or visit friends"; lab var main49 "conversation (in person, phone)"; lab var main50 "other in-home social, games"; lab var main51 "general indoor leisure"; lab var main52 "art or music"; lab var main53 "correspondence (not e-lab mail)"; lab var main54 "knit, crafts or hobbies"; lab var main55 "relax, think, do nothing"; lab var main56 "read"; lab var main57 "listen to music etc"; lab var main58 "listen to radio"; lab var main59 "watch TV, video, DVD"; lab var main60 "computer games"; lab var main61 "e-lab mail, surf internet, computing"; lab var main62 "no act but recorded transport mode"; lab var main63 "travel to/from work"; lab var main64 "education travel"; lab var main65 "voluntary/civic/religious travel"; lab var main66 "child/adult care travel"; lab var main67 "shop, person/hhld care travel"; lab var main68 "other travel"; lab var main69 "no recorded activity"; forval i = 2/69{; lab def main`i' -9 "could not be created for study"; }; lab var av1 "paid work"; lab var av2 "paid work at home"; lab var av3 "second job"; lab var av4 "school/classes"; lab var av5 "travel to/from work"; lab var av6 "cook, wash up"; lab var av7 "housework"; lab var av8 "odd jobs"; lab var av9 "gardening"; lab var av10 "shopping"; lab var av11 "childcare"; lab var av12 "domestic travel"; lab var av13 "dress/personal care"; lab var av14 "consume services"; lab var av15 "meals, snacks"; lab var av16 "sleep"; lab var av17 "free time travel"; lab var av18 "excursions"; lab var av19 "active sport"; lab var av20 "passive sport"; lab var av21 "walks"; lab var av22 "religious activity"; lab var av23 "civic activity"; lab var av24 "cinema, theatre"; lab var av25 "dances, parties"; lab var av26 "social club"; lab var av27 "pub"; lab var av28 "restaurant"; lab var av29 "visit friends"; lab var av30 "listen to radio"; lab var av31 "TV, video"; lab var av32 "listen to CDs records"; lab var av33 "study"; lab var av34 "read books"; lab var av35 "read paper/magazine"; lab var av36 "relax"; lab var av37 "conversation"; lab var av38 "entertain friends"; lab var av39 "knit, sew"; lab var av40 "other leisure"; lab var av41 "missing"; forval i = 1/41{; lab def av`i' -9 "could not be created for study"; }; lab var sppart "time with spouse or partner"; lab def sppart -9 "could not be created for study"; lab val sppart sppart; lab var ocombwt "Original weight"; lab var propwt "Proposed weight"; lab var workhrs "Hours paid work last week inc overtime"; lab def workhrs -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val workhrs workhrs; #delimit cr **************************************************** * Stata syntax to order the W5.8 MTUS variables * **************************************************** local i=1 while `i'<8{ for num 1/69: drop mainX_`i' local i=`i'+1 } local i=1 while `i'<8{ for num 1/41: drop avX_`i' local i=`i'+1 } #delimit; keep countrya /*country*/ survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype workhrs hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp empinclm occup sector educa edtry rushed health carer disab main* av* sppart ocombwt propwt respnr ; order countrya /*country*/ survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edtry rushed health carer disab main* av* sppart ocombwt propwt ; #delimit cr compress **Since we should show the creation of all final MTUS versions, we create a intermediate version sort hldid id persid saveold Net1995W_inter.dta, replace **************************************************************************************************************************************************************************** **************************************************************************************************************************************************************************** ******************************************************************* WE NOW SAVE ALL THE DATASETS *************************************************************************** **************************************************************************************************************************************************************************** **************************************************************************************************************************************************************************** clear **W553 ******* use Net1995W_inter.dta, clear keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edtry rushed health carer disab av* ocombwt propwt sort swave msamp hldid persid id saveold Net1995W553.dta, replace **W58 ***** use Net1995W_inter.dta, clear drop respnr drop if age<18 sort swave msamp hldid persid id saveold Net1995W58.dta, replace **W58KID ******** use Net1995W_inter.dta, clear drop respnr drop if age>=18 sort swave msamp hldid persid id saveold Net1995W58kid.dta, replace ******************************* clear erase Net1995W_inter.dta