** Syntax to create the MTUS World 5.3, 5.8 and 6 files for Basque Country (Spain) 2003. ** Cleaning the workspace and extending the size of the memory clear clear matrix set more off set mem 600m set maxvar 15000 use "/Users/LK/Documents/Time Use/TUSPB_2003.dta", clear compress * Activity code 910 occurs in the data but is not contained in the coding manual, therefore, it is treated * as a coding mistake. These missing activity codes are recoded as 921 or 922 depending on where they occur. for num 1/76: replace actp3X=921 if actp3X==910 for num 1/76: replace actp3X=922 if actp3X==910 & lugar2X!=11 & lugar2X!=12 & lugar2X!=13 & lugar2X!=14 /// & lugar2X!=15 & lugar2X!=16 & lugar2X!=17 & lugar2X!=18 ********************* ** TIME USE VARIABLES ********************* /* WE FIRST NEED TO CHECK WHERE THE ACTIVITY 525 (gifts exchange) TAKES PLACE IN ORDER TO CLASSIFY IT INTO ONE OF THE AVs: AV29, AV38 or AV40. WE NEED TO KNOW IF IT IS TAKEN PLACE AT HOME (AV38), AT RELATIVE'S OR NEIGHBOUR'S (AV29)OR AT OTHER PLACE (AV40). THE FOLLOWING VARIABLES ARE GENERATED FIRST TO GET OUR AIM. First, we use the variable "lugar2" that indicates the place where the activity is done to generate a category variable (place) to summarize if the activity is taken place at home, at relative's or neighbour's, at other places. Second we joint this information with the activitity we are interested in (525) to generate a new variable "giftsX" that we will use later to classify this activity into AV29, AV38 or AV40*/ for num 1/76: gen placeX=1 if (lugar2X>=11 & lugar2X<=18) | lugar2X==31 /*gifts exchange realized at home*/ for num 1/76: replace placeX =2 if lugar2X==19 /* at neighbour's or relative's*/ for num 1/76: replace placeX =3 if lugar2X>=20 & lugar2X<=91 /* other places */ for num 1/76: gen giftsX=38 if actp3X==525 & placeX==1 for num 1/76: replace giftsX=29 if actp3X==525 & placeX==2 for num 1/76: replace giftsX=40 if actp3X==525 & placeX==3 for num 1/76: generate marker_X=0 if actp3X!=. /* ERROR CORRECT OF ACTIVITY CODE 912 There are 3 observations of activity code 912, which does not exist in the original coding manual. 912 which occurs at home is recoded to 921 and 912 which occurs somewhere else is recoded as 922. */ for num 1/76: replace actp3X=921 if actp3X==912 & ((lugar2X>=11 & lugar2X<=18) | lugar2X==31) for num 1/76: replace actp3X=922 if actp3X==912 & lugar2X!=11 & lugar2X!=12 & lugar2X!=13 & lugar2X!=14 & lugar2X!=15 & /// lugar2X!=16 & lugar2X!=17 & lugar2X!=18 & lugar2X!=31 ** AV ACTIVITIES ** AV1: PAID WORK for num 1/76: gen av1X_inter=0 for num 1/76: replace av1X_inter=1 if actp3X==211 | actp3X==214 | actp3X==231 | actp3X==232 | actp3X==241 | actp3X==246 for num 1/76: generate av1X=av1X_inter*duramX egen av1=rsum(av11 - av176) for num 1/76: replace marker_X=marker_X+1 if av1X_inter==1 drop av11 - av176 av11_inter-av176_inter ** AV2: PAID WORK AT HOME for num 1/76: gen av2X_inter=0 for num 1/76: replace av2X_inter=1 if actp3X==212 | actp3X==363 | actp3X==364 for num 1/76: generate av2X=av2X_inter*duramX egen av2=rsum(av21 - av276) for num 1/76: replace marker_X=marker_X+1 if av2X_inter==1 drop av21 - av276 av21_inter-av276_inter ** AV3: PAID WORK, SECOND JOB for num 1/76: gen av3X_inter=0 for num 1/76: replace av3X_inter=1 if actp3X==221 | actp3X==224 | actp3X==225 | actp3X==247 for num 1/76: generate av3X=av3X_inter*duramX egen av3=rsum(av31 - av376) for num 1/76: replace marker_X=marker_X+1 if av3X_inter==1 drop av31 - av376 av31_inter-av376_inter ** AV4: SCHOOL/CLASSES for num 1/76: gen av4X_inter=0 for num 1/76: replace av4X_inter=1 if actp3X==242 | actp3X==245 |actp3X==251 | actp3X==253 | actp3X==254 | actp3X==262 | actp3X==263 | /// actp3X==264 | actp3X==265 | actp3X==266 | actp3X==267 | actp3X==269 for num 1/76: generate av4X=av4X_inter*duramX egen av4=rsum(av41 - av476) for num 1/76: replace marker_X=marker_X+1 if av4X_inter==1 drop av41 - av476 av41_inter-av476_inter ** AV5: TRAVEL TO/FROM WORK for num 1/76: gen av5X_inter=0 for num 1/76: replace av5X_inter=1 if actp3X==213 | actp3X==223 | actp3X==841 | /// (((actp3X>=811 & actp3X<=819) & (finalX==1 | finalX==2)) & finalX!=.) forval i= 1/76 { replace av5`i'_inter=1 if ((actp3`i'>=811 & actp3`i'<=819) & /// (lugar2`i'==21 | actp3`i'==211 | actp3`i'==214 | actp3`i'==231 | actp3`i'==232 | actp3`i'==241 | actp3`i'==246)) } forval i= 1/75 { local j=`i'+1 replace av5`i'_inter=1 if (actp3`i'>=811 & actp3`i'<=819) & /// (lugar2`j'==21 | actp3`j'==211 | actp3`j'==214 | actp3`j'==231 | actp3`j'==232 | actp3`j'==241 | actp3`j'==246) } forval i= 2/76 { local h=`i'-1 replace av5`i'_inter=1 if (actp3`i'>=811 & actp3`i'<=819) & /// (lugar2`h'==21 | actp3`h'==211 | actp3`h'==214 | actp3`h'==231 | actp3`h'==232 | actp3`h'==241 | actp3`h'==246) } for num 1/76: generate av5X=av5X_inter*duramX egen av5=rsum(av51 - av576) for num 1/76: replace marker_X=marker_X+1 if av5X_inter==1 drop av51 - av576 av51_inter-av576_inter ** AV6: COOK/WASH UP for num 1/76: gen av6X_inter=0 for num 1/76: replace av6X_inter=1 if actp3X>=311 & actp3X<=317 for num 1/76: generate av6X=av6X_inter*duramX egen av6=rsum(av61 - av676) for num 1/76: replace marker_X=marker_X+1 if av6X_inter==1. drop av61 - av676 av61_inter-av676_inter ** AV7: HOUSEWORK for num 1/76: gen av7X_inter=0 for num 1/76: replace av7X_inter=1 if actp3X==321 | actp3X==322 | actp3X==323 | actp3X==324 | actp3X==331 | actp3X==332 | actp3X==334 | /// actp3X==341 | actp3X==345 for num 1/76: generate av7X=av7X_inter*duramX egen av7=rsum(av71 - av776) for num 1/76: replace marker_X=marker_X+1 if av7X_inter==1 drop av71 - av776 av71_inter-av776_inter ** AV8: OTHER DOMESTIC WORK for num 1/76: gen av8X_inter=0 for num 1/76: replace av8X_inter=1 if actp3X==333 | actp3X==342 | actp3X==343 | actp3X==344 | actp3X==346 | actp3X==347 | actp3X==348 | /// actp3X==349 | actp3X==372 | actp3X==373 | actp3X==374 | actp3X==375 | actp3X==376 | actp3X==378 | actp3X==431 | actp3X==432 | /// actp3X==433 | actp3X==571 | actp3X==572 | actp3X==573 | actp3X==574 | actp3X==575 | actp3X==576 | actp3X==578 | actp3X==579 | /// actp3X==636 | actp3X==639 | actp3X==644 for num 1/76: generate av8X=av8X_inter*duramX egen av8=rsum(av81 - av876) for num 1/76: replace marker_X=marker_X+1 if av8X_inter==1 drop av81 - av876 av81_inter-av876_inter ** AV9: GARDENING for num 1/76: gen av9X_inter=0 for num 1/76: replace av9X_inter=1 if actp3X==377 | actp3X==627 for num 1/76: generate av9X=av9X_inter*duramX egen av9=rsum(av91 - av976) for num 1/76: replace marker_X=marker_X+1 if av9X_inter==1 drop av91 - av976 av91_inter-av976_inter ** AV10: SHOPPING for num 1/76: gen av10X_inter=0 for num 1/76: replace av10X_inter=1 if (actp3X>=351 & actp3X<=359) | actp3X==361 | actp3X==362 | actp3X==645 | actp3X==647 for num 1/76: generate av10X=av10X_inter*duramX egen av10=rsum(av101 - av1076) for num 1/76: replace marker_X=marker_X+1 if av10X_inter==1 drop av101 - av1076 av101_inter-av1076_inter ** AV11: CHILDCARE for num 1/76: gen av11X_inter=0 for num 1/76: replace av11X_inter=1 if actp3X==411 | actp3X==412 | actp3X==413 | actp3X==414 | actp3X==415 | actp3X==416 | actp3X==421 | /// actp3X==422 | actp3X==423 | actp3X==424 | actp3X==425 | actp3X==577 for num 1/76: generate av11X=av11X_inter*duramX egen av11=rsum(av111 - av1176) for num 1/76: replace marker_X=marker_X+1 if av11X_inter==1 drop av111 - av1176 av111_inter-av1176_inter ** AV12: DOMESTIC TRAVEL for num 1/76: gen av12X_inter=0 forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace av12`i'_inter=1 if (actp3`i'>=811 & actp3`i'<=819) /// & (lugar2`i'!=21 & actp3`i'!=211 & actp3`i'!=214 & actp3`i'!=231 & actp3`i'!=232 & actp3`i'!=241 & actp3`i'!=246 /// & lugar2`j'!=21 & actp3`j'!=211 & actp3`j'!=214 & actp3`j'!=231 & actp3`j'!=232 & actp3`j'!=241 & actp3`j'!=246 /// & lugar2`h'!=21 & actp3`h'!=211 & actp3`h'!=214 & actp3`h'!=231 & actp3`h'!=232 & actp3`h'!=241 & actp3`h'!=246 /// & (final`i'>=3 & final`i'<=6)) } replace av121_inter=1 if (actp31>=811 & actp31<=819) /// & (lugar21!=21 & actp31!=211 & actp31!=214 & actp31!=231 & actp31!=232 & actp31!=241 & actp31!=246 & (final1>=3 & final1<=6)) replace av1276_inter=1 if (actp376>=811 & actp376<=819) /// & (lugar276!=21 & actp376!=211 & actp376!=214 & actp376!=231 & actp376!=232 & actp376!=241 & actp376!=246 & (final76>=3 & final76<=6)) for num 1/76: generate av12X=av12X_inter*duramX egen av12=rsum(av121 - av1276) for num 1/76: replace marker_X=marker_X+1 if av12X_inter==1 drop av121 - av1276 av121_inter-av1276_inter ** AV13: DRESS/PERSONAL CARE for num 1/76: gen av13X_inter=0 for num 1/76: replace av13X_inter=1 if actp3X==121 | actp3X==122 | actp3X==171 | actp3X==172 for num 1/76: generate av13X=av13X_inter*duramX egen av13=rsum(av131 - av1376) for num 1/76: replace marker_X=marker_X+1 if av13X_inter==1 drop av131 - av1376 av131_inter-av1376_inter ** AV14: CONSUME PERSONAL SERVICES for num 1/76: gen av14X_inter=0 for num 1/76: replace av14X_inter=1 if actp3X==123 | actp3X==124 | actp3X==125 | actp3X==131 | actp3X==132 | actp3X==133 | actp3X==134 for num 1/76: generate av14X=av14X_inter*duramX egen av14=rsum(av141 - av1476) for num 1/76: replace marker_X=marker_X+1 if av14X_inter==1 drop av141 - av1476 av141_inter-av1476_inter ** AV15: MEALS/SNACKS for num 1/76: gen av15X_inter=0 for num 1/76: replace av15X_inter=1 if (actp3X>=141 & actp3X<=149) & lugar2X!=81 for num 1/76: generate av15X=av15X_inter*duramX egen av15=rsum(av151 - av1576) for num 1/76: replace marker_X=marker_X+1 if av15X_inter==1 drop av151 - av1576 av151_inter-av1576_inter *AV16: SLEEP for num 1/76: gen av16X_inter=0 for num 1/76: replace av16X_inter=1 if actp3X==111 | actp3X==112 | actp3X==113 | actp3X==114 for num 1/76: generate av16X=av16X_inter*duramX egen av16=rsum(av161 - av1676) for num 1/76: replace marker_X=marker_X+1 if av16X_inter==1 drop av161 - av1676 av161_inter-av1676_inter *AV17: FREE TIME TRAVEL for num 1/76: gen av17X_inter=0 forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace av17`i'_inter=1 if actp3`i'==621 | actp3`i'==842 | actp3`i'==843 | ((actp3`i'>=811 & actp3`i'<=819) /// & (lugar2`i'!=21 & actp3`i'!=211 & actp3`i'!=214 & actp3`i'!=231 & actp3`i'!=232 & actp3`i'!=241 & actp3`i'!=246 /// & lugar2`j'!=21 & actp3`j'!=211 & actp3`j'!=214 & actp3`j'!=231 & actp3`j'!=232 & actp3`j'!=241 & actp3`j'!=246 /// & lugar2`h'!=21 & actp3`h'!=211 & actp3`h'!=214 & actp3`h'!=231 & actp3`h'!=232 & actp3`h'!=241 & actp3`h'!=246 /// & final`i'!=1 & final`i'!=2 & final`i'!=3 & final`i'!=4 & final`i'!=5 & final`i'!=6)) } replace av171_inter=1 if actp31==621 | actp31==842 | actp31==843 | ((actp31>=811 & actp31<=819) /// & (lugar21!=21 & actp31!=211 & actp31!=214 & actp31!=231 & actp31!=232 & actp31!=241 & actp31!=246 /// & final1!=1 & final1!=2 & final1!=3 & final1!=4 & final1!=5 & final1!=6)) replace av1776_inter=1 if actp376==621 | actp376==842 | actp376==843 | ((actp376>=811 & actp376<=819) /// & (lugar276!=21 & actp376!=211 & actp376!=214 & actp376!=231 & actp376!=232 & actp376!=241 & actp376!=246 /// & final76!=1 & final76!=2 & final76!=3 & final76!=4 & final76!=5 & final76!=6)) for num 1/76: generate av17X=av17X_inter*duramX egen av17=rsum(av171 - av1776) for num 1/76: replace marker_X=marker_X+1 if av17X_inter==1 drop av171 - av1776 av171_inter-av1776_inter *AV18: EXCURSIONS for num 1/76: gen av18X_inter=0 for num 1/76: replace av18X_inter=1 if actp3X==622 | actp3X==623 | actp3X==735 | actp3X==738 for num 1/76: generate av18X=av18X_inter*duramX egen av18=rsum(av181 - av1876) for num 1/76: replace marker_X=marker_X+1 if av18X_inter==1. drop av181 - av1876 av181_inter-av1876_inter *AV19: ACTIVE SPORTS PARTICIPATION for num 1/76: gen av19X_inter=0 for num 1/76: replace av19X_inter=1 if actp3X==611 | actp3X==612 | actp3X==613 | actp3X==614 | actp3X==615 | actp3X==626 | actp3X==752 for num 1/76: generate av19X=av19X_inter*duramX egen av19=rsum(av191 - av1976) for num 1/76: replace marker_X=marker_X+1 if av19X_inter==1 drop av191 - av1976 av191_inter-av1976_inter *AV20: PASSIVE SPORTS PARTICIPATION for num 1/76: gen av20X_inter=0 for num 1/76: replace av20X_inter=1 if actp3X==731 for num 1/76: generate av20X=av20X_inter*duramX egen av20=rsum(av201 - av2076) for num 1/76: replace marker_X=marker_X+1 if av20X_inter==1 drop av201 - av2076 av201_inter-av2076_inter *AV21: WALKING for num 1/76: gen av21X_inter=0 for num 1/76: replace av21X_inter=1 if actp3X==624 for num 1/76: generate av21X=av21X_inter*duramX egen av21=rsum(av211 - av2176) for num 1/76: replace marker_X=marker_X+1 if av21X_inter==1 drop av211 - av2176 av211_inter-av2176_inter *AV22: RELIGIOUS ACTIVITIES for num 1/76: gen av22X_inter=0 for num 1/76: replace av22X_inter=1 if actp3X==531 | actp3X==532 | actp3X==533 | actp3X==534 for num 1/76: generate av22X=av22X_inter*duramX egen av22=rsum(av221 - av2276) for num 1/76: replace marker_X=marker_X+1 if av22X_inter==1 drop av221 - av2276 av221_inter-av2276_inter *AV23: CIVIC ACTIVITIES for num 1/76: gen av23X_inter=0 for num 1/76: replace av23X_inter=1 if actp3X==541 | actp3X==543 | actp3X==544 | actp3X==545 | actp3X==549 | /// (actp3X>=551 & actp3X<=559) | (actp3X>=561 & actp3X<=569) | actp3X==911 for num 1/76: generate av23X=av23X_inter*duramX egen av23=rsum(av231 - av2376) for num 1/76: replace marker_X=marker_X+1 if av23X_inter==1 drop av231 - av2376 av231_inter-av2376_inter *AV24: CINEMA OR THEATRE for num 1/76: gen av24X_inter=0 for num 1/76: replace av24X_inter=1 if actp3X==732 | actp3X==733 | actp3X==734 | actp3X==736 | actp3X==737 | actp3X==739 for num 1/76: generate av24X=av24X_inter*duramX egen av24=rsum(av241 - av2476) for num 1/76: replace marker_X=marker_X+1 if av24X_inter==1 drop av241 - av2476 av241_inter-av2476_inter *AV25: DANCES OR PARTIES for num 1/76: gen av25X_inter=0 for num 1/76: replace av25X_inter=1 if actp3X==261 | actp3X==513 | actp3X==514 | actp3X==515 | actp3X==546 for num 1/76: generate av25X=av25X_inter*duramX egen av25=rsum(av251 - av2576) for num 1/76: replace marker_X=marker_X+1 if av25X_inter==1 drop av251 - av2576 av251_inter-av2576_inter *AV26: SOCIAL CLUBS (no activities of the basque data can be included in this category) gen av26=-9 *AV27: PUBS for num 1/76: gen av27X_inter=0 for num 1/76: replace av27X_inter=1 if actp3X==516 | actp3X==517 for num 1/76: generate av27X=av27X_inter*duramX egen av27=rsum(av271 - av2776) for num 1/76: replace marker_X=marker_X+1 if av27X_inter==1 drop av271 - av2776 av271_inter-av2776_inter *AV28: RESTAURANTS for num 1/76: gen av28X_inter=0 for num 1/76: replace av28X_inter=1 if (actp3X>=141 & actp3X<=149) & lugar2X==81 for num 1/76: generate av28X=av28X_inter*duramX egen av28=rsum(av281 - av2876) for num 1/76: replace marker_X=marker_X+1 if av28X_inter==1 drop av281 - av2876 av281_inter-av2876_inter *AV29: VISIT FRIENDS AT THEIR HOMES for num 1/76: gen av29X_inter=. for num 1/76: replace av29X_inter=1 if actp3X==511 | giftsX==29 for num 1/76: generate av29X=av29X_inter*duramX egen av29=rsum(av291 - av2976) for num 1/76: replace marker_X=marker_X+1 if av29X_inter==1 drop av291 - av2976 av291_inter-av2976_inter *AV30: LISTEN TO RADIO for num 1/76: gen av30X_inter=0 for num 1/76: replace av30X_inter=1 if actp3X==716 for num 1/76: generate av30X=av30X_inter*duramX egen av30=rsum(av301 - av3076) for num 1/76: replace marker_X=marker_X+1 if av30X_inter==1 drop av301 - av3076 av301_inter-av3076_inter *AV31: WATCH TV OR VIDEO for num 1/76: gen av31X_inter=0 for num 1/76: replace av31X_inter=1 if actp3X==714 | actp3X==715 | actp3X==718 | actp3X==719 for num 1/76: generate av31X=av31X_inter*duramX egen av31=rsum(av311 - av3176) for num 1/76: replace marker_X=marker_X+1 if av31X_inter==1 drop av311 - av3176 av311_inter-av3176_inter *AV32: LISTEN TO RECORDS, TAPES, CDS for num 1/76: gen av32X_inter=0 for num 1/76: replace av32X_inter=1 if actp3X==717 for num 1/76: generate av32X=av32X_inter*duramX egen av32=rsum(av321 - av3276) for num 1/76: replace marker_X=marker_X+1 if av32X_inter==1 drop av321 - av3276 av321_inter-av3276_inter *AV33: STUDY, HOMEWORK for num 1/76: gen av33X_inter=0 for num 1/76: replace av33X_inter=1 if actp3X==243 | actp3X==244 | actp3X==252 | actp3X==268 | actp3X==635 for num 1/76: generate av33X=av33X_inter*duramX egen av33=rsum(av331 - av3376) for num 1/76: replace marker_X=marker_X+1 if av33X_inter==1 drop av331 - av3376 av331_inter-av3376_inter *AV34: READ BOOKS for num 1/76: gen av34X_inter=0 for num 1/76: replace av34X_inter=1 if actp3X==712 for num 1/76: generate av34X=av34X_inter*duramX egen av34=rsum(av341 - av3476) for num 1/76: replace marker_X=marker_X+1 if av34X_inter==1 drop av341 - av3476 av341_inter-av3476_inter *AV35: READ PAPERS, MAGAZINES for num 1/76: gen av35X_inter=0 for num 1/76: replace av35X_inter=1 if actp3X==642 | actp3X==711 | actp3X==713 for num 1/76: generate av35X=av35X_inter*duramX egen av35=rsum(av351 - av3576) for num 1/76: replace marker_X=marker_X+1 if av35X_inter==1 drop av351 - av3576 av351_inter-av3576_inter *AV36: RELAX for num 1/76: gen av36X_inter=0 for num 1/76: replace av36X_inter=1 if actp3X==721 | actp3X==722 | actp3X==625 for num 1/76: generate av36X=av36X_inter*duramX egen av36=rsum(av361 - av3676) for num 1/76: replace marker_X=marker_X+1 if av36X_inter==1 drop av361 - av3676 av361_inter-av3676_inter *AV37: CONVERSATION for num 1/76: gen av37X_inter=0 for num 1/76: replace av37X_inter=1 if actp3X==521 | actp3X==522 | actp3X==524 | actp3X==526 | actp3X==529 for num 1/76: generate av37X=av37X_inter*duramX egen av37=rsum(av371 - av3776) for num 1/76: replace marker_X=marker_X+1 if av37X_inter==1 drop av371 - av3776 av371_inter-av3776_inter *AV38: ENTERTAIN FRIENDS AT HOME for num 1/76: gen av38X_inter=0 for num 1/76: replace av38X_inter=1 if actp3X==512 | giftsX==38 for num 1/76: generate av38X=av38X_inter*duramX egen av38=rsum(av381 - av3876) for num 1/76: replace marker_X=marker_X+1 if av38X_inter==1 drop av381 - av3876 av381_inter-av3876_inter *AV39: KNIT, SEW (no activities of the basque data can be included in this category) for num 1/76: gen av39X_inter=0 for num 1/76: replace av39X_inter=1 if actp3X==371 for num 1/76: generate av39X=av39X_inter*duramX egen av39=rsum(av391 - av3976) for num 1/76: replace marker_X=marker_X+1 if av39X_inter==1 drop av391 - av3976 av391_inter-av3976_inter *AV40: OTHER LEISURE for num 1/76: gen av40X_inter=0 for num 1/76: replace av40X_inter=1 if actp3X==523 | actp3X==742 | actp3X==743 | actp3X==744 | actp3X==746 | actp3X==631 | actp3X==632 | /// actp3X==633 | actp3X==634 | actp3X==641 | actp3X==643 | actp3X==646 | actp3X==648 | actp3X==649 | actp3X==751 | actp3X==753 | /// actp3X==754 | actp3X==755 | actp3X==756 | actp3X==759 | giftsX==40 for num 1/76: generate av40X=av40X_inter*duramX egen av40=rsum(av401 - av4076) for num 1/76: replace marker_X=marker_X+1 if av40X_inter==1 drop av401 - av4076 av401_inter-av4076_inter *AV41: UNCLASSIFIED OR MISSING ACTIVITIES for num 1/76: gen av41X_inter=0 for num 1/76: replace av41X_inter=1 if actp3X==921 | actp3X==922 for num 1/76: generate av41X=av41X_inter*duramX egen av41=rsum(av411 - av4176) for num 1/76: replace marker_X=marker_X+1 if av41X_inter==1 drop av411 - av4176 av411_inter-av4176_inter ** MAIN ACTIVITIES (W58) ** MAIN1: IMPUTED PERSONAL OR HOUSEHOLD CARE (no activities of the basque data can be included in this category) gen main1=-9 ** MAIN2: SLEEP AND NAPS for num 1/76: gen main2X_inter=0 for num 1/76: replace main2X_inter=1 if actp3X==111 | actp3X==112 | actp3X==113 | actp3X==114 for num 1/76: generate main2X=main2X_inter*duramX egen main2=rsum(main21 - main276) for num 1/76: replace marker_X=marker_X+1 if main2X_inter==1 drop main21 - main276 main21_inter-main276_inter ** MAIN3: IMPUTED SLEEP (no activities of the basque data can be included in this category) gen main3=-9 ** MAIN4: WASH, DRESS, CARE FOR SELF for num 1/76: gen main4X_inter=0 for num 1/76: replace main4X_inter=1 if actp3X==121 | actp3X==122 | actp3X==171 | actp3X==172 for num 1/76: generate main4X=main4X_inter*duramX egen main4=rsum(main41 - main476) for num 1/76: replace marker_X=marker_X+1 if main4X_inter==1 drop main41 - main476 main41_inter-main476_inter ** MAIN5: MEALS AT WORK OR SCHOOL for num 1/76: gen main5X_inter=0 for num 1/76: replace main5X_inter=1 if (actp3X>=141 & actp3X<=149) & (lugar2X==21 | lugar2X==22) for num 1/76: generate main5X=main5X_inter*duramX egen main5=rsum(main51 - main576) for num 1/76: replace marker_X=marker_X+1 if main5X_inter==1 drop main51 - main576 main51_inter-main576_inter ** MAIN6: OTHER MEALS OR SNACKS for num 1/76: gen main6X_inter=0 for num 1/76: replace main6X_inter=1 if (actp3X>=141 & actp3X<=149) & (lugar2X!=21 & lugar2X!=22 & lugar2X!=81) for num 1/76: generate main6X=main6X_inter*duramX egen main6=rsum(main61 - main676) for num 1/76: replace marker_X=marker_X+1 if main6X_inter==1 drop main61 - main676 main61_inter-main676_inter ** MAIN7: PAID WORK - MAIN JOB (NOT AT HOME) for num 1/76: gen main7X_inter=0 for num 1/76: replace main7X_inter=1 if (actp3X==211 | actp3X==241) & /// (lugar2X!=11 & lugar2X!=12 & lugar2X!=13 & lugar2X!=14 & lugar2X!=15 /// & lugar2X!=16 & lugar2X!=17 & lugar2X!=18 & lugar2X!=31 & lugar2X!=91) for num 1/76: generate main7X=main7X_inter*duramX egen main7=rsum(main71 - main776) for num 1/76: replace marker_X=marker_X+1 if main7X_inter==1 drop main71 - main776 main71_inter-main776_inter ** MAIN8: PAID WORK AT HOME for num 1/76: gen main8X_inter=0 for num 1/76: replace main8X_inter=1 if (actp3X==211 | actp3X==241) & /// ((lugar2X>=11 & lugar2X<=18) | lugar2X==31 | lugar2X==91) for num 1/76: generate main8X=main8X_inter*duramX egen main8=rsum(main81 - main876) for num 1/76: replace marker_X=marker_X+1 if main8X_inter==1 drop main81 - main876 main81_inter-main876_inter ** MAIN9: SECOND OR OTHER JOB NOT AT HOME for num 1/76: gen main9X_inter=0 for num 1/76: replace main9X_inter=1 if actp3X==221 | actp3X==225 | actp3X==247 for num 1/76: generate main9X=main9X_inter*duramX egen main9=rsum(main91 - main976) for num 1/76: replace marker_X=marker_X+1 if main9X_inter==1 drop main91 - main976 main91_inter-main976_inter ** MAIN10: UNPAID WORK TO GENERATE HOUSEHOLD INCOME (no activities of the basque data can be included in this category) gen main10=-9 ** MAIN11: TRAVEL AS A PART OF WORK for num 1/76: gen main11X_inter=0 for num 1/76: replace main11X_inter=1 if actp3X==213 | actp3X==223 for num 1/76: generate main11X=main11X_inter*duramX egen main11=rsum(main111 - main1176) for num 1/76: replace marker_X=marker_X+1 if main11X_inter==1 drop main111 - main1176 main111_inter-main1176_inter ** MAIN12: WORK BREAKS for num 1/76: gen main12X_inter=0 for num 1/76: replace main12X_inter=1 if actp3X==214 | actp3X==231 for num 1/76: generate main12X=main12X_inter*duramX egen main12=rsum(main121 - main1276) for num 1/76: replace marker_X=marker_X+1 if main12X_inter==1 drop main121 - main1276 main121_inter-main1276_inter ** MAIN13: OTHER TIME AT WORKPLACE for num 1/76: gen main13X_inter=0 for num 1/76: replace main13X_inter=1 if actp3X==224 | actp3X==232 | actp3X==246 for num 1/76: generate main13X=main13X_inter*duramX egen main13=rsum(main131 - main1376) for num 1/76: replace marker_X=marker_X+1 if main13X_inter==1 drop main131 - main1376 main131_inter-main1376_inter ** MAIN14: LOOK FOR WORK for num 1/76: gen main14X_inter=0 for num 1/76: replace main14X_inter=1 if actp3X==363 for num 1/76: generate main14X=main14X_inter*duramX egen main14=rsum(main141 - main1476) for num 1/76: replace marker_X=marker_X+1 if main14X_inter==1 drop main141 - main1476 main141_inter-main1476_inter ** MAIN15: REGULAR SCHOOLING, EDUCATION for num 1/76: gen main15X_inter=0 for num 1/76: replace main15X_inter=1 if actp3X==251 | actp3X==253 | actp3X==254 for num 1/76: generate main15X=main15X_inter*duramX egen main15=rsum(main151 - main1576) for num 1/76: replace marker_X=marker_X+1 if main15X_inter==1 drop main151 - main1576 main151_inter-main1576_inter ** MAIN16: HOMEWORK for num 1/76: gen main16X_inter=0 for num 1/76: replace main16X_inter=1 if actp3X==243 | actp3X==244 | actp3X==252 | actp3X==268 | actp3X==635 for num 1/76: generate main16X=main16X_inter*duramX egen main16=rsum(main161 - main1676) for num 1/76: replace marker_X=marker_X+1 if main16X_inter==1 drop main161 - main1676 main161_inter-main1676_inter ** MAIN17: LEISURE/OTHER EDUCATION TRAINING for num 1/76: gen main17X_inter=0 for num 1/76: replace main17X_inter=1 if actp3X==242 | actp3X==245 | (actp3X>=261 & actp3X<=267) | actp3X==269 for num 1/76: generate main17X=main17X_inter*duramX egen main17=rsum(main171 - main1776) for num 1/76: replace marker_X=marker_X+1 if main17X_inter==1 drop main171 - main1776 main171_inter-main1776_inter ** MAIN18: FOOD PREPARATION, COOK for num 1/76: gen main18X_inter=0 for num 1/76: replace main18X_inter=1 if actp3X==311 | actp3X==312 | actp3X==315 | actp3X==316 | actp3X==317 for num 1/76: generate main18X=main18X_inter*duramX egen main18=rsum(main181 - main1876) for num 1/76: replace marker_X=marker_X+1 if main18X_inter==1 drop main181 - main1876 main181_inter-main1876_inter ** MAIN19: SET TABLE, WASH/PUT AWAY DISHES for num 1/76: gen main19X_inter=0 for num 1/76: replace main19X_inter=1 if actp3X==313 | actp3X==314 for num 1/76: generate main19X=main19X_inter*duramX egen main19=rsum(main191 - main1976) for num 1/76: replace marker_X=marker_X+1 if main19X_inter==1 drop main191 - main1976 main191_inter-main1976_inter ** MAIN20: CLEANING for num 1/76: gen main20X_inter=0 for num 1/76: replace main20X_inter=1 if actp3X==321 | actp3X==322 | actp3X==323 | actp3X==341 for num 1/76: generate main20X=main20X_inter*duramX egen main20=rsum(main201 - main2076) for num 1/76: replace marker_X=marker_X+1 if main20X_inter==1 drop main201 - main2076 main201_inter-main2076_inter ** MAIN21: LAUNDRY, IRONING, CLOTHING REPAIR for num 1/76: gen main21X_inter=0 for num 1/76: replace main21X_inter=1 if actp3X==331 | actp3X==332 | actp3X==333 | actp3X==334 for num 1/76: generate main21X=main21X_inter*duramX egen main21=rsum(main211 - main2176) for num 1/76: replace marker_X=marker_X+1 if main21X_inter==1 drop main211 - main2176 main211_inter-main2176_inter ** MAIN22: MAINTAIN HOME / VEHICLE for num 1/76: gen main22X_inter=0 for num 1/76: replace main22X_inter=1 if actp3X==324 | actp3X==342 | actp3X==343 | actp3X==346 | actp3X==372 | actp3X==373 /// | actp3X==374 | actp3X==375 | actp3X==376 | actp3X==636 | actp3X==639 for num 1/76: generate main22X=main22X_inter*duramX egen main22=rsum(main221 - main2276) for num 1/76: replace marker_X=marker_X+1 if main22X_inter==1 drop main221 - main2276 main221_inter-main2276_inter ** MAIN23: OTHER DOMESTIC WORK for num 1/76: gen main23X_inter=0 for num 1/76: replace main23X_inter=1 if actp3X==344 | actp3X==345 | actp3X==347 | actp3X==348 | actp3X==349 | actp3X==644 for num 1/76: generate main23X=main23X_inter*duramX egen main23=rsum(main231 - main2376) for num 1/76: replace marker_X=marker_X+1 if main23X_inter==1 drop main231 - main2376 main231_inter-main2376_inter ** MAIN24: PURCHASE GOODS for num 1/76: gen main24X_inter=0 for num 1/76: replace main24X_inter=1 if actp3X==351 | actp3X==352 | actp3X==353 | actp3X==355 | actp3X==356 /// | actp3X==357 | actp3X==358 | actp3X==647 for num 1/76: generate main24X=main24X_inter*duramX egen main24=rsum(main241 - main2476) for num 1/76: replace marker_X=marker_X+1 if main24X_inter==1 drop main241 - main2476 main241_inter-main2476_inter ** MAIN25: CONSUME PERSONAL CARE SERVICES for num 1/76: gen main25X_inter=0 for num 1/76: replace main25X_inter=1 if actp3X==123 | actp3X==124 | actp3X==125 | actp3X==131 | actp3X==132 /// | actp3X==133 | actp3X==134 for num 1/76: generate main25X=main25X_inter*duramX egen main25=rsum(main251 - main2576) for num 1/76: replace marker_X=marker_X+1 if main25X_inter==1 drop main251 - main2576 main251_inter-main2576_inter ** MAIN26: CONSUME OTHER SERVICES for num 1/76: gen main26X_inter=0 for num 1/76: replace main26X_inter=1 if actp3X==354 | actp3X==359 | actp3X==361 | actp3X==362 | actp3X==645 for num 1/76: generate main26X=main26X_inter*duramX egen main26=rsum(main261 - main2676) for num 1/76: replace marker_X=marker_X+1 if main26X_inter==1 drop main261 - main2676 main261_inter-main2676_inter ** MAIN27: PET CARE (NOT WALK DOG) for num 1/76: gen main27X_inter=0 for num 1/76: replace main27X_inter=1 if actp3X==378 for num 1/76: generate main27X=main27X_inter*duramX egen main27=rsum(main271 - main2776) for num 1/76: replace marker_X=marker_X+1 if main27X_inter==1 drop main271 - main2776 main271_inter-main2776_inter ** MAIN28: PHYSICAL, MEDICAL CHILD CARE for num 1/76: gen main28X_inter=0 for num 1/76: replace main28X_inter=1 if actp3X==411 | actp3X==412 | actp3X==413 | actp3X==414 | actp3X==577 for num 1/76: generate main28X=main28X_inter*duramX egen main28=rsum(main281 - main2876) for num 1/76: replace marker_X=marker_X+1 if main28X_inter==1 drop main281 - main2876 main281_inter-main2876_inter ** MAIN29: TEACH, HELP WITH HOMEWORK for num 1/76: gen main29X_inter=0 for num 1/76: replace main29X_inter=1 if actp3X==421 for num 1/76: generate main29X=main29X_inter*duramX egen main29=rsum(main291 - main2976) for num 1/76: replace marker_X=marker_X+1 if main29X_inter==1 drop main291 - main2976 main291_inter-main2976_inter ** MAIN30: READ TO, TALK OR PLAY WITH CHILDREN for num 1/76: gen main30X_inter=0 for num 1/76: replace main30X_inter=1 if actp3X==422 | actp3X==423 | actp3X==424 for num 1/76: generate main30X=main30X_inter*duramX egen main30=rsum(main301 - main3076) for num 1/76: replace marker_X=marker_X+1 if main30X_inter==1 drop main301 - main3076 main301_inter-main3076_inter ** MAIN31: SUPERVISE, ACCOMPANY, OTHER CHILD CARE for num 1/76: gen main31X_inter=0 for num 1/76: replace main31X_inter=1 if actp3X==415 | actp3X==416 | actp3X==425 for num 1/76: generate main31X=main31X_inter*duramX egen main31=rsum(main311 - main3176) for num 1/76: replace marker_X=marker_X+1 if main31X_inter==1 drop main311 - main3176 main311_inter-main3176_inter ** MAIN32: ADULT CARE for num 1/76: gen main32X_inter=0 for num 1/76: replace main32X_inter=1 if actp3X==431 | actp3X==432 | actp3X==433 | (actp3X>=571 & actp3X<=576) | actp3X==578 | actp3X==579 for num 1/76: generate main32X=main32X_inter*duramX egen main32=rsum(main321 - main3276) for num 1/76: replace marker_X=marker_X+1 if main32X_inter==1 drop main321 - main3276 main321_inter-main3276_inter ** MAIN33: VOLUNTARY, CIVIC ORGANIZATIONAL ACT for num 1/76: gen main33X_inter=0 for num 1/76: replace main33X_inter=1 if actp3X==541 | actp3X==543 | actp3X==544 | actp3X==545 | actp3X==549 | /// (actp3X>=551 & actp3X<=559) | (actp3X>=561 & actp3X<=569) | actp3X==911 for num 1/76: generate main33X=main33X_inter*duramX egen main33=rsum(main331 - main3376) for num 1/76: replace marker_X=marker_X+1 if main33X_inter==1 drop main331 - main3376 main331_inter-main3376_inter ** MAIN34: WORSHIP AND RELIGION for num 1/76: gen main34X_inter=0 for num 1/76: replace main34X_inter=1 if actp3X==531 | actp3X==532 | actp3X==533 | actp3X==534 for num 1/76: generate main34X=main34X_inter*duramX egen main34=rsum(main341 - main3476) for num 1/76: replace marker_X=marker_X+1 if main34X_inter==1 drop main341 - main3476 main341_inter-main3476_inter ** MAIN35: GENERAL OUT-OF-HOME LEISURE (no activities of the basque data can be included in this category) gen main35=-9 ** MAIN36: ATTENDING SPORTING EVENT for num 1/76: gen main36X_inter=0 for num 1/76: replace main36X_inter=1 if actp3X==731 for num 1/76: generate main36X=main36X_inter*duramX egen main36=rsum(main361 - main3676) for num 1/76: replace marker_X=marker_X+1 if main36X_inter==1 drop main361 - main3676 main361_inter-main3676_inter ** MAIN37: CINEMA, THEATRE, OPERA, CONCERT for num 1/76: gen main37X_inter=0 for num 1/76: replace main37X_inter=1 if actp3X==733 | actp3X==734 | actp3X==736 | actp3X==737 | actp3X==739 for num 1/76: generate main37X=main37X_inter*duramX egen main37=rsum(main371 - main3776) for num 1/76: replace marker_X=marker_X+1 if main37X_inter==1 drop main371 - main3776 main371_inter-main3776_inter ** MAIN38: OTHER PUBLIC EVENT, VENUE for num 1/76: gen main38X_inter=0 for num 1/76: replace main38X_inter=1 if actp3X==622 | actp3X==623 | actp3X==732 | actp3X==735 | actp3X==738 for num 1/76: generate main38X=main38X_inter*duramX egen main38=rsum(main381 - main3876) for num 1/76: replace marker_X=marker_X+1 if main38X_inter==1 drop main381 - main3876 main381_inter-main3876_inter ** MAIN39: RESTAURANT, CAFE, BAR, PUB for num 1/76: gen main39X_inter=0 for num 1/76: replace main39X_inter=1 if actp3X==516 | actp3X==517 | ((actp3X>=141 & actp3X<=149) & lugar2X==81) for num 1/76: generate main39X=main39X_inter*duramX egen main39=rsum(main391 - main3976) for num 1/76: replace marker_X=marker_X+1 if main39X_inter==1 drop main391 - main3976 main391_inter-main3976_inter ** MAIN40: PARTY, SOCIAL EVENT, GAMBLING for num 1/76: gen main40X_inter=0 for num 1/76: replace main40X_inter=1 if actp3X==744 | giftsX==40 | actp3X==513 | actp3X==514 | actp3X==515 | actp3X==546 for num 1/76: generate main40X=main40X_inter*duramX egen main40=rsum(main401 - main4076) for num 1/76: replace marker_X=marker_X+1 if main40X_inter==1 drop main401 - main4076 main401_inter-main4076_inter ** MAIN41: IMPUTED TIME AWAY FROM HOME for num 1/76: gen main41X_inter=0 for num 1/76: replace main41X_inter=1 if actp3X==922 for num 1/76: generate main41X=main41X_inter*duramX egen main41=rsum(main411 - main4176) for num 1/76: replace marker_X=marker_X+1 if main41X_inter==1 drop main411 - main4176 main411_inter-main4176_inter ** MAIN42: GENERAL SPORT OR EXERCISE for num 1/76: gen main42X_inter=0 for num 1/76: replace main42X_inter=1 if actp3X==611 | actp3X==612 | actp3X==613 | actp3X==614 | actp3X==615 | actp3X==752 for num 1/76: generate main42X=main42X_inter*duramX egen main42=rsum(main421 - main4276) for num 1/76: replace marker_X=marker_X+1 if main42X_inter==1 drop main421 - main4276 main421_inter-main4276_inter ** MAIN43: WALKING for num 1/76: gen main43X_inter=0 for num 1/76: replace main43X_inter=1 if actp3X==624 for num 1/76: generate main43X=main43X_inter*duramX egen main43=rsum(main431 - main4376) for num 1/76: replace marker_X=marker_X+1 if main43X_inter==1 drop main431 - main4376 main431_inter-main4376_inter ** MAIN44: CYCLING (no activities of the basque data can be included in this category) gen main44=-9 ** MAIN45: OTHER OUTSIDE RECREATION (no activities of the basque data can be included in this category) gen main45=-9 ** MAIN46: GARDENING / PICK MUSHROOMS for num 1/76: gen main46X_inter=0 for num 1/76: replace main46X_inter=1 if actp3X==377 | actp3X==626 | actp3X==627 for num 1/76: generate main46X=main46X_inter*duramX egen main46=rsum(main461 - main4676) for num 1/76: replace marker_X=marker_X+1 if main46X_inter==1 drop main461 - main4676 main461_inter-main4676_inter ** MAIN47: WALK DOGS (no activities of the basque data can be included in this category) gen main47=-9 ** MAIN48: RECEIVE OR VISIT FRIENDS for num 1/76: gen main48X_inter=0 for num 1/76: replace main48X_inter=1 if actp3X==511 | actp3X==512 | actp3X==524 | giftsX==38 | giftsX==29 for num 1/76: generate main48X=main48X_inter*duramX egen main48=rsum(main481 - main4876) for num 1/76: replace marker_X=marker_X+1 if main48X_inter==1 drop main481 - main4876 main481_inter-main4876_inter ** MAIN49: CONVERSATION (IN PERSON, PHONE) for num 1/76: gen main49X_inter=0 for num 1/76: replace main49X_inter=1 if actp3X==521 | actp3X==522 | actp3X==526 | actp3X==529 for num 1/76: generate main49X=main49X_inter*duramX egen main49=rsum(main491 - main4976) for num 1/76: replace marker_X=marker_X+1 if main49X_inter==1 drop main491 - main4976 main491_inter-main4976_inter ** MAIN50: OTHER IN-HOME, SOCIAL GAMES for num 1/76: gen main50X_inter=0 for num 1/76: replace main50X_inter=1 if actp3X==742 | actp3X==743 | actp3X==746 for num 1/76: generate main50X=main50X_inter*duramX egen main50=rsum(main501 - main5076) for num 1/76: replace marker_X=marker_X+1 if main50X_inter==1 drop main501 - main5076 main501_inter-main5076_inter ** MAIN51: GENERAL INDOOR LEISURE (no activities of the basque data can be included in this category) gen main51=-9 ** MAIN52: ART OR MUSIC for num 1/76: gen main52X_inter=0 for num 1/76: replace main52X_inter=1 if actp3X==751 | actp3X==753 | actp3X==755 for num 1/76: generate main52X=main52X_inter*duramX egen main52=rsum(main521 - main5276) for num 1/76: replace marker_X=marker_X+1 if main52X_inter==1 drop main521 - main5276 main521_inter-main5276_inter ** MAIN53: CORRESPONDENSE (NOT E-LAB MAIL) for num 1/76: gen main53X_inter=0 for num 1/76: replace main53X_inter=1 if actp3X==523 for num 1/76: generate main53X=main53X_inter*duramX egen main53=rsum(main531 - main5376) for num 1/76: replace marker_X=marker_X+1 if main53X_inter==1 drop main531 - main5376 main531_inter-main5376_inter ** MAIN54: KNIT, CRAFTS OR HOBBIES for num 1/76: gen main54X_inter=0 for num 1/76: replace main54X_inter=1 if actp3X==371 | actp3X==631 | actp3X==754 | actp3X==756 | actp3X==759 for num 1/76: generate main54X=main54X_inter*duramX egen main54=rsum(main541 - main5476) for num 1/76: replace marker_X=marker_X+1 if main54X_inter==1 drop main541 - main5476 main541_inter-main5476_inter ** MAIN55: RELAX, THINK, DO NOTHING for num 1/76: gen main55X_inter=0 for num 1/76: replace main55X_inter=1 if actp3X==625 | actp3X==721 | actp3X==722 for num 1/76: generate main55X=main55X_inter*duramX egen main55=rsum(main551 - main5576) for num 1/76: replace marker_X=marker_X+1 if main55X_inter==1 drop main551 - main5576 main551_inter-main5576_inter ** MAIN56: READ for num 1/76: gen main56X_inter=0 for num 1/76: replace main56X_inter=1 if actp3X==642 | actp3X==711 | actp3X==712 | actp3X==713 for num 1/76: generate main56X=main56X_inter*duramX egen main56=rsum(main561 - main5676) for num 1/76: replace marker_X=marker_X+1 if main56X_inter==1 drop main561 - main5676 main561_inter-main5676_inter ** MAIN57: LISTEN TO MUSIC ETC. for num 1/76: gen main57X_inter=0 for num 1/76: replace main57X_inter=1 if actp3X==717 for num 1/76: generate main57X=main57X_inter*duramX egen main57=rsum(main571 - main5776) for num 1/76: replace marker_X=marker_X+1 if main57X_inter==1 drop main571 - main5776 main571_inter-main5776_inter ** MAIN58: LISTEN TO RADIO for num 1/76: gen main58X_inter=0 for num 1/76: replace main58X_inter=1 if actp3X==716 for num 1/76: generate main58X=main58X_inter*duramX egen main58=rsum(main581 - main5876) for num 1/76: replace marker_X=marker_X+1 if main58X_inter==1 drop main581 - main5876 main581_inter-main5876_inter ** MAIN59: WATCH TV, VIDEO, DVD for num 1/76: gen main59X_inter=0 for num 1/76: replace main59X_inter=1 if actp3X==714 | actp3X==715 | actp3X==718 | actp3X==719 for num 1/76: generate main59X=main59X_inter*duramX egen main59=rsum(main591 - main5976) for num 1/76: replace marker_X=marker_X+1 if main59X_inter==1 drop main591 - main5976 main591_inter-main5976_inter ** MAIN60: COMPUTER GAMES (no activities of the basque data can be included in this category) for num 1/76: gen main60X_inter=0 for num 1/76: replace main60X_inter=1 if actp3X==634 | actp3X==648 for num 1/76: generate main60X=main60X_inter*duramX egen main60=rsum(main601 - main6076) for num 1/76: replace marker_X=marker_X+1 if main60X_inter==1 drop main601 - main6076 main601_inter-main6076_inter ** MAIN61: E-LAB MAIL, SURF INTERNET, COMPUTING for num 1/76: gen main61X_inter=0 for num 1/76: replace main61X_inter=1 if actp3X==632 | actp3X==633 | actp3X==641 | actp3X==643 | actp3X==646 | actp3X==649 for num 1/76: generate main61X=main61X_inter*duramX egen main61=rsum(main611 - main6176) for num 1/76: replace marker_X=marker_X+1 if main61X_inter==1 drop main611 - main6176 main611_inter-main6176_inter ** MAIN62:NO ACT BUT RECORDED TRANSPORT MODE (no activities of the basque data can be included in this category) gen main62=-9 ** MAIN63: TRAVEL TO/FROM WORK for num 1/76: gen main63X_inter=0 forval i= 1/76 { replace main63`i'_inter=1 if actp3`i'==841 | ((actp3`i'>=811 & actp3`i'<=819) & (final`i'==1 | lugar2`i'==21 /// | actp3`i'==211 | actp3`i'==214 | actp3`i'==231 | actp3`i'==232 | actp3`i'==241 | actp3`i'==246)) } forval i= 1/75 { local j=`i'+1 replace main63`i'_inter=1 if (actp3`i'>=811 & actp3`i'<=819) & (lugar2`j'==21 | actp3`j'==211 | actp3`j'==214 | actp3`j'==231 | actp3`j'==232 | actp3`j'==241 | actp3`j'==246) } forval i= 2/76 { local h=`i'-1 replace main63`i'_inter=1 if (actp3`i'>=811 & actp3`i'<=819) & (lugar2`h'==21 | actp3`h'==211 | actp3`h'==214 | actp3`h'==231 | actp3`h'==232 | actp3`h'==241 | actp3`h'==246) } for num 1/76: generate main63X=main63X_inter*duramX egen main63=rsum(main631 - main6376) for num 1/76: replace marker_X=marker_X+1 if main63X_inter==1 drop main631 - main6376 main631_inter-main6376_inter ** MAIN64: EDUCATIONAL TRAVEL (no activities of the basque data can be included in this category) gen main64=-9 ** MAIN65: VOLUNTARY / CIVIC / RELIGIOUS TRAVEL (no activities of the basque data can be included in this category) gen main65=-9 ** MAIN66: CHILD / ADULT CARE TRAVEL gen main66=-9 ** MAIN67: SHOP PERSON / HOUSEHOLD CARE TRAVEL (no activities of the basque data can be included in this category) gen main67=-9 ** MAIN68: OTHER TRAVEL for num 1/76: gen main68X_inter=0 forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace main68`i'_inter=1 if actp3`i'==621 | actp3`i'==842 | actp3`i'==843 | ((actp3`i'>=811 & actp3`i'<=819) & (final`i'!=1 /// & lugar2`i'!=21 & actp3`i'!=211 & actp3`i'!=214 & actp3`i'!=231 & actp3`i'!=232 & actp3`i'!=241 & actp3`i'!=246 /// & lugar2`j'!=21 & actp3`j'!=211 & actp3`j'!=214 & actp3`j'!=231 & actp3`j'!=232 & actp3`j'!=241 & actp3`j'!=246 /// & lugar2`h'!=21 & actp3`h'!=211 & actp3`h'!=214 & actp3`h'!=231 & actp3`h'!=232 & actp3`h'!=241 & actp3`h'!=246)) } replace main681_inter=1 if actp31==621 | actp31==842 | actp31==843 | ((actp31>=811 & actp31<=819) & (final1!=1 /// & lugar21!=21 & actp31!=211 & actp31!=214 & actp31!=231 & actp31!=232 & actp31!=241 & actp31!=246)) replace main6876_inter=1 if actp376==621 | actp376==842 | actp376==843 | ((actp376>=811 & actp376<=819) & (final76!=1 /// & lugar276!=21 & actp376!=211 & actp376!=214 & actp376!=231 & actp376!=232 & actp376!=241 & actp376!=246)) for num 1/76: generate main68X=main68X_inter*duramX egen main68=rsum(main681 - main6876) for num 1/76: replace marker_X=marker_X+1 if main68X_inter==1 drop main681 - main6876 main681_inter-main6876_inter ** MAIN69: NO RECORDED ACTIVITY for num 1/76: gen main69X_inter=0 for num 1/76: replace main69X_inter=1 if actp3X==921 for num 1/76: generate main69X=main69X_inter*duramX egen main69=rsum(main691 - main6976) for num 1/76: replace marker_X=marker_X+1 if main69X_inter==1 drop main691 - main6976 main691_inter-main6976_inter *CREATING THE VARIABLE WHICH GATHER THE TOTAL AMOUNT OF TIME REPORTED BY THE DIARIST TO SEE WHETHER THE DAYRIST egen tottime=rsum(av1-av41) replace tottime=tottime+18 if tottime>0 ********************************************* ** DEMOGRAPHIC AND SOCIO-ECONOMIC VARIABLES** ********************************************* *********************************** *DIARY, SURVEY AND CASE INFORMATION *********************************** /*COUNTRY NUMBER FOR SPAIN HAS BEEN DEFINED BEFORE, SO WE ASSIGN THE NUMBER 34 FOR SPAIN*/ generate countrya=34 generate survey=2002 /*THIS VARIABLE IS USED WHEN THE DATA REPORT INFORMATION FOR MORE THAN ONE YEAR. IN THE BASQUE COUNTRY CASE THERE ARE 4 WAVES, SO FAR*/ generate swave=0 /*THIS VARIABLE IS USED WHEN THERE IS INFORMATION COMING FROM DIFFERENT SURVEYS. IN THE BASQUE COUNTRY CASE ALL THE INFORMATION COME FROM THE SAME SURVEY*/ generate msamp=11 /*WE USE THE ORIGINAL SPANISH HOUSEHOLD IDENTIFIERS FOR DIFFEENCING ACROSS HOUSEHOLDS*/ generate hldid=numc /*WE USE THE ORIGINAL SPANISH PERSON IDENTIFIERS FOR DIFFERENCING ACROSS INDIVIDUALS*/ generate persid=nind /* THE SURVEY ONLY RECORDS DATA FOR ONE DAY SO "ID" AND "PERSID" ARE THE SAME*/ generate id=persid /* PERSON IDENTIFER OF 1ST AND 2ND PARENT OF DIARIST. PARENTS DO NOT COMPLETE A DIARY SO WE SET THE VARIABLE TO -9 */ gen parntid1=-9 gen parntid2=-9 /* PERSON IDENTIFER OF SPOUSE OR PARTNER OF THE DIARIST. HE/SHE DOES NOT COMPLETE A DIARY SO WE SET THE VARIABLE TO -9 */ gen partid=-9 /* IN THE DATA THE VARIABLE "diase1" INDICATES THE DAY OF THE WEEK, AND NUMBER 1 CORRESPONDS TO MONDAY, 2 TO TUESDAY, AND SO ON UNTILL THE NUMBER 7 ON SUNDAY*/ generate day= 1 if diase1==7 replace day=2 if diase1==1 replace day=3 if diase1==2 replace day=4 if diase1==3 replace day=5 if diase1==4 replace day=6 if diase1==5 replace day=7 if diase1==6 replace day=-8 if day==. /*IN THE BASQUE COUNTRY SURVEY THE MONTH TO WHICH THE DIARY QUESTIONNAIRE IS REFERRED IS NOT REPORTED. WE KNOW THAT THE INFORMATION IS GATHERED IN TWO DIFFERENT TIME PERIODS: SEPTEMBER TO NOVEMBER 2002 AND APRIL TO JUNE 2003 */ generate month=menc /* YEAR WHEN THE DIARY WAS KEPT. THE VARIABLE "AENC* REPORTS THE YEAR THE INTERVIEW TOOK PLACE*/ generate year=aenc /*THIS VARIABLE IS USED FOR DIFFERENCING IN THE CASE IN WHICH THERE ARE MORE THAN 1 DAY IN THE DIARY QUESTIONNAIRE, BUT IN THE BASQUE COUNTRY SURVEY THERE IS ONLY ONE DAY REPORTED*/ generate diary=1 *************************** **HOUSEHOLD-LEVEL VARIABLES *************************** /* WE CREATE THE VARIABLE HHTYPE. WE USE THE VARIABLE "tamf" (family size) and "eciv3" (civil status) and "pare" (relationship with the reference person) TO CLASSIFY EACH FAMILY INTO ONE OF THE FOLLOWINF FOUR CATEGORIES: one person household (1), married couple alone (2), married couple + others (3), other household types (4)*/ generate hhtype=1 if tamf==1 /* We identify HHLD with one person */ generate couple=1 if pare==1 replace couple=1 if pare==2 sort numc by numc: egen number_partners=sum(couple) /*With this I know the number of individuals in each HHLD who are either the reference person or the partner*/ /*Since we want to identify couples, in one HHLD we will have a couple (always having the reference person in mind) if num number_partners==2 */ replace hhtype=2 if number_partners==2 & tamf==2 replace hhtype=3 if number_partners==2 & tamf>2 replace hhtype=4 if hhtype==. /*this is not a problem because we are going to keep only the diarists in the final sample*/ /* there is a HHLD with an error coding the relationship of one of the members, it appears as a partner but by the age group is the doughter of the reference person. We reclassify this family */ replace hhtype=3 if numc==1357 /* WE CREATE HHLDSIZE VARIABLE WHICH MATCHES WITH THE BASQUE COUNTRY VARIABLE "tamf" */ generate hhldsize=tamf /* CREATING THE VARIABLE NUMBER OF CHILDREN UNDER 18 IN THE HOUSEHOLD. IN THE BASQUE COUNTRY SURVEY AGE INFORMATION FOR THE WHOLE SAMPLE IS ONLY AVAILABLE FOR THE FOLLOWING AGE GROUPS WHICH ARE LABELLED (variable "edad2"): 1 "0-4" 2 "5-9" 3 "10-14" 4 "15-19" 5 "20-24" 6 "25-29" 7 "30-34" 8 "35-39" /// 9 "40-44" 10 "45-49" 11 "50-54" 12 "55-59" 13 "60-64" 14 "65-69" 15 "70-74" 16 "75-79" 17 "80-84" 18 "85+" */ sort numc by numc: gen child=1 if edad2 <= 4 by numc: egen nchild=count(child) *by numc: replace nchild=0 if nchild==. /*no needed, count gives zeros when no children in the HHLD*/ drop child /*CREATING THE VARIABLE AGE OF THE YOUNGEST CHILD IN THE HHLD (CATEGORIES: AGEKIDX). WE USE THE VARIABLES: "pare" (relationship with the reference person) and "edad2" (DISCRIBED ABOVE)FROM THE BASQUE COUNTRY SURVEY. THEREFORE AGE OF THE YUNGEST CHILD IS GIVEN BY THE AGE GROUP SHE OR HE BELONG TO */ gen childage=edad2 if edad2<5 replace childage=edad2 if ((pare==3 | pare==4 | pare==7) & childage==.) by numc: egen kid=min(childage) generate agekidx=1 if kid ==1 /*YOUNGEST CHILD 0-4 YEARES OLD*/ replace agekidx=2 if kid ==2 | kid ==3 /*YOUNGEST CHILD 5-14 YEARES OLD*/ replace agekidx=3 if kid ==4 /*YOUNGEST CHILD 15-19 YEARES OLD*/ replace agekidx=4 if kid >4 & kid!=./*YOUNGEST CHILDREN 20+. NO missing values*/ replace agekidx=-7 if agekidx==. /* CREATING THE VARIABLE OF THE AGE OF YOUNGEST CHILDREN IN THE HOUSEHOLD: AGEKID2. THIS VARIABLE DOES NOT GIVE US THE ACTUAL AGE BUT GIVES THE AGE-GROUP THE YOUNGEST CHILD BELONGS TO GIVEN THE INFORMATION AVAILABLE IN THE BASQUE COUNTRY SURVEY: THE DIFFERENT VALUES MEAN: 1 "0-4" 2 "5-9" 3 "10-14" 4 "15-19" 5 "20-24" 6 "25-29" 7 "30-34" 8 "35-39" 9 "40-44" 10 "45-49" 11 "50-54" 12 "55-59" 13 "60-64" /// 14 "65-69" 15 "70-74" 16 "75-79" 17 "80-84" 18 "85+" */ by numc: egen agekid2=min(childage) replace agekid2=edad1 if agekid2==. & (edad1>=15 & edad1<=19) replace agekid2=-7 if agekid2==. replace agekid2=80 if agekid2>=80 /* VARIABLE INCORIG (ORIGINAL HOUSEHOLD INCOME) CAN NOT BE GENERATED. INFORMATION ON INCOME NOT AVAILABLE IN THE BASQUE COUNTRY SURVEY*/ generate incorig=-9 /* VARIABLE INCOME (TOTAL HOUSEHOLD INCOME-GROUPED) CAN NOT BE GENERATED. INFORMATION ON INCOME NOT AVAILABLE IN THE BASQUE COUNTRY SURVEY*/ generate income=-9 /*THE VARIABLE OWNHOME WHICH TELLS US IF THE DIARISTS OWN THEIR HOMES OR ARE RENTED CAN NOT BE GENERATED. INFORMATION NOT AVAILABLE*/ generate ownhome=-9 /*THE VARIABLE URBAN WHICH TELLS US IF THE DIARISTS IVES OR NOT IN AN URBAN AREA CAN NOT BE GENERATED. INFORMATION NOT AVAILABLE*/ generate urban=-9 /*THE VARIABLE COMPUTER WHICH TELLS US IF THE HOUSEHOLD HAVE A COMPUTER CAN NOT BE GENERATED. INFORMATION NOT AVAILABLE*/ generate computer=-9 /*THE VARIABLE VEHICLE WHICH TELLS US IF THE HOUSEHOLD HAVE ACCESS TO A PRIVATE VEHICLE CAN NOT BE GENERATED. INFORMATION NOT AVAILABLE*/ generate vehicle=-9 ************************************** **PERSONAL-LEVEL DEMOGRAPHIC VARIABLES ************************************** /*SEX. The variable sexo indicates the sex. Takes value 1 for males and 2 for females*/ gen sex = sexo /* AGE OF THE DIARIST*. The variable edad1 indicates the age of the diarist*/ gen age = edad1 replace age=80 if edad1>=80 /* INDIVIDUAL LEVEL FAMILY STATUS VARIABLE: FAMSTAT*/ generate famstat=. replace famstat=0 if (edad1>=18 & edad1<40) & nchild==0 & (agekidx==-7 | agekidx==4) replace famstat=3 if edad1>=40 & nchild==0 & (agekidx==-7 | agekidx==4) replace famstat=1 if edad1>=18 & nchild>0 & agekidx==1 replace famstat=2 if edad1>=18 & nchild>0 & (agekidx==2 |agekidx==3) replace famstat=4 if edad1<18 & (pare==3 | pare ==6 | pare== 7) & number_partners==2 replace famstat=5 if edad1<18 & (pare==3 | pare ==6 | pare== 7) & (number_partners==1 | number_partners==0) /* GENERATING CPHOME:UNMARRIED CHILD LIVING IN PARENTAL HOME. We take into account that in family numc=1357 one member of the family missreport her relationship with the reference person. Its a daughter and it appears as a partner leading to having number_partners==3*/ gen cphome=1 if pare==3 & eciv3!=2 replace cphome=0 if cphome==. drop couple number_partners /*GENERATING WHETHER THE DIARIST IS A SINGLE PARENT: SINGPAR VARIABLE*/ generate couple=1 if pare==1 replace couple=1 if pare==2 sort numc by numc: egen number_partners=sum(couple) by numc: gen child=1 if pare==3 by numc: egen nchild1=count(child) gen singpar=1 if number_partners==1 & (nchild1>0 & nchild1<.) replace singpar=0 if singpar==. drop child nchild1 /* GENERATING THE VARIABLE RELREFP: RELATIONSHIP OF THE DIARIST TO THE HOUSEHOLD REFERENCE PERSON*/ recode pare (4=6) (5=4) (6=5) (7 8 =9) (9=10), gen(relrefp) /*CIVIL STATUS VARIABLE: CIVSTAT. DIARIST COUPLE STATUS: WHETHER THE DIARIST IN A COUPLE OR NOT*/ /*Already generated between the reference person and partner above*/ /*generating couples between other members of the family: son-daugther in law, daughter and son in law*/ generate couple1=1 if pare==3 & eciv3==2 replace couple1=1 if pare==4 & eciv3==2 by numc: egen number_partners1=sum(couple1) /*generating other possible couples: siblings, mother/father(in-law), no relatives. We can not identify if they are partners of each other, just that both of them are married.*/ generate couple2=1 if pare>4 & eciv3==2 by numc: egen number_partners2=sum(couple2) by numc: gen civstat=1 if (nind==1 | nind==2) & number_partners==2 by numc: replace civstat=1 if (pare==3 | pare==4) & couple1==1 & number_partners1==2 by numc: replace civstat=1 if pare>4 & couple2==1 & number_partners2==2 by numc: replace civstat=2 if civstat==. replace civstat=1 if (pare==3 | pare==4) & eciv3==2 & number_partners1==3 /*in numc==1408 there are 2 sons married and we get number_partners==3*/ /*DIARIST IS COHABITING*/ gen cohab=. replace cohab=1 if civstat==1 & eciv3!=2 replace cohab=0 if cohab==. replace cohab=-7 if civstat==2 replace cohab=-8 if civstat==-8 /*THE VARIABLE "lunac2" indicates if the individual was born at the basque country or not. That is, if he(she is a citizen of the Basque Country. No information available about if he or she is a citizen of Spain*/ gen citizen=-9 /* IN PAID WORK. VARIABLE OCUP=2 IN NOT EMPLOYED AND OCUP=1 IF EMPLOYED*/ recode ocup (2=0), gen(emp) replace emp=-8 if emp==. /*EMPLOYMENT STATUS, REFLECTS ATTACHTMENT TO THE LABOR MARKET. NO INFORMATION ON HOURS OF WORK*/ gen empstat=3 if emp==1 replace empstat=4 if emp==0 replace empstat=-8 if emp==-8 /*UNEMPLOYED*/ gen unemp=1 if relaf2==3 | relaf2==4 replace unemp=0 if relaf2!=3 & relaf!=4 /*STUDENT STATUS: WE USE THE VARIBLE "ESTUD" WHICH REPORTS WHETHE THE DIARIST IS A STUDENT OR NOT. WE DO NOT USE THE MAIN ACTIVITY STATUS */ recode estud (2 = 0), gen (student) /*WHETHER THE DIARIST HAS RETIRED*/ gen retired=1 if relaf2==5 replace retired=0 if relaf2!=5 gen empsp=-9 /*WORKING HOURS INCLUDING OVERTIME*/ gen workhrs=-9 /*ORIGINAL MONTHLY INCOME FROM EMPLOYMENT OR SELF-EMPLOYMENT*/ gen empinclm=-9 /*OCCUPATION*/ gen occup=. replace occup=1 if profe1==2 replace occup=7 if profe1==1 replace occup=9 if profe1==3 replace occup=10 if profe1==5 replace occup=11 if profe1==4 replace occup=12 if profe1==6 replace occup=13 if profe1==7 replace occup=-7 if profe1==0 replace occup=-8 if profe1==8 | profe1==9 | profe1==. /*SECTOR OF EMPLOYMENT*/ gen sector=-9 /*EDUCATIONAL LEVEL-ORIGINAL STUDY CODE*/ gen educa=nivif1 /*HARMONISED LEVEL OF EDUCATION*/ gen edtry= 1 if nivif1==1 | nivif1==2 replace edtry=2 if nivif1==3 | nivif1==4 replace edtry=3 if nivif1==5 | nivif1==6 /*RUSHED: Whether diarist generally feels rushed */ gen rushed=-9 /*HEALTH: Diarist’s general health. Only available information whether or not the diarist has health problems*/ gen health=-9 /*CARER: Diarist looks after an adult or child with a disability*/ for num 1/76: gen carerX_inter=0 for num 1/76: replace carerX_inter=1 if actp3X==431 | actp3X==432 egen carer_sum=rsum(carer1_inter - carer76_inter) tab carer_sum gen carer=. replace carer=1 if carer_sum>0 replace carer=0 if carer==. /*DISAB: Diarist has a disability or long-term limiting health condition. Only available information whether or not the diarist has health problems. We do not know which type of problem is.*/ gen disab=-9 /* WE KEEP ONLY THE DIARISTS*/ keep if edad1!=. /*WE CREATE THE VARIABLE OF LEISURE WITH THE SPOUSE */ for num 1/76: generate conyugeX=duramX if (compX>=10 & compX<20) | compX==1 for num 1/76: replace conyugeX=0 if conyugeX==. egen sppart=rsum(conyuge1-conyuge76) drop conyuge1-conyuge76 **WE CHECK AND CORRECT ERRORS replace agekidx=-7 if famstat==2 & hhldsize==1 replace famstat=0 if famstat==2 & hhldsize==1 replace famstat=0 if famstat==2 & hhtype==1 replace famstat=4 if famstat==5 & cphome==1 replace civstat=1 if relrefp==2 & civstat==2 replace cphome=0 if cphome==1 & civstat==1 replace sppart=0 if sppart>0 & civstat==2 replace hhtype=3 if hhtype==4 & civstat==1 replace cohab=0 if cohab==1 & civstat==2 replace hhldsize=3 if famstat==2 & hhtype==2 replace hhtype=3 if famstat==2 & hhtype==2 ******************************************************************** ******************************************************************** ** Correct for quality of diary (see documentation at http://www.timeuse.org/mtus/documentation) ******************************************************************************************************************************************************** ********************************************************************************************************************************************************** *NOW WE CORRECT FOR THE QUALITY OF THE DIARIES ********************************************** ********************************************************************************************************************************************************** ********************************************************************************************************************************************************** **NO AGE OR GENDER ****************** 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==. **NO MISSING DAY **************** generate missing_day=1 if day==-8 replace missing_day=0 if day!=-8 **DIARIES WITH LESS THAN SEVEN EPISODES *************************************** *************************************** for num 1/76: gen episodeX=0 for num 1/76: replace episodeX=1 if actp3X!=. & actp3X!=921 & actp3X!=922 & actp3X!= 912 egen number_episodes=rsum(episode1 - episode76) drop episode1-episode76 *2+ OR MORE OF THESE BASIC ACTIVITIES MISSING: SLEEP OR REST, EATING OR DRINKING, PERSONAL CARE, TRAVEL/EXERCISE **************************************************************************************************************** for num 1/76: generate sleepX=duramX if actp3X>=110 & actp3X<120 egen sleep=rsum(sleep1-sleep76) drop sleep1-sleep76 for num 1/76: generate travel_exerciseX=duramX if (actp3X>=810 & actp3X<820) | actp3X==841 | (actp3X>=610 & actp3X<630) | actp3X==213 | actp3X==223 egen travel_exercise=rsum(travel_exercise1-travel_exercise76) drop travel_exercise1-travel_exercise76 for num 1/76: generate eating_drinkingX=duramX if (actp3X>=140 & actp3X<150) egen eating_drinking=rsum(eating_drinking1-eating_drinking76) drop eating_drinking1-eating_drinking76 for num 1/76: generate personal_careX=duramX if (actp3X>=120 & actp3X<140) | (actp3X>=170 & actp3X<180) egen personal_care=rsum(personal_care1-personal_care76) drop personal_care1-personal_care76 for num 1/76: generate other_careX=duramX if (actp3X>=410 & actp3X<500) | (actp3X>=570 & actp3X<580) egen other_care=rsum(other_care1-other_care76) replace other_care=1 if carer==1 drop other_care1-other_care76 **TRAVELLING TIME ACCORDING TO CHANGE OF LOCATION ************************************************* local i=1 while `i'<77{ local j=`i'+1 generate laglugar2`j'=lugar2`i' local i=`i'+1 } for num 1/76: gen travellingX=0 local i=2 while `i'<76{ local j=`i'+1 replace travelling`j'=duram`j' if (laglugar2`i'!=lugar2`i') & travel_exercise==0 local i=`i'+1 } egen travelling=rsum(travelling1 - travelling76) replace travel_exercise=travelling if travel_exercise==0 & travelling>0 drop laglugar* travelling1-travelling76 **TIME AT HOME ************** for num 1/76: generate athomeX=duramX if (lugar2X>=11 & lugar2X==19) egen athome=rsum(athome1 - athome76) drop athome1-athome76 **RECODING OF BASIC ACTIVITIES ****************************** replace sleep=1 if sleep>0 replace travel_exercise=1 if travel_exercise>0 replace eating_drinking=1 if eating_drinking>0 replace personal_care=1 if personal_care>0 replace other_care=1 if other_care>0 generate LOSS_ACTIVITIES_INTER=3-sleep-eating_drinking-personal_care if travel_exercise==1 replace LOSS_ACTIVITIES_INTER=4-sleep-eating_drinking-personal_care if travel_exercise==0 generate loss_basic_activities=0 if LOSS_ACTIVITIES_INTER<2 replace loss_basic_activities=0 if LOSS_ACTIVITIES_INTER==2 & number_episodes>=15 replace loss_basic_activities=0 if other_care==1 replace loss_basic_activities=0 if personal_care==0 & sleep==1 & travel_exercise==1 replace loss_basic_activities=0 if LOSS_ACTIVITIES_INTER==2 & athome>=1000 & number_episodes>=12 replace loss_basic_activities=1 if loss_basic_activities==. **WITH THE FOUR INDICATORS, WE COMPUTE THE "BADCASE" VARIABLE ************************************************************* /* BAD CASE MARKER */ generate badcase=. 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 ************************************************************************************************************************************** *SAMPLE WEIGHTS. ORIGINAL WEIGHTS NAMED AS "elev" generate ocombwt=elev 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 replace propwt=propwt*(count/countp) egen mean_weight=mean(propwt) replace propwt=propwt/mean_weight ****************************************************************** * Stata syntax to harmonise all the MTUS W5.3 variable 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 "One sample" 1 "Szalai USA 1965 sample" 2 "National USA 1965 sample" 3 "USA 1998-99" 4 "USA 2000-01" 5 "Slovenia in Szalai Yugoslavia" 6 "Serbia in Szalai Yugoslavia" 7 "UK 1983/84 autumn, winter" 8 "UK 1987 July" 9 "East Germany" 10 "West Germany" 11 "Basque Region in Spain" ; 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 -9 "could not be created"; 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 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; 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 7 "university level" 6 "polytechnic level" 5 "high school degree" 4 "higher levels of secondary education (at least 5 years)" 3 "higher levels of secondary education (3, 4 years)" 2 "lower levels of secondary education (1, 2 years)" 1 "only primary education"; 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 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"; #delimit cr compress save "/Users/LK/Documents/Time Use/TUSPB_2003temp.dta", replace ** WE NOW SAVE THE W5 DATASETS ****************************** * W553 * use "/Users/LK/Documents/Time Use/TUSPB_2003temp.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 order 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 compress save "/Users/LK/Documents/Time Use/SPA2003W553.dta", replace * W58 * use "/Users/LK/Documents/Time Use/TUSPB_2003temp.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 main* av* sppart ocombwt propwt order 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 main* av* sppart ocombwt propwt sort swave msamp hldid persid id drop if age<18 compress save "/Users/LK/Documents/Time Use/SPA2003W58.dta", replace * W58KID * use "/Users/LK/Documents/Time Use/TUSPB_2003temp.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 main* av* sppart ocombwt propwt order 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 main* av* sppart ocombwt propwt sort swave msamp hldid persid id drop if age>=18 compress save "/Users/LK/Documents/Time Use/SPA2003W58kid.dta", replace ******************************************************** ** WORLD 6 VARIABLES ** ******************************************************** use "/Users/LK/Documents/Time Use/TUSPB_2003temp.dta", clear set more off forval i= 1/76 { gen avx`i'=0 gen mainx`i'=0 gen secx`i'=69 } **AV W6 ******* forval i=1/76 { replace avx`i'=1 if actp3`i'==211 | actp3`i'==214 | actp3`i'==231 | actp3`i'==232 | actp3`i'==241 | actp3`i'==246 replace avx`i'=2 if actp3`i'==212 | actp3`i'==363 | actp3`i'==364 replace avx`i'=3 if actp3`i'==221 | actp3`i'==224 | actp3`i'==225 | actp3`i'==247 replace avx`i'=4 if actp3`i'==242 | actp3`i'==245 |actp3`i'==251 | actp3`i'==253 | actp3`i'==254 | actp3`i'==262 | actp3`i'==263 | /// actp3`i'==264 | actp3`i'==265 | actp3`i'==266 | actp3`i'==267 | actp3`i'==269 replace avx`i'=5 if actp3`i'==213 | actp3`i'==223 | actp3`i'==841 | (((actp3`i'>=811 & actp3`i'<=819) & (final`i'==1 | final`i'==2)) & final`i'!=.) replace avx`i'=6 if actp3`i'>=311 & actp3`i'<=317 replace avx`i'=7 if actp3`i'==321 | actp3`i'==322 | actp3`i'==323 | actp3`i'==324 | actp3`i'==331 | actp3`i'==332 | actp3`i'==334 | /// actp3`i'==341 | actp3`i'==345 replace avx`i'=8 if actp3`i'==333 | actp3`i'==342 | actp3`i'==343 | actp3`i'==344 | actp3`i'==346 | actp3`i'==347 | actp3`i'==348 | /// actp3`i'==349 | actp3`i'==372 | actp3`i'==373 | actp3`i'==374 | actp3`i'==375 | actp3`i'==376 | actp3`i'==378 | actp3`i'==431 | actp3`i'==432 | /// actp3`i'==433 | actp3`i'==571 | actp3`i'==572 | actp3`i'==573 | actp3`i'==574 | actp3`i'==575 | actp3`i'==576 | actp3`i'==578 | actp3`i'==579 | /// actp3`i'==636 | actp3`i'==639 | actp3`i'==644 replace avx`i'=9 if actp3`i'==377 | actp3`i'==627 replace avx`i'=10 if (actp3`i'>=351 & actp3`i'<=359) | actp3`i'==361 | actp3`i'==362 | actp3`i'==645 | actp3`i'==647 replace avx`i'=11 if actp3`i'==411 | actp3`i'==412 | actp3`i'==413 | actp3`i'==414 | actp3`i'==415 | actp3`i'==416 | actp3`i'==421 | /// actp3`i'==422 | actp3`i'==423 | actp3`i'==424 | actp3`i'==425 | actp3`i'==577 replace avx`i'=13 if actp3`i'==121 | actp3`i'==122 | actp3`i'==171 | actp3`i'==172 replace avx`i'=14 if actp3`i'==123 | actp3`i'==124 | actp3`i'==125 | actp3`i'==131 | actp3`i'==132 | actp3`i'==133 | actp3`i'==134 replace avx`i'=15 if (actp3`i'>=141 & actp3`i'<=149) & lugar2`i'!=81 replace avx`i'=16 if actp3`i'==111 | actp3`i'==112 | actp3`i'==113 | actp3`i'==114 replace avx`i'=18 if actp3`i'==622 | actp3`i'==623 | actp3`i'==735 | actp3`i'==738 replace avx`i'=19 if actp3`i'==611 | actp3`i'==612 | actp3`i'==613 | actp3`i'==614 | actp3`i'==615 | actp3`i'==626 | actp3`i'==752 replace avx`i'=20 if actp3`i'==731 replace avx`i'=21 if actp3`i'==624 replace avx`i'=22 if actp3`i'==531 | actp3`i'==532 | actp3`i'==533 | actp3`i'==534 replace avx`i'=23 if actp3`i'==541 | actp3`i'==543 | actp3`i'==544 | actp3`i'==545 | actp3`i'==549 | /// (actp3`i'>=551 & actp3`i'<=559) | (actp3`i'>=561 & actp3`i'<=569) | actp3`i'==911 replace avx`i'=24 if actp3`i'==732 | actp3`i'==733 | actp3`i'==734 | actp3`i'==736 | actp3`i'==737 | actp3`i'==739 replace avx`i'=25 if actp3`i'==261 | actp3`i'==513 | actp3`i'==514 | actp3`i'==515 | actp3`i'==546 replace avx`i'=27 if actp3`i'==516 | actp3`i'==517 replace avx`i'=28 if (actp3`i'>=141 & actp3`i'<=149) & lugar2`i'==81 replace avx`i'=29 if actp3`i'==511 | gifts`i'==29 replace avx`i'=30 if actp3`i'==716 replace avx`i'=31 if actp3`i'==714 | actp3`i'==715 | actp3`i'==718 | actp3`i'==719 replace avx`i'=32 if actp3`i'==717 replace avx`i'=33 if actp3`i'==243 | actp3`i'==244 | actp3`i'==252 | actp3`i'==268 | actp3`i'==635 replace avx`i'=34 if actp3`i'==712 replace avx`i'=35 if actp3`i'==642 | actp3`i'==711 | actp3`i'==713 replace avx`i'=36 if actp3`i'==721 | actp3`i'==722 | actp3`i'==625 replace avx`i'=37 if actp3`i'==521 | actp3`i'==522 | actp3`i'==524 | actp3`i'==526 | actp3`i'==529 replace avx`i'=38 if actp3`i'==512 | gifts`i'==38 replace avx`i'=39 if actp3`i'==371 replace avx`i'=40 if actp3`i'==523 | actp3`i'==742 | actp3`i'==743 | actp3`i'==744 | actp3`i'==746 | actp3`i'==631 | actp3`i'==632 | /// actp3`i'==633 | actp3`i'==634 | actp3`i'==641 | actp3`i'==643 | actp3`i'==646 | actp3`i'==648 | actp3`i'==649 | actp3`i'==751 | actp3`i'==753 | /// actp3`i'==754 | actp3`i'==755 | actp3`i'==756 | actp3`i'==759 | gifts`i'==40 replace avx`i'=41 if actp3`i'==921 | actp3`i'==922 } forval i= 1/76 { replace avx`i'=5 if ((actp3`i'>=811 & actp3`i'<=819) & /// (lugar2`i'==21 | actp3`i'==211 | actp3`i'==214 | actp3`i'==231 | actp3`i'==232 | actp3`i'==241 | actp3`i'==246)) } forval i= 1/75 { local j=`i'+1 replace avx`i'=5 if (actp3`i'>=811 & actp3`i'<=819) & /// (lugar2`j'==21 | actp3`j'==211 | actp3`j'==214 | actp3`j'==231 | actp3`j'==232 | actp3`j'==241 | actp3`j'==246) } forval i= 2/76 { local h=`i'-1 replace avx`i'=5 if (actp3`i'>=811 & actp3`i'<=819) & /// (lugar2`h'==21 | actp3`h'==211 | actp3`h'==214 | actp3`h'==231 | actp3`h'==232 | actp3`h'==241 | actp3`h'==246) } forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace avx`i'=12 if (actp3`i'>=811 & actp3`i'<=819) /// & (lugar2`i'!=21 & actp3`i'!=211 & actp3`i'!=214 & actp3`i'!=231 & actp3`i'!=232 & actp3`i'!=241 & actp3`i'!=246 /// & lugar2`j'!=21 & actp3`j'!=211 & actp3`j'!=214 & actp3`j'!=231 & actp3`j'!=232 & actp3`j'!=241 & actp3`j'!=246 /// & lugar2`h'!=21 & actp3`h'!=211 & actp3`h'!=214 & actp3`h'!=231 & actp3`h'!=232 & actp3`h'!=241 & actp3`h'!=246 /// & (final`i'>=3 & final`i'<=6)) } replace avx1=12 if (actp31>=811 & actp31<=819) /// & (lugar21!=21 & actp31!=211 & actp31!=214 & actp31!=231 & actp31!=232 & actp31!=241 & actp31!=246 & (final1>=3 & final1<=6)) replace avx76=12 if (actp376>=811 & actp376<=819) /// & (lugar276!=21 & actp376!=211 & actp376!=214 & actp376!=231 & actp376!=232 & actp376!=241 & actp376!=246 & (final76>=3 & final76<=6)) forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace avx`i'=17 if actp3`i'==621 | actp3`i'==842 | actp3`i'==843 | ((actp3`i'>=811 & actp3`i'<=819) /// & (lugar2`i'!=21 & actp3`i'!=211 & actp3`i'!=214 & actp3`i'!=231 & actp3`i'!=232 & actp3`i'!=241 & actp3`i'!=246 /// & lugar2`j'!=21 & actp3`j'!=211 & actp3`j'!=214 & actp3`j'!=231 & actp3`j'!=232 & actp3`j'!=241 & actp3`j'!=246 /// & lugar2`h'!=21 & actp3`h'!=211 & actp3`h'!=214 & actp3`h'!=231 & actp3`h'!=232 & actp3`h'!=241 & actp3`h'!=246 /// & final`i'!=1 & final`i'!=2 & final`i'!=3 & final`i'!=4 & final`i'!=5 & final`i'!=6)) } replace avx1=17 if actp31==621 | actp31==842 | actp31==843 | ((actp31>=811 & actp31<=819) /// & (lugar21!=21 & actp31!=211 & actp31!=214 & actp31!=231 & actp31!=232 & actp31!=241 & actp31!=246 /// & final1!=1 & final1!=2 & final1!=3 & final1!=4 & final1!=5 & final1!=6)) replace avx76=17 if actp376==621 | actp376==842 | actp376==843 | ((actp376>=811 & actp376<=819) /// & (lugar276!=21 & actp376!=211 & actp376!=214 & actp376!=231 & actp376!=232 & actp376!=241 & actp376!=246 /// & final76!=1 & final76!=2 & final76!=3 & final76!=4 & final76!=5 & final76!=6)) *MAIN W6 ******** forval i= 1/76 { replace mainx`i'=2 if actp3`i'==111 | actp3`i'==112 | actp3`i'==113 | actp3`i'==114 replace mainx`i'=4 if actp3`i'==121 | actp3`i'==122 | actp3`i'==171 | actp3`i'==172 replace mainx`i'=5 if (actp3`i'>=141 & actp3`i'<=149) & (lugar2`i'==21 | lugar2`i'==22) replace mainx`i'=6 if (actp3`i'>=141 & actp3`i'<=149) & (lugar2`i'!=21 & lugar2`i'!=22 & lugar2`i'!=81) replace mainx`i'=7 if (actp3`i'==211 | actp3`i'==241) & /// (lugar2`i'!=11 & lugar2`i'!=12 & lugar2`i'!=13 & lugar2`i'!=14 & lugar2`i'!=15 /// & lugar2`i'!=16 & lugar2`i'!=17 & lugar2`i'!=18 & lugar2`i'!=31 & lugar2`i'!=91) replace mainx`i'=8 if ((actp3`i'==211 | actp3`i'==241) & /// ((lugar2`i'>=11 & lugar2`i'<=18) | lugar2`i'==31 | lugar2`i'==91)) | actp3`i'==212 | actp3`i'==364 replace mainx`i'=9 if actp3`i'==221 | actp3`i'==225 | actp3`i'==247 replace mainx`i'=11 if actp3`i'==213 | actp3`i'==223 replace mainx`i'=12 if actp3`i'==214 | actp3`i'==231 replace mainx`i'=13 if actp3`i'==224 | actp3`i'==232 | actp3`i'==246 replace mainx`i'=14 if actp3`i'==363 replace mainx`i'=15 if actp3`i'==251 | actp3`i'==253 | actp3`i'==254 replace mainx`i'=16 if actp3`i'==243 | actp3`i'==244 | actp3`i'==252 | actp3`i'==268 | actp3`i'==635 replace mainx`i'=17 if actp3`i'==242 | actp3`i'==245 | (actp3`i'>=261 & actp3`i'<=267) | actp3`i'==269 replace mainx`i'=18 if actp3`i'==311 | actp3`i'==312 | actp3`i'==315 | actp3`i'==316 | actp3`i'==317 replace mainx`i'=19 if actp3`i'==313 | actp3`i'==314 replace mainx`i'=20 if actp3`i'==321 | actp3`i'==322 | actp3`i'==323 | actp3`i'==341 replace mainx`i'=21 if actp3`i'==331 | actp3`i'==332 | actp3`i'==333 | actp3`i'==334 replace mainx`i'=22 if actp3`i'==324 | actp3`i'==342 | actp3`i'==343 | actp3`i'==346 | actp3`i'==372 | actp3`i'==373 /// | actp3`i'==374 | actp3`i'==375 | actp3`i'==376 | actp3`i'==636 | actp3`i'==639 replace mainx`i'=23 if actp3`i'==344 | actp3`i'==345 | actp3`i'==347 | actp3`i'==348 | actp3`i'==349 | actp3`i'==644 replace mainx`i'=24 if actp3`i'==351 | actp3`i'==352 | actp3`i'==353 | actp3`i'==355 | actp3`i'==356 /// | actp3`i'==357 | actp3`i'==358 | actp3`i'==647 replace mainx`i'=25 if actp3`i'==123 | actp3`i'==124 | actp3`i'==125 | actp3`i'==131 | actp3`i'==132 /// | actp3`i'==133 | actp3`i'==134 replace mainx`i'=26 if actp3`i'==354 | actp3`i'==359 | actp3`i'==361 | actp3`i'==362 | actp3`i'==645 replace mainx`i'=27 if actp3`i'==378 replace mainx`i'=28 if actp3`i'==411 | actp3`i'==412 | actp3`i'==413 | actp3`i'==414 | actp3`i'==577 replace mainx`i'=29 if actp3`i'==421 replace mainx`i'=30 if actp3`i'==422 | actp3`i'==423 | actp3`i'==424 replace mainx`i'=31 if actp3`i'==415 | actp3`i'==416 | actp3`i'==425 replace mainx`i'=32 if actp3`i'==431 | actp3`i'==432 | actp3`i'==433 | (actp3`i'>=571 & actp3`i'<=576) | actp3`i'==578 | actp3`i'==579 replace mainx`i'=33 if actp3`i'==541 | actp3`i'==543 | actp3`i'==544 | actp3`i'==545 | actp3`i'==549 | /// (actp3`i'>=551 & actp3`i'<=559) | (actp3`i'>=561 & actp3`i'<=569) | actp3`i'==911 replace mainx`i'=34 if actp3`i'==531 | actp3`i'==532 | actp3`i'==533 | actp3`i'==534 replace mainx`i'=36 if actp3`i'==731 replace mainx`i'=37 if actp3`i'==733 | actp3`i'==734 | actp3`i'==736 | actp3`i'==737 | actp3`i'==739 replace mainx`i'=38 if actp3`i'==622 | actp3`i'==623 | actp3`i'==732 | actp3`i'==735 | actp3`i'==738 replace mainx`i'=39 if actp3`i'==516 | actp3`i'==517 | ((actp3`i'>=141 & actp3`i'<=149) & lugar2`i'==81) replace mainx`i'=40 if actp3`i'==744 | gifts`i'==40 | actp3`i'==513 | actp3`i'==514 | actp3`i'==515 | actp3`i'==546 replace mainx`i'=41 if actp3`i'==922 replace mainx`i'=42 if actp3`i'==611 | actp3`i'==612 | actp3`i'==613 | actp3`i'==614 | actp3`i'==615 | actp3`i'==752 replace mainx`i'=43 if actp3`i'==624 replace mainx`i'=46 if actp3`i'==377 | actp3`i'==626 | actp3`i'==627 replace mainx`i'=48 if actp3`i'==511 | actp3`i'==512 | actp3`i'==524 | gifts`i'==38 | gifts`i'==29 replace mainx`i'=49 if actp3`i'==521 | actp3`i'==522 | actp3`i'==526 | actp3`i'==529 replace mainx`i'=50 if actp3`i'==742 | actp3`i'==743 | actp3`i'==746 replace mainx`i'=52 if actp3`i'==751 | actp3`i'==753 | actp3`i'==755 replace mainx`i'=53 if actp3`i'==523 replace mainx`i'=54 if actp3`i'==371 | actp3`i'==631 | actp3`i'==754 | actp3`i'==756 | actp3`i'==759 replace mainx`i'=55 if actp3`i'==625 | actp3`i'==721 | actp3`i'==722 replace mainx`i'=56 if actp3`i'==642 | actp3`i'==711 | actp3`i'==712 | actp3`i'==713 replace mainx`i'=57 if actp3`i'==717 replace mainx`i'=58 if actp3`i'==716 replace mainx`i'=59 if actp3`i'==714 | actp3`i'==715 | actp3`i'==718 | actp3`i'==719 replace mainx`i'=60 if actp3`i'==634 | actp3`i'==648 replace mainx`i'=61 if actp3`i'==632 | actp3`i'==633 | actp3`i'==641 | actp3`i'==643 | actp3`i'==646 | actp3`i'==649 replace mainx`i'=63 if actp3`i'==841 | ((actp3`i'>=811 & actp3`i'<=819) & (final`i'==1 | lugar2`i'==21 /// | actp3`i'==211 | actp3`i'==214 | actp3`i'==231 | actp3`i'==232 | actp3`i'==241 | actp3`i'==246)) replace mainx`i'=69 if actp3`i'==921 } forval i= 1/75 { local j=`i'+1 replace mainx`i'=63 if (actp3`i'>=811 & actp3`i'<=819) & (lugar2`j'==21 | actp3`j'==211 | actp3`j'==214 | actp3`j'==231 | actp3`j'==232 | actp3`j'==241 | actp3`j'==246) } forval i= 2/76 { local h=`i'-1 replace mainx`i'=63 if (actp3`i'>=811 & actp3`i'<=819) & (lugar2`h'==21 | actp3`h'==211 | actp3`h'==214 | actp3`h'==231 | actp3`h'==232 | actp3`h'==241 | actp3`h'==246) } forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace mainx`i'=68 if actp3`i'==621 | actp3`i'==842 | actp3`i'==843 | ((actp3`i'>=811 & actp3`i'<=819) & (final`i'!=1 /// & lugar2`i'!=21 & actp3`i'!=211 & actp3`i'!=214 & actp3`i'!=231 & actp3`i'!=232 & actp3`i'!=241 & actp3`i'!=246 /// & lugar2`j'!=21 & actp3`j'!=211 & actp3`j'!=214 & actp3`j'!=231 & actp3`j'!=232 & actp3`j'!=241 & actp3`j'!=246 /// & lugar2`h'!=21 & actp3`h'!=211 & actp3`h'!=214 & actp3`h'!=231 & actp3`h'!=232 & actp3`h'!=241 & actp3`h'!=246)) } replace mainx1=68 if actp31==621 | actp31==842 | actp31==843 | ((actp31>=811 & actp31<=819) & (final1!=1 /// & lugar21!=21 & actp31!=211 & actp31!=214 & actp31!=231 & actp31!=232 & actp31!=241 & actp31!=246)) replace mainx76=68 if actp376==621 | actp376==842 | actp376==843 | ((actp376>=811 & actp376<=819) & (final76!=1 /// & lugar276!=21 & actp376!=211 & actp376!=214 & actp376!=231 & actp376!=232 & actp376!=241 & actp376!=246)) *SEC W6 ******* forval i= 1/76 { replace secx`i'=2 if acts3`i'==111 | acts3`i'==112 | acts3`i'==113 | acts3`i'==114 replace secx`i'=4 if acts3`i'==121 | acts3`i'==122 | acts3`i'==171 | acts3`i'==172 replace secx`i'=5 if (acts3`i'>=141 & acts3`i'<=149) & (lugar2`i'==21 | lugar2`i'==22) replace secx`i'=6 if (acts3`i'>=141 & acts3`i'<=149) & (lugar2`i'!=21 & lugar2`i'!=22 & lugar2`i'!=81) replace secx`i'=7 if acts3`i'==211 | acts3`i'==241 replace secx`i'=8 if acts3`i'==212 | acts3`i'==364 replace secx`i'=9 if acts3`i'==221 | acts3`i'==225 | acts3`i'==247 replace secx`i'=11 if acts3`i'==213 | acts3`i'==223 replace secx`i'=12 if acts3`i'==214 | acts3`i'==231 replace secx`i'=13 if acts3`i'==224 | acts3`i'==232 | acts3`i'==246 replace secx`i'=14 if acts3`i'==363 replace secx`i'=15 if acts3`i'==251 | acts3`i'==253 | acts3`i'==254 replace secx`i'=16 if acts3`i'==243 | acts3`i'==244 | acts3`i'==252 | acts3`i'==268 | acts3`i'==635 replace secx`i'=17 if acts3`i'==242 | acts3`i'==245 | (acts3`i'>=261 & acts3`i'<=267) | acts3`i'==269 replace secx`i'=18 if acts3`i'==311 | acts3`i'==312 | acts3`i'==315 | acts3`i'==316 | acts3`i'==317 replace secx`i'=19 if acts3`i'==313 | acts3`i'==314 replace secx`i'=20 if acts3`i'==321 | acts3`i'==322 | acts3`i'==323 | acts3`i'==341 replace secx`i'=21 if acts3`i'==331 | acts3`i'==332 | acts3`i'==333 | acts3`i'==334 replace secx`i'=22 if acts3`i'==324 | acts3`i'==342 | acts3`i'==343 | acts3`i'==346 | acts3`i'==372 | acts3`i'==373 /// | acts3`i'==374 | acts3`i'==375 | acts3`i'==376 | acts3`i'==636 | actp3`i'==639 replace secx`i'=23 if acts3`i'==344 | acts3`i'==345 | acts3`i'==347 | acts3`i'==348 | acts3`i'==349 | acts3`i'==644 replace secx`i'=24 if acts3`i'==351 | acts3`i'==352 | acts3`i'==353 | acts3`i'==355 | acts3`i'==356 /// | acts3`i'==357 | acts3`i'==358 | acts3`i'==647 replace secx`i'=25 if acts3`i'==123 | acts3`i'==124 | acts3`i'==125 | acts3`i'==131 | acts3`i'==132 /// | acts3`i'==133 | acts3`i'==134 replace secx`i'=26 if acts3`i'==354 | acts3`i'==359 | acts3`i'==361 | acts3`i'==362 | acts3`i'==645 replace secx`i'=27 if acts3`i'==378 replace secx`i'=28 if acts3`i'==411 | acts3`i'==412 | acts3`i'==413 | acts3`i'==414 | acts3`i'==577 replace secx`i'=29 if acts3`i'==421 replace secx`i'=30 if acts3`i'==422 | acts3`i'==423 | acts3`i'==424 replace secx`i'=31 if acts3`i'==415 | acts3`i'==416 | acts3`i'==425 replace secx`i'=32 if acts3`i'==431 | acts3`i'==432 | acts3`i'==433 | (acts3`i'>=571 & acts3`i'<=576) | acts3`i'==578 | acts3`i'==579 replace secx`i'=33 if acts3`i'==541 | acts3`i'==543 | acts3`i'==544 | acts3`i'==545 | acts3`i'==549 | /// (acts3`i'>=551 & acts3`i'<=559) | (acts3`i'>=561 & acts3`i'<=569) | acts3`i'==911 replace secx`i'=34 if acts3`i'==531 | acts3`i'==532 | acts3`i'==533 | acts3`i'==534 replace secx`i'=36 if acts3`i'==731 replace secx`i'=37 if acts3`i'==733 | acts3`i'==734 | acts3`i'==736 | acts3`i'==737 | acts3`i'==739 replace secx`i'=38 if acts3`i'==622 | acts3`i'==623 | acts3`i'==732 | acts3`i'==735 | acts3`i'==738 replace secx`i'=39 if acts3`i'==516 | acts3`i'==517 | ((acts3`i'>=141 & acts3`i'<=149) & lugar2`i'==81) replace secx`i'=40 if acts3`i'==744 | gifts`i'==40 | acts3`i'==513 | acts3`i'==514 | acts3`i'==515 | acts3`i'==546 replace secx`i'=42 if acts3`i'==611 | acts3`i'==612 | acts3`i'==613 | acts3`i'==614 | acts3`i'==615 | acts3`i'==752 replace secx`i'=43 if acts3`i'==624 replace secx`i'=46 if acts3`i'==377 | acts3`i'==626 | acts3`i'==627 replace secx`i'=48 if acts3`i'==511 | acts3`i'==512 | acts3`i'==524 | gifts`i'==38 | gifts`i'==29 replace secx`i'=49 if acts3`i'==521 | acts3`i'==522 | acts3`i'==526 | acts3`i'==529 replace secx`i'=50 if acts3`i'==742 | acts3`i'==743 | acts3`i'==746 replace secx`i'=52 if acts3`i'==751 | acts3`i'==753 | acts3`i'==755 replace secx`i'=53 if acts3`i'==523 replace secx`i'=54 if acts3`i'==371 | acts3`i'==631 | acts3`i'==754 | acts3`i'==756 | acts3`i'==759 replace secx`i'=55 if acts3`i'==625 | acts3`i'==721 | acts3`i'==722 replace secx`i'=56 if acts3`i'==642 | acts3`i'==711 | acts3`i'==712 | acts3`i'==713 replace secx`i'=57 if acts3`i'==717 replace secx`i'=58 if acts3`i'==716 replace secx`i'=59 if acts3`i'==714 | acts3`i'==715 | acts3`i'==718 | acts3`i'==719 replace secx`i'=60 if acts3`i'==634 | acts3`i'==648 replace secx`i'=61 if acts3`i'==632 | acts3`i'==633 | acts3`i'==641 | acts3`i'==643 | acts3`i'==646 | acts3`i'==649 replace secx`i'=63 if acts3`i'==841 | ((acts3`i'>=811 & acts3`i'<=819) & final`i'==1) replace secx`i'=63 if acts3`i'==841 | ((acts3`i'>=811 & acts3`i'<=819) & (final`i'==1 | lugar2`i'==21 /// | acts3`i'==211 | acts3`i'==214 | acts3`i'==231 | acts3`i'==232 | acts3`i'==241 | acts3`i'==246)) replace secx`i'=69 if acts3`i'==921 } forval i= 1/75 { local j=`i'+1 replace secx`i'=63 if (acts3`i'>=811 & acts3`i'<=819) & (lugar2`j'==21 | acts3`j'==211 | acts3`j'==214 | acts3`j'==231 | acts3`j'==232 | acts3`j'==241 | acts3`j'==246) } forval i= 2/76 { local h=`i'-1 replace secx`i'=63 if (acts3`i'>=811 & acts3`i'<=819) & (lugar2`h'==21 | acts3`h'==211 | acts3`h'==214 | acts3`h'==231 | acts3`h'==232 | acts3`h'==241 | acts3`h'==246) } forval i= 2/75 { local j=`i'+1 local h=`i'-1 replace secx`i'=68 if acts3`i'==621 | acts3`i'==842 | acts3`i'==843 | ((acts3`i'>=811 & acts3`i'<=819) & (final`i'!=1 /// & lugar2`i'!=21 & acts3`i'!=211 & acts3`i'!=214 & acts3`i'!=231 & acts3`i'!=232 & acts3`i'!=241 & acts3`i'!=246 /// & lugar2`j'!=21 & acts3`j'!=211 & acts3`j'!=214 & acts3`j'!=231 & acts3`j'!=232 & acts3`j'!=241 & acts3`j'!=246 /// & lugar2`h'!=21 & acts3`h'!=211 & acts3`h'!=214 & acts3`h'!=231 & acts3`h'!=232 & acts3`h'!=241 & acts3`h'!=246)) } replace secx1=68 if acts31==621 | acts31==842 | acts31==843 | ((acts31>=811 & acts31<=819) & (final1!=1 /// & lugar21!=21 & acts31!=211 & acts31!=214 & acts31!=231 & acts31!=232 & acts31!=241 & acts31!=246)) replace secx76=68 if acts376==621 | acts376==842 | acts376==843 | ((acts376>=811 & acts376<=819) & (final76!=1 /// & lugar276!=21 & acts376!=211 & acts376!=214 & acts376!=231 & acts376!=232 & acts376!=241 & acts376!=246)) * CDAY * gen cday=-9 compress * RESHAPE TO LONG FORMAT keep countrya survey swave msamp hldid persid id day cday month year diary badcase sex /// age hinic* minic* hfin* mfin* mainx* avx* secx* lugar2* actp3* comp* duram* final* reshape long hinic minic hfin mfin mainx avx secx lugar2 actp3 comp duram final, i(hldid) j(epnum) drop if hinic==. * START * gen start=(hinic*60)+minic replace start=1 if start==0 * END * gen end=(hfin*60)+mfin * TIME * generate time=duram * CLOCKST * gen clockst=((hinic*100)+minic)*0.01 format clockst %12.2f * MAIN * rename mainx main * SEC* rename secx sec * AV * rename avx av * INOUT * generate inout=-8 replace inout=1 if (lugar2>=11 & lugar2<=19) | lugar2==21 | lugar2==22 | lugar2==51 | lugar2==61 | lugar2==81 | lugar2==91 replace inout=2 if lugar2==31 | lugar2==41 | lugar2==71 replace inout=3 if actp3==213 | actp3==223 | actp3==261 | actp3==621 | actp3==812 | (actp3>=814 & actp3<=819) | actp3==841 | (final>=0 & final<=9) replace inout=1 if actp3==321 | actp3==322 | actp3==323 | actp3==548 replace inout=2 if actp3==217 | actp3==341 | actp3==377 | actp3==424 | actp3==624 | actp3==625 | actp3==626 /// | actp3==627 | actp3==811 | actp3==813 * ELOC * generate eloc=-8 replace eloc=1 if (lugar2>=11 & lugar2<=18) | lugar2==31 | lugar2==91 replace eloc=2 if lugar2==19 replace eloc=3 if lugar2==21 replace eloc=4 if lugar2==22 replace eloc=5 if lugar2==51 & actp3!=531 & actp3!=532 & actp3!=533 & actp3!=534 replace eloc=6 if lugar2==81 replace eloc=7 if (lugar2==51 | lugar2==61) & (actp3==531 | actp3==532 | actp3==533 | actp3==534) replace eloc=9 if (lugar2==61 & actp3!=531 & actp3!=532 & actp3!=533 & actp3!=534) | lugar2==41 | lugar2==71 replace eloc=1 if eloc==-8 & (actp3==123 | actp3==124 | actp3==125 | actp3==131 | actp3==134 | actp3==212 | actp3==364 | /// actp3==372 | actp3==414 | actp3==512 | actp3==524 | actp3==921) replace eloc=2 if eloc==-8 & actp3==511 replace eloc=3 if eloc==-8 & actp3==224 replace eloc=4 if eloc==-8 & (actp3==251 | actp3==253) replace eloc=5 if eloc==-8 & (actp3==132 | actp3==133 | actp3==413) replace eloc=6 if eloc==-8 & (actp3==516 | actp3==517) replace eloc=8 if actp3==213 | actp3==223 | actp3==261 | actp3==621 | actp3==624 | (actp3>=811 & actp3<=819) | /// (actp3>=841 & actp3<=843) | (final>=0 & final<=9) replace eloc=9 if eloc==-8 & (actp3==359 | actp3==922) * ICT * gen ict=0 replace ict=1 if actp3==266 | actp3==526 | actp3==529 | actp3==632 | actp3==633 | actp3==634 | /// actp3==639 | actp3==641 | actp3==642 | actp3==643 | actp3==646 | actp3==647 | actp3==648 | actp3==649 * MTRAV * gen mtrav=-7 replace mtrav=1 if actp3==261 | actp3==621 | actp3==812 replace mtrav=2 if (actp3>=814 & actp3<=818) replace mtrav=3 if actp3==624 | actp3==811 replace mtrav=4 if actp3==813 replace mtrav=5 if actp3==213 | actp3==223 | actp3==819 | actp3==841 | actp3==842 | actp3==843 | (final>=0 & final<=9) * ALONE * generate alone=0 replace alone=1 if comp==0 * CHILD * generate child=0 replace child=1 if comp==2 | comp==7 | comp==9 | (comp>=20 & comp<=29) | comp==32 | comp==37 | comp==42 | comp==47 | /// comp==52 | comp==57 | comp==62 | comp==67 | (comp>=70 & comp<=79) | comp==82 | comp==87 | (comp>=90 & comp<=99) * SPPART * generate sppart=0 replace sppart=1 if comp==1 | (comp>=9 & comp<=19) | (comp>=90 & comp<=99) * OAD * gen oad=0 replace oad=1 if (comp>=1 & comp<=19 & comp!=2 & comp!=7 & comp!=12) | comp==21 | comp==23 | comp==26 | comp==28 | (comp>=30 & comp<=69) | /// comp==71 | (comp>=73 & comp<=99) compress save "/Users/LK/Documents/Time Use/TUSPB_2003templong.dta", replace ** WE NOW SAVE THE W5 DATASETS ****************************** * W6 * keep countrya survey swave msamp hldid persid id day cday month year diary badcase sex age time /// clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad order countrya survey swave msamp hldid persid id day cday month year diary badcase sex age time /// clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad sort swave msamp hldid persid id drop if age<18 save "/Users/LK/Documents/Time Use/SPA2003W6.dta", replace * W6KID * use "/Users/LK/Documents/Time Use/TUSPB_2003templong.dta", clear keep countrya survey swave msamp hldid persid id day cday month year diary badcase sex age time /// clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad order countrya survey swave msamp hldid persid id day cday month year diary badcase sex age time /// clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad sort swave msamp hldid persid id drop if age>=18 save "/Users/LK/Documents/Time Use/SPA2003W6kid.dta", replace *delete temporary files erase "/Users/LK/Documents/Time Use/TUSPB_2003templong.dta" erase "/Users/LK/Documents/Time Use/TUSPB_2003temp.dta"