**************************************************************************************** ********************** Additional variables for MTUS-X ********************************* **************************************************************************************** **************** * SUMMARY FILE * **************** * country* gen country= "HU" * survey* gen survey= 2009 *swave* gen swave=0 * msamp* gen msamp=0 * hldid * gen hldid=-9 * persid* gen persid=AZONOSITO * incorig * gen incorig = JOVSAV * region * gen region = MEGYE *empinclm * gen empinclm = -9 *occupo * gen occupo= FEOR * educat * gen educat = LISKV label define educat /// 1 "never been to school" /// 2 "less then 8 classes of primary school" /// 3 "8 grades of primary school" /// 4 "certificate of vocational qualification" /// 5 "secondary school/ high school leaving qualification, training certificate" /// 6 "Without high school graduation qualification" /// 7 "high school graduate, further education commenced" /// 8 "school system? certificate of higher education qualifications" /// 9 "college degree" /// 10 "university diploma" /// 11 "doctorate (PhD or DLA)" label val educat educat * ethnic * gen ethnic = ALLP label define ethnic /// 1 "Hungarian citizen" /// 2 "(not Hungarian,but) EU citizen" /// 3 "a citizen of another State" label val ethnic ethnic * migrantd * gen migrantd = -9 * migrantm * gen migrantm =-9 * migrantf * gen migrantf=-9 keep country survey swave msamp hldid persid incorig region empinclm occupo /// educa ethnic migrantd migrantm migrantf sort country survey swave msamp hldid persid incorig region empinclm occupo /// educa ethnic migrantd migrantm migrantf ***************** * EPISODIC FILE * ***************** * dropping unnecessary vars from HEF * drop main1 -main69 drop sleep-leisure * country* gen country= "HU" * survey* gen survey= 2009 *swave* gen swave=0 * msamp* gen msamp=0 *id* gen id=1 *core25* gen core25 = main replace core25 = 1 if main ==2 | main==3 replace core25 = 2 if main ==5 | main==6 replace core25 = 3 if main ==1 | main==4 recode core25(7 8 9 10 11 12 13 14 =4) (15 16 17 =5) /// (18 19=6) (20 21 23 = 7) (22=8) (24 25 26=9) (46=10) (27 47=11) (32=12) (28 31=13) (29 30=14) /// (34=15) (33=16) (63 64=17) (62 65 66 67 68=18) (42 43 44=19) (57 58 59=20) (56=21) /// (60 61=22) (35 36 37 38 39 40 41 45=23) (48 49 50 51 52 53 54 55=24) (69=25) label define core25 /// 1 "sleep" /// 2 "eatdrink" /// 3 "selfcare" /// 4 "paid work" /// 5 "educatn" /// 6 "foodprep" /// 7 "cleanetc" /// 8 "maintain" /// 9 "shopserv" /// 10 "garden" /// 11 "petcare" /// 12 "eldcare" /// 13 "pkidcare" /// 14 "ikidcare" /// 15 "religion" /// 16 "volorgwk" /// 17 "commute" /// 18 "travel" /// 19 "sportex" /// 20 "tvradio" /// 21 "read" /// 22 "compint" /// 23 "goout" /// 24 "leisure" /// 25 "missing" label val core25 core25 * eloc * gen eloc = hely recode eloc (110/127=1) (210/215=2) (310/312=3) (313/314=4) (410 518/524= 6) (510/517=5) /// (610/633=5) (710/723=5) (635 816=7) (820/930=8) recode eloc (411/415 525/528 634 636/649 810/815 931 =9) (999=9) * mtrav * gen mtrav=hely recode mtrav (312=5) (823 824 =5) (910=3) (911=4) (912/914=1) (915/924=2) (925/928=1) /// (929 930=2) recode mtrav (122 123 110/117 119 121 210 214/310 313/413 415/513 515/516 518/523 525 527 /// 610/637 710/715 719/723 = -7) (118 120 124/127 211/213 311 414 514 517 524 526 528 638 /// 716/718 810/820 821 822 910/912=-7) (640 641 649 931 999=-8) * inout * gen inout = hely recode inout (110/117 119 121 210 214/310 313/413 415/513 515/516 518/523 525 527 /// 610/637 710/715 719/723 = 1) (118 120 124/127 211/213 311 414 514 517 524 526 528 638 /// 716/718 810/820 821 822 910/912=2) (312 823 824 913/930 =3) recode inout (122 123=1) (640 641 649 931 999=-8) * clockst * gen clockst = -9 * av * gen av = fotev recode av (1101/1107 1115/1122=1) (1201/1259=1) if eloc==1 recode av (1110/1114 =4) (1123/1128=33) recode av (1101/1107 1115/1122=2) (1201/1259=2) if eloc!=1 recode av (1301/1448=3) recode av (1502/1515=8) (1516/1525=8) (1526/1539=6) recode av (1540/1547=7) (1601/1610=10) (1611=6) (1612/1624=10) (1625/1649=14) recode av (1650/1657=14) (1701/1727=11) (1728/1736=8) (1801=5) recode av (1802/1821=12) (1822/1830=12) (1831/1832=7) (2101/2103=16) recode av (2201/2212=13) (2301/2504=15) (2601/2603=13) (3101/3104=27) recode av (3105 3106=29) (3107/3112=40) (3113/3118=25) (3119/3134=40) recode av (3135/3139=22) (3140/3146=23) (3201/3207=34) (3208/3219=33) recode av (3626/3627=40) (3701=36) (3702/3707=40) (3888=41) recode av (1501=8) (3220=33) (3301/3399=31) (3401/3429=30) (3430/3434=40) recode av (3501/3505 3510 3511/3518=40) (3506=9) (3507=8) recode av (3519/3521=24 ) (3522=24) (3523/3525=18) (3526=20) (3527/3529=28) recode av (3531=27) (3532/3533=38) (3601/3603=21) (3604/3625=19) recode av (3435=40) (3508 3509=8) (3530=25) * ict * gen ict=. replace ict=1 if fotev==3430 | fotev==3431 | fotev==3432 | fotev ==3433 | fotev==3434 replace ict=1 if fotev==1649 | fotev==1650 | fotev==1651 | fotev==1652 | fotev==1653 replace ict=1 if fotev==3103 replace ict=1 if fotev==3108 | fotev==3109 | fotev==3110 replace ict=0 if ict!=1 * alone * gen alone= 1 if kivel == . * child * gen child = kivel recode child (20/29=1)(123/129=1) (250/289=1) (12=1) // please beware: I don't know the age of the child! // I created this variable nonethless because the child is likely to be <=18/// // however, I don't have information about that in the documentation // gen grandchild = kivel recode grandchild (40/49=1) (234/249=1) (345/349=1) (456/489=1) (14=1) replace child=1 if grandchild==1 * sppart * gen sppart=kivel recode sppart (10/15=1) (123/189=1) replace sppart=0 if sppart !=1 * oad* gen oad=kivel recode oad (15/19=1) (25/29=1) (35/39=1) (45/119=1) (125/189=1) (235/789=1) replace oad=0 if oad !=1 *ocombwt* gen ocombwt= SZORZO *hldid* gen hldid= -9 * parntid1 * gen parntid1 =-9 *parntid2 * gen parntid2 =-9 *partid * gen partid =-9 * animal * gen animal=1 if fotev==1224 | fotev==1414 | fotev==3507 | fotev==3508 | fotev==3509 replace animal = 0 if animal!=1 ************************************* * background vars for episodic file * ************************************* * merging in background data from core file* merge m:1 AZONOSITO using HU2009_background.dta, keepusing ( year month day /// sex age hhldsize nchild agekidx edcat empstat civstat workhrs) * cday * gen cday=-9 * noweight* gen noweight =-9 *propwt* //MTUS weights// 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 by sex age: egen wkcount2=count(weekwt) if badcase==0 gen propwt=((wkcount2/7)/daycount2) if badcase==0 replace propwt=0 if badcase!=0 replace propwt=propwt*(count/countp) egen mean_weight=mean(propwt) replace propwt=propwt/mean_weight ********************************************** * gen background vars from background file * ********************************************** * agekid2 * gen agekid2=-9 * income * gen income = JOVSAV //JOVSAV is categorical so recode is an approximation of 25%, 50%, 75%) recode income (1 2 3=1) (4 5=2) (6/10=3) * ownnhome* gen ownhome = JOGCIM recode ownhome (3 4 =2) (2 5 6=3) * urban * gen urban = JOGALL recode urban (1 2 3=1) (4=2) * computer * gen computer=. replace computer=1 if HOLPCZI1==2 | HOLPCZI2==2 | HOLPCZI3==2 replace computer=0 if computer==. * vehicle* gen vehicle= 1 if GKOCSI !=0 replace vehicle =0 if GKOCSI==0 * famstat * gen famstat=. replace famstat=0 if (age >=18 & age <=39) & GYER18 ==0 replace famstat=1 if age>=18 & GYER6>=1 replace famstat=2 if age>=18 & (GYER717>=1 & GYER6==0) replace famstat=3 if age>=40 & GYER18==0 replace famstat=4 if age<18 * singpar* gen singpar=-9 * relrefp * gen relrefp =-9 * civstat* replace civstat=-8 if civstat==. * cohab * gen cohab=. replace cohab=0 if (CSAP==2 | CSAP==3) replace cohab=1 if TARS==1 & (CSAP!=2 & CSAP !=3) replace cohab=-8 if cohab==. * isco1 * gen isco1= FEOR destring isco1, replace recode isco1 (110 210 310= 0) (1122/1429 =1) (2112/2910=2) (3111/3910=3) /// (4111/4299=4)(5111/5399=5) (6111/6411=6) (7111/7649=7) (8111/8390=8) (9111/9220=9) (9999=.) recode isco1 (.=-8) *citizen* gen citizen=-9 *whereborn* gen whereborn=-9 * emp* gen emp=1 if empstat==1 | empstat==2 | empstat==3 replace emp=0 if empstat==4 *unemp* gen unemp = 1 if STATUSZ==2 replace unemp=0 if STATUSZ !=2 *student* gen student=1 if STATUSZ==3 replace student=0 if STATUSZ!=3 *retired* gen retired=1 if STATUSZ==4 replace retired =0 if STATUSZ!=4 *empsp* gen empsp=. replace empsp = 3 if TSTATUSZ==1 replace empsp =4 if TSTATUSZ!=1 * sector* gen sector=-9 * rushed* gen rushed=-9 * health* gen health = EUALL recode health (5=0) (3 4 =1) (2=2) (1=3) recode health (.=-8) * carer* gen carer=-9 * disab* gen disab=1 if KORLAT==1 replace disab=-8 if KORLAT!=1 * merging background vars into episodic file * *from core file* merge m:1 AZONOSITO using HU2009_background.dta, keepusing ( year month day /// sex age hhldsize nchild agekidx edcat empstat civstat workhrs) *from background master* merge m:1 AZONOSITO using HU2009_background.dta, keepusing ( agekid2 income /// ownhome urban computer vehicle famstat isco1 cohab emp citizen whereborn unemp /// student retired empsp sector rushed health carer disab) *************************************************************************************************************** *core25* gen core25 = main replace core25 = 1 if main ==2 | main==3 replace core25 = 2 if main ==5 | main==6 replace core25 = 3 if main ==1 | main==4 recode core25(7 8 9 10 11 12 13 14 =4) (15 16 17 =5) /// (18 19=6) (20 21 23 = 7) (22=8) (24 25 26=9) (46=10) (27 47=11) (32=12) (28 31=13) (29 30=14) /// (34=15) (33=16) (63 64=17) (62 65 66 67 68=18) (42 43 44=19) (57 58 59=20) (56=21) /// (60 61=22) (35 36 37 38 39 40 41 45=23) (48 49 50 51 52 53 54 55=24) (69=25) label define core25 /// 1 "sleep" /// 2 "eatdrink" /// 3 "selfcare" /// 4 "paid work" /// 5 "educatn" /// 6 "foodprep" /// 7 "cleanetc" /// 8 "maintain" /// 9 "shopserv" /// 10 "garden" /// 11 "petcare" /// 12 "eldcare" /// 13 "pkidcare" /// 14 "ikidcare" /// 15 "religion" /// 16 "volorgwk" /// 17 "commute" /// 18 "travel" /// 19 "sportex" /// 20 "tvradio" /// 21 "read" /// 22 "compint" /// 23 "goout" /// 24 "leisure" /// 25 "missing" label val core25 core25 *nowght* gen nowght=1 if badcase!=0 recode nowght (.=0) *propwt* 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 by sex age: egen wkcount2=count(weekwt) if badcase==0 gen propwt=((wkcount2/7)/daycount2) if badcase==0 replace propwt=0 if badcase!=0 replace propwt=propwt*(count/countp) egen mean_weight=mean(propwt) replace propwt=propwt/mean_weight * hhtype* gen hhtype=1 if hhldsize==1 replace hhtype=2 if hhldsize==2 & (cohab==1 | civstat==1) & (famstat==0 | famstat==3) replace hhtype=3 if hhldsize>2 & (cohab==1 | civstat==1) & (famstat==1 | famstat==2) replace hhtype=-9 if hhtype==. //I don't have any family matrix to make all types of hh// * clockst* gen clockst1=. replace clockst1= (240+start)/60 gen clockst=int(clockst1) gen clockst2 = (240+start) - (60*clockst) drop clockst1 rename clockst clockst1 recode clockst1 (24=0)(25=1) (26=2) (27=3) tostring clockst1, gen(clockst1_x) tostring clockst2, gen(clockst2_x) replace clockst2_x = "0" + clockst2_x if clockst2_x=="0" replace clockst2_x = "0" + clockst2_x if clockst2_x=="1" replace clockst2_x = "0" + clockst2_x if clockst2_x=="2" replace clockst2_x = "0" + clockst2_x if clockst2_x=="3" replace clockst2_x = "0" + clockst2_x if clockst2_x=="4" replace clockst2_x = "0" + clockst2_x if clockst2_x=="5" replace clockst2_x = "0" + clockst2_x if clockst2_x=="6" replace clockst2_x = "0" + clockst2_x if clockst2_x=="7" replace clockst2_x = "0" + clockst2_x if clockst2_x=="8" replace clockst2_x = "0" + clockst2_x if clockst2_x=="9" gen clockst = clockst1_x + "." + clockst2_x encode clockst, generate(clockst_num) drop clockst rename clockst_num clockst *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 save HU2009_main.dta, replace