******************************************************************* **** BG 2001 MTUS-X from MTUS file ******************************** *************** * survey file * *************** // from background masterfile // * country* gen country= "BG" * survey* gen survey= 2009 *swave* gen swave=0 * msamp* gen msamp=0 * hldid * gen hldid=HID * persid* gen persid=PID * incorig * gen incorig = HHQ9 label define incorig /// 1 "=18 & age <=39) & (agekid2 ==-7 | agekid2 >=18) replace famstat=1 if age>=18 & agekid2 <5 & agekid2 !=-7 replace famstat=2 if age>=18 & agekid2 >=5 & agekid2 <=17 replace famstat=3 if age>=40 & (agekid2 >=18 | agekid2 ==-7) replace famstat=4 if age <18 & (rel_1==2 | rel_2 ==2 | rel_3==2 | rel_4==2 | rel_5==2 /// | rel_6==2 | rel_7==2 | rel_8==2 | rel_9==2) replace famstat = 5 if age <18 & famstat==. /*0 Adult aged 18 to 39 with no co-resident children <18 1 Adult 18+ living with 1+ co-resident children aged <5 2 Adult 18+ living with 1+ co-resident children 5-17, none <5 3 Adult aged 40+ with no co-resident children <18 4 Respondent aged <18 and living with parent(s)/guardian(s) 5 Respondent aged <18, living arrangement other or unknown */ *emp* gen emp= 1 if IND6==1 | IND6==2 | IND6==3 replace emp=0 if IND6==. *unemp* gen unemp= 1 if IND17==2 replace unemp=0 if unemp==. *student* gen student =1 if IND17==3 replace student=0 if student==. *retired* gen retired = 1 if IND17==4 replace retired = 0 if retired==. *empsp* gen empsp = 3 if (IND33==1 | IND33==2 | IND33==3) replace empsp = -7 if civstat==2 replace empsp = 0 if IND33==. & civstat==1 *isco1* gen isco1= IND5 replace isco1 = -8 if IND5==. *sector* gen sector =-9 *rushed* gen rushed= 0 if IND26 ==3 replace rushed = 1 if IND26 ==2 replace rushed = 2 if IND26 ==1 replace rushed=-8 if rushed==. *health* gen health=0 if (IND23 ==4 | IND23==5) replace health=1 if IND23==3 replace health=2 if IND23==2 replace health=3 if IND23==1 replace health=-8 if health==. *carer* gen carer=-9 *disab* gen disab= 1 if IND24 ==1 replace disab = 0 if IND24==2 replace disab = -8 if disab==. *ocombwt* gen ocombwt = WGHT2 ********************************************** * merging background data into episodic file * ********************************************** merge m:1 HID PID day using BG2001_background_masterfile.dta keep if _merge==3 *deleting redundant vars* keep country survey swave msamp hldid persid id day cday month year diary nowght /// time clockst start end epnum main core25 sec av inout eloc ict mtrav alone child sppart oad /// animal parntid1 parntid2 partid hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer /// vehicle sex age famstat singpar relrefp civstat cohab citizen whereborn empstat emp unemp student retired empsp /// workhrs isco1 sector edcat rushed health carer disab ocombwt propwt order country survey swave msamp hldid persid id day cday month year diary nowght /// time clockst start end epnum main core25 sec av inout eloc ict mtrav alone child sppart oad /// animal parntid1 parntid2 partid hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer /// vehicle sex age famstat singpar relrefp civstat cohab citizen whereborn empstat emp unemp student retired empsp /// workhrs isco1 sector edcat rushed health carer disab ocombwt propwt