********************************* *Conversion of France 1985-86 * *updated and revised CTUR * *May 2015 * ********************************* ** Syntax to create the MTUS World 5.3, 5.8 and 6 files for Basque Country (Spain) 2009. ** Cleaning the workspace and extending the size of the memory clear all set linesize 80 cd "C:\Users\Joo Yeoun Suh\Documents\CTUR\MTUS\Spain\Spain 2009\Work in progress" set more off use diario2.dta gen id_temp=(idhogar*100)+npers sum id_temp reshape wide idhogar npers trim ddiasem aprin ap_int asecu as_int /// lugar solo pareja padres menor otmh otcon factorf, i(id_temp) j(intervalo) set more off compress save diario2_wide_temp.dta, replace gen idh=idhogar1 drop idho* gen idhogar=idh drop idh gen npe=npers1 drop nper* gen npers=npe drop npe sort idhogar npers merge 1:1 idhogar npers using mhogar.dta sort idhogar npers compress tab _merge drop _merge merge m:1 idhogar using dhogar.dta sort idhogar npers compress drop _merge drop if id_temp==. drop id_temp merge m:1 idhogar npers using cindiv.dta sort idhogar npers drop _merge compress save ES2009_merge_temp1.dta, replace merge 1:m idhogar npers using htr2.dta sort idhogar npers compress keep if ddiasem1==ht_diasemana keep idhogar npers t1-t96 order idhogar npers merge 1:1 idhogar npers using ES2009_merge_temp1.dta sort idhogar npers drop _merge save ES2009_merge_temp2.dta, replace use mhogar.dta keep idhogar npers edad merge 1:1 idhogar npers using ES2009_merge_temp2.dta compress gen unique=(idhogar*100)+npers drop _merge save ES2009_merge_temp3.dta, replace keep unique lugar* aprin* asecu* solo* pareja* padres* menor* otmh* otcon* reshape long lugar aprin asecu solo pareja padres menor otmh otcon, i(unique) j(epnum) sort unique epnum gen diff=0 replace diff=1 if (aprin!=aprin[_n+1]) & unique[_n+1]==unique replace diff=1 if (asecu!=asecu[_n+1]) & unique[_n+1]==unique replace diff=1 if (lugar!=lugar[_n+1]) & unique[_n+1]==unique replace diff=1 if (solo!=solo[_n+1]) & unique[_n+1]==unique replace diff=1 if (pareja!= pareja[_n+1]) & unique[_n+1]==unique replace diff=1 if (padres!=padres[_n+1]) & unique[_n+1]==unique replace diff=1 if (menor!= menor[_n+1]) & unique[_n+1]==unique replace diff=1 if (otmh!=otmh[_n+1]) & unique[_n+1]==unique replace diff=1 if (otcon!=otcon[_n+1]) & unique[_n+1]==unique replace diff=1 if epnum==144 keep if diff==1 gen epnum_new=0 replace epnum_new=1 if unique[_n-1]!=unique replace epnum_new=epnum_new[_n-1]+1 if unique[_n-1]==unique gen start_minute_new=0 if epnum_new==1 gen end_minute_new=epnum*10 replace start_minute_new=end_minute_new[_n-1] if unique[_n-1]==unique gen lenght_minute_new=end_minute_new-start_minute_new gen lugar_new=lugar gen aprin_new=aprin gen asecu_new=asecu gen solo_new=solo gen pareja_new=pareja gen padres_new=padres gen menor_new=menor gen otmh_new=otmh gen otcon_new=otcon label drop intervalo keep unique *new compress reshape wide start_minute_new end_minute_new lenght_minute_new lugar_new aprin_new /// asecu_new solo_new pareja_new padres_new menor_new otmh_new otcon_new, i(unique) j(epnum_new) save ES2009_merge_temp4.dta, replace merge 1:1 unique using ES2009_merge_temp3.dta drop _merge compress save ES2009_merge_temp5.dta, replace use ES2009_merge_temp5.dta, clear replace nmh=2 if nmh==1 & (ecivil==2 | viv_pareja==1) gsort idhogar -tipohog replace tipohog=tipohog[_n-1] if tipohog==. & tipohog[_n-1]!=. & idhogar==idhogar[_n-1] replace trabajo=6 if edad<16 sort idhogar npers *fix certain errors with the household matrix replace matriz_3 = 2 if idhogar==1056 & npers==2 replace matriz_2 = 2 if idhogar==5319 & npers==1 replace matriz_3 = 2 if idhogar==5319 & npers==1 replace matriz_2 = 1 in 4 replace matriz_3 = 1 in 5 replace matriz_3 = . in 5 replace matriz_3 = 2 in 4 replace matriz_3 = 2 in 5 replace matriz_2 = 1 in 16 replace matriz_3 = 2 in 16 replace matriz_4 = 2 in 16 replace matriz_3 = 2 in 17 replace matriz_4 = 2 in 17 replace matriz_4 = . in 16 replace matriz_4 = . in 17 replace matriz_2 = 1 in 70 replace matriz_2 = 1 in 72 replace matriz_2 = 1 in 183 replace matriz_3 = 2 in 183 replace matriz_4 = 2 in 183 replace matriz_5 = 2 in 183 replace matriz_2 = 1 in 406 replace matriz_3 = 2 in 406 replace matriz_2 = 1 in 409 replace matriz_3 = 2 in 409 replace matriz_4 = 2 in 409 replace matriz_2 = 1 in 413 replace matriz_2 = 1 in 416 replace matriz_3 = 2 in 416 replace matriz_2 = 1 in 428 replace matriz_3 = 2 in 428 replace matriz_4 = 2 in 428 replace matriz_2 = 1 in 440 replace matriz_3 = 2 in 440 replace matriz_4 = 2 in 440 replace matriz_2 = 1 in 487 replace matriz_3 = 2 in 487 replace matriz_4 = 2 in 487 replace matriz_2 = 1 in 545 replace matriz_3 = 2 in 545 replace matriz_2 = 1 in 551 replace matriz_3 = 2 in 551 replace matriz_4 = 2 in 551 replace matriz_2 = 1 in 561 replace matriz_3 = 2 in 561 replace matriz_4 = 2 in 561 replace matriz_5 = 2 in 561 replace matriz_2 = 1 in 566 replace matriz_2 = 1 in 717 replace matriz_3 = 2 in 717 replace matriz_4 = 2 in 717 replace matriz_2 = 1 in 726 replace matriz_3 = 2 in 726 replace matriz_2 = 1 in 732 replace matriz_3 = 2 in 732 replace matriz_2 = 1 in 735 replace matriz_2 = 1 in 737 replace matriz_2 = 1 in 739 replace matriz_3 = 2 in 739 replace matriz_4 = 2 in 739 replace matriz_2 = 1 in 744 replace matriz_3 = 2 in 744 replace matriz_2 = 1 in 756 replace matriz_3 = 2 in 756 replace matriz_4 = 2 in 756 replace matriz_2 = 1 in 769 replace matriz_2 = . in 769 replace matriz_2 = . in 786 replace matriz_2 = 1 in 823 replace matriz_3 = 2 in 823 replace matriz_4 = 2 in 823 replace matriz_5 = 2 in 823 replace matriz_6 = 2 in 823 replace matriz_7 = 2 in 823 replace matriz_2 = 1 in 852 replace matriz_3 = 2 in 852 replace matriz_4 = 2 in 852 replace matriz_2 = 1 in 868 replace matriz_2 = 1 in 963 replace matriz_3 = 2 in 963 replace matriz_4 = 2 in 963 replace matriz_2 = 1 in 967 replace matriz_2 = 1 in 975 replace matriz_2 = 1 in 977 replace matriz_3 = 2 in 977 replace matriz_2 = 1 in 988 replace matriz_3 = 2 in 988 replace matriz_2 = 1 in 1070 replace matriz_3 = 2 in 1070 replace matriz_2 = 1 in 1168 replace matriz_3 = 2 in 1168 replace matriz_4 = 2 in 1168 replace matriz_2 = 1 in 1181 replace matriz_2 = 1 in 1281 replace matriz_3 = 2 in 1281 replace matriz_4 = 2 in 1281 replace matriz_2 = 1 in 1975 replace matriz_2 = 1 in 2002 replace matriz_3 = 2 in 2002 replace matriz_2 = 1 in 2108 replace matriz_3 = 2 in 2108 replace matriz_4 = 2 in 2108 replace matriz_5 = 2 in 2108 replace matriz_3 = 2 in 2109 replace matriz_4 = 2 in 2109 replace matriz_5 = 2 in 2109 replace matriz_2 = 1 in 2124 replace matriz_3 = 2 in 2124 replace matriz_2 = 1 in 2191 replace matriz_3 = 2 in 2191 replace matriz_4 = 2 in 2191 replace matriz_2 = 1 in 2247 replace matriz_3 = 2 in 2247 replace matriz_4 = 2 in 2247 replace matriz_2 = 1 in 2304 replace matriz_2 = 1 in 2306 replace matriz_2 = 1 in 2348 replace matriz_3 = 2 in 2348 replace matriz_2 = 1 in 2381 replace matriz_2 = 1 in 2383 replace matriz_2 = 1 in 2390 replace matriz_3 = 2 in 2390 replace matriz_2 = 1 in 2452 replace matriz_3 = 2 in 2452 replace matriz_4 = 2 in 2452 replace matriz_2 = 1 in 2551 replace matriz_2 = 1 in 2576 replace matriz_2 = 1 in 2584 replace matriz_2 = 1 in 2588 replace matriz_3 = 2 in 2588 replace matriz_4 = 2 in 2588 replace matriz_2 = 1 in 2603 replace matriz_3 = 2 in 2603 replace matriz_4 = 2 in 2603 replace matriz_3 = 2 in 2604 replace matriz_4 = 2 in 2604 replace matriz_2 = 1 in 2617 replace matriz_3 = 2 in 2617 replace matriz_2 = 1 in 2656 replace matriz_2 = 1 in 2676 replace matriz_2 = 1 in 2693 replace matriz_3 = 2 in 2693 replace matriz_2 = 1 in 2696 replace matriz_3 = 2 in 2696 replace matriz_4 = 2 in 2696 replace matriz_2 = 1 in 2750 replace matriz_3 = 2 in 2750 replace matriz_4 = 2 in 2750 replace matriz_2 = 1 in 2924 replace matriz_3 = 2 in 2924 replace matriz_2 = 1 in 2945 replace matriz_3 = 2 in 2945 replace matriz_4 = 2 in 2945 replace matriz_3 = 2 in 2946 replace matriz_4 = 2 in 2946 replace matriz_2 = 1 in 3002 replace matriz_3 = 2 in 3002 replace matriz_2 = 1 in 3174 replace matriz_2 = 1 in 3180 replace matriz_3 = 2 in 3180 replace matriz_4 = 2 in 3180 replace matriz_2 = 1 in 3188 replace matriz_3 = 2 in 3188 replace matriz_2 = 1 in 3224 replace matriz_3 = 2 in 3224 replace matriz_4 = 2 in 3224 replace matriz_3 = 2 in 3225 replace matriz_4 = . in 3224 replace matriz_2 = 1 in 3285 replace matriz_3 = 2 in 3285 replace matriz_4 = 2 in 3285 replace matriz_2 = 1 in 3307 replace matriz_3 = 2 in 3307 replace matriz_3 = 2 in 3308 replace matriz_2 = 1 in 3543 replace matriz_2 = 1 in 3548 replace matriz_2 = 1 in 3622 replace matriz_2 = 1 in 3624 replace matriz_3 = 2 in 3624 replace matriz_3 = 2 in 3625 replace matriz_2 = 1 in 3632 replace matriz_2 = 1 in 3749 replace matriz_3 = 2 in 3749 replace matriz_2 = 1 in 3836 replace matriz_3 = 2 in 3836 replace matriz_4 = 2 in 3836 replace matriz_2 = 1 in 3872 replace matriz_2 = 1 in 3901 replace matriz_2 = 1 in 3907 replace matriz_3 = 2 in 3907 replace matriz_2 = 1 in 3923 replace matriz_3 = 2 in 3923 replace matriz_2 = 1 in 3958 replace matriz_3 = 2 in 3958 replace matriz_4 = 2 in 3958 replace matriz_2 = 1 in 4009 replace matriz_3 = 2 in 4009 replace matriz_4 = 2 in 4009 replace matriz_2 = 1 in 4055 replace matriz_3 = 2 in 4055 replace matriz_4 = 2 in 4055 replace matriz_2 = 1 in 4065 replace matriz_3 = 2 in 4065 replace matriz_2 = 1 in 4074 replace matriz_3 = 2 in 4074 replace matriz_2 = 1 in 4089 replace matriz_2 = 1 in 4149 replace matriz_2 = . in 4171 replace matriz_2 = 1 in 4173 replace matriz_2 = 1 in 4223 replace matriz_2 = 1 in 4226 replace matriz_2 = 1 in 4347 replace matriz_2 = 1 in 4359 replace matriz_2 = 1 in 4392 replace matriz_2 = 1 in 4405 replace matriz_3 = 2 in 4405 replace matriz_2 = 1 in 4437 replace matriz_2 = 1 in 4466 replace matriz_3 = 2 in 4466 replace matriz_4 = 2 in 4466 replace matriz_2 = 1 in 4510 replace matriz_3 = 2 in 4510 replace matriz_2 = 1 in 4634 replace matriz_3 = 2 in 4634 replace matriz_4 = 2 in 4634 replace matriz_2 = 1 in 4649 replace matriz_2 = 1 in 4673 replace matriz_3 = 2 in 4673 replace matriz_2 = 1 in 4706 replace matriz_2 = 1 in 4794 replace matriz_3 = 2 in 4794 replace matriz_2 = 1 in 4853 replace matriz_2 = 1 in 5031 replace matriz_3 = 2 in 5031 replace matriz_2 = 1 in 5031 replace matriz_3 = 2 in 5031 replace matriz_2 = 1 in 5120 replace matriz_3 = 2 in 5120 replace matriz_4 = 2 in 5120 replace matriz_2 = 1 in 5302 replace matriz_3 = 2 in 5302 replace matriz_2 = 1 in 5397 replace matriz_3 = 2 in 5397 replace matriz_4 = 2 in 5397 replace matriz_2 = 1 in 5467 replace matriz_2 = 1 in 5469 replace matriz_2 = 1 in 5473 replace matriz_2 = 1 in 5523 replace matriz_3 = 2 in 5523 replace matriz_4 = 2 in 5523 replace matriz_5 = 2 in 5523 replace matriz_3 = 2 in 5524 replace matriz_4 = 2 in 5524 replace matriz_5 = 2 in 5524 replace matriz_2 = 1 in 5539 replace matriz_3 = 2 in 5539 replace matriz_4 = 2 in 5539 replace matriz_2 = 1 in 5564 replace matriz_3 = 2 in 5564 replace matriz_4 = 2 in 5564 replace matriz_2 = 1 in 5593 replace matriz_2 = 1 in 5613 replace matriz_3 = 2 in 5613 replace matriz_4 = . in 5620 replace matriz_2 = . in 5620 replace matriz_2 = 4 in 5620 replace matriz_3 = 4 in 5620 replace matriz_2 = 1 in 5631 replace matriz_3 = 2 in 5631 replace matriz_4 = 2 in 5631 replace matriz_2 = 1 in 5702 replace matriz_3 = 2 in 5702 replace matriz_3 = 2 in 5703 replace matriz_4 = 2 in 5702 replace matriz_4 = 2 in 5703 replace matriz_2 = 1 in 5738 replace matriz_3 = 2 in 5738 replace matriz_2 = 1 in 5843 replace matriz_3 = 2 in 5843 replace matriz_2 = 1 in 5916 replace matriz_3 = 2 in 5916 replace matriz_2 = 1 in 6000 replace matriz_3 = 2 in 6000 replace matriz_4 = 2 in 6000 replace matriz_5 = 2 in 6000 replace matriz_2 = 1 in 6027 replace matriz_3 = 2 in 6027 replace matriz_4 = 2 in 6027 replace matriz_2 = 1 in 6043 replace matriz_3 = 2 in 6043 replace matriz_4 = 2 in 6043 replace matriz_5 = 2 in 6043 replace matriz_2 = 1 in 6085 replace matriz_2 = 1 in 6115 replace matriz_2 = . in 6115 replace matriz_2 = 1 in 6192 replace matriz_3 = 2 in 6192 replace matriz_4 = 2 in 6192 replace matriz_5 = 2 in 6192 replace matriz_2 = 1 in 6268 replace matriz_2 = 1 in 6318 replace matriz_3 = 2 in 6318 replace matriz_4 = 2 in 6318 replace matriz_2 = 1 in 6369 replace matriz_3 = 2 in 6369 replace matriz_2 = 1 in 6387 replace matriz_3 = 2 in 6387 replace matriz_4 = 2 in 6387 replace matriz_3 = 2 in 6388 replace matriz_4 = 2 in 6388 replace matriz_2 = 1 in 6415 replace matriz_4 = 4 in 6415 replace matriz_2 = 1 in 6419 replace matriz_3 = 2 in 6419 replace matriz_4 = 2 in 6419 replace matriz_2 = 1 in 6454 replace matriz_3 = 2 in 6454 replace matriz_4 = 2 in 6454 replace matriz_2 = 1 in 6476 replace matriz_2 = 1 in 6619 replace matriz_3 = 2 in 6619 replace matriz_4 = 2 in 6619 replace matriz_3 = 2 in 6620 replace matriz_4 = 2 in 6620 replace matriz_2 = 1 in 6634 replace matriz_2 = 1 in 6636 replace matriz_2 = 1 in 6645 replace matriz_3 = 2 in 6645 replace matriz_4 = 2 in 6645 replace matriz_2 = 1 in 6703 replace matriz_2 = 1 in 6751 replace matriz_3 = 2 in 6751 replace matriz_2 = 1 in 6780 replace matriz_3 = 2 in 6780 replace matriz_2 = 1 in 6830 replace matriz_3 = 2 in 6830 replace matriz_3 = 2 in 6831 replace matriz_2 = 1 in 6861 replace matriz_3 = 2 in 6861 replace matriz_2 = 1 in 6872 replace matriz_3 = 2 in 6872 replace matriz_2 = . in 6872 replace matriz_3 = . in 6872 replace matriz_2 = 1 in 6962 replace matriz_3 = 2 in 6962 replace matriz_4 = 2 in 6962 replace matriz_2 = 1 in 6985 replace matriz_3 = 2 in 6985 replace matriz_2 = 1 in 7124 replace matriz_3 = 2 in 7124 replace matriz_4 = 2 in 7124 replace matriz_2 = 1 in 7197 replace matriz_3 = 2 in 7197 replace matriz_4 = 2 in 7197 replace matriz_2 = 1 in 7320 replace matriz_3 = 2 in 7320 replace matriz_2 = 1 in 7365 replace matriz_3 = 2 in 7365 replace matriz_2 = 1 in 7382 replace matriz_3 = 2 in 7382 replace matriz_4 = 2 in 7382 replace matriz_2 = 1 in 7431 replace matriz_2 = 1 in 7440 replace matriz_3 = 2 in 7440 replace matriz_4 = 2 in 7440 replace matriz_2 = 1 in 7526 replace matriz_3 = 2 in 7526 replace matriz_2 = 1 in 7530 replace matriz_3 = 2 in 7530 replace matriz_4 = 2 in 7530 replace matriz_2 = 1 in 7619 replace matriz_3 = 2 in 7619 replace matriz_2 = 1 in 7758 replace matriz_2 = 1 in 8019 replace matriz_3 = 2 in 8019 replace matriz_4 = 2 in 8019 replace matriz_2 = 1 in 8110 replace matriz_3 = 2 in 8110 replace matriz_2 = 1 in 8114 replace matriz_2 = . in 8114 replace matriz_3 = 1 in 8114 replace matriz_2 = 1 in 8116 replace matriz_3 = 2 in 8116 replace matriz_4 = 2 in 8116 replace matriz_2 = 1 in 8122 replace matriz_3 = 2 in 8122 replace matriz_4 = 2 in 8122 replace matriz_2 = 1 in 8130 replace matriz_3 = 2 in 8130 replace matriz_4 = 2 in 8130 replace matriz_3 = 2 in 8131 replace matriz_4 = 2 in 8131 replace matriz_2 = 1 in 8133 replace matriz_3 = 2 in 8133 replace matriz_4 = 2 in 8133 replace matriz_5 = 2 in 8133 replace matriz_6 = 2 in 8133 replace matriz_2 = 1 in 8139 replace matriz_3 = 2 in 8139 replace matriz_4 = 2 in 8139 replace matriz_3 = 2 in 8140 replace matriz_4 = 2 in 8140 replace matriz_2 = 1 in 8151 replace matriz_3 = 2 in 8151 replace matriz_2 = . in 8176 replace matriz_2 = 1 in 8197 replace matriz_2 = 1 in 8225 replace matriz_2 = 1 in 8269 replace matriz_3 = 2 in 8269 replace matriz_2 = 1 in 8272 replace matriz_2 = 1 in 8301 replace matriz_3 = 2 in 8301 replace matriz_4 = 2 in 8301 replace matriz_5 = 2 in 8301 replace matriz_2 = 1 in 8333 replace matriz_2 = 1 in 8337 replace matriz_3 = 2 in 8337 replace matriz_4 = 2 in 8337 replace matriz_2 = 1 in 8341 replace matriz_3 = 2 in 8341 replace matriz_4 = 2 in 8341 replace matriz_2 = 1 in 8345 replace matriz_3 = 2 in 8345 replace matriz_2 = 1 in 8352 replace matriz_3 = 2 in 8352 replace matriz_2 = 1 in 8358 replace matriz_2 = 1 in 8369 replace matriz_3 = 2 in 8369 replace matriz_2 = 1 in 8380 replace matriz_2 = 1 in 8384 replace matriz_2 = 1 in 8386 replace matriz_2 = 1 in 8433 replace matriz_2 = 1 in 8629 replace matriz_3 = 2 in 8629 replace matriz_4 = 2 in 8629 replace matriz_3 = 2 in 8630 replace matriz_4 = 2 in 8630 replace matriz_2 = 1 in 8639 replace matriz_2 = 1 in 8681 replace matriz_3 = 2 in 8681 replace matriz_4 = 2 in 8681 replace matriz_2 = 1 in 8698 replace matriz_3 = 2 in 8698 replace matriz_4 = 2 in 8698 replace matriz_2 = 1 in 8729 replace matriz_3 = 2 in 8729 replace matriz_4 = 2 in 8729 replace matriz_2 = 1 in 8773 replace matriz_3 = 2 in 8773 replace matriz_4 = 2 in 8773 replace matriz_2 = 1 in 8883 replace matriz_3 = 2 in 8883 replace matriz_4 = 2 in 8883 replace matriz_2 = 1 in 8901 replace matriz_3 = 2 in 8901 replace matriz_2 = 1 in 8915 replace matriz_2 = 1 in 8954 replace matriz_3 = 2 in 8954 replace matriz_2 = 1 in 8964 replace matriz_3 = 2 in 8964 replace matriz_4 = 2 in 8964 replace matriz_2 = 1 in 8980 replace matriz_3 = 2 in 8980 replace matriz_4 = 2 in 8980 replace matriz_3 = 2 in 8981 replace matriz_4 = 2 in 8981 replace matriz_2 = 1 in 9000 replace matriz_3 = 2 in 9000 replace matriz_4 = 2 in 9000 replace matriz_2 = 1 in 9047 replace matriz_3 = 2 in 9047 replace matriz_4 = 2 in 9047 replace matriz_2 = 1 in 9067 replace matriz_2 = 1 in 9087 replace matriz_3 = 2 in 9087 replace matriz_4 = 2 in 9087 replace matriz_2 = 1 in 9101 replace matriz_3 = 2 in 9101 replace matriz_4 = 2 in 9101 replace matriz_2 = 1 in 9105 replace matriz_2 = 1 in 9144 replace matriz_3 = 2 in 9144 replace matriz_4 = 2 in 9144 replace matriz_3 = 2 in 9145 replace matriz_4 = 2 in 9145 replace matriz_2 = 1 in 9155 replace matriz_3 = 2 in 9155 replace matriz_4 = 2 in 9155 replace matriz_2 = 1 in 9162 replace matriz_2 = 1 in 9170 replace matriz_2 = 1 in 9172 replace matriz_3 = 2 in 9172 replace matriz_4 = 2 in 9172 replace matriz_3 = 2 in 9173 replace matriz_4 = . in 9172 replace matriz_2 = 1 in 9177 replace matriz_2 = . in 9433 replace matriz_2 = 1 in 9601 replace matriz_3 = 2 in 9601 replace matriz_2 = 1 in 9656 replace matriz_3 = 2 in 9656 replace matriz_4 = 2 in 9656 replace matriz_2 = 1 in 9794 replace matriz_2 = 1 in 9803 replace matriz_2 = 1 in 9992 replace matriz_3 = 2 in 9992 replace matriz_2 = 1 in 10030 replace matriz_3 = 2 in 10030 replace matriz_2 = 1 in 10066 replace matriz_3 = 2 in 10066 replace matriz_2 = . in 10727 replace matriz_2 = 1 in 10736 replace matriz_2 = 1 in 10966 replace matriz_3 = 2 in 10966 replace matriz_4 = 2 in 10966 replace matriz_3 = 2 in 10967 replace matriz_4 = 2 in 10967 replace matriz_2 = 1 in 11518 replace matriz_3 = 2 in 11518 replace matriz_2 = 1 in 12060 replace matriz_2 = 1 in 12386 replace matriz_3 = 2 in 12386 replace matriz_4 = 2 in 12386 replace matriz_2 = 1 in 12888 replace matriz_3 = 2 in 12888 replace matriz_2 = 1 in 13078 replace matriz_3 = 2 in 13078 replace matriz_4 = 2 in 13078 replace matriz_2 = 1 in 13082 replace matriz_3 = 2 in 13082 replace matriz_4 = 2 in 13082 replace matriz_2 = 1 in 13115 replace matriz_3 = 2 in 13115 replace matriz_4 = 2 in 13115 replace matriz_3 = 2 in 13116 replace matriz_4 = 2 in 13116 replace matriz_2 = 1 in 13138 replace matriz_3 = 2 in 13138 replace matriz_4 = 2 in 13138 replace matriz_5 = 2 in 13138 replace matriz_2 = 1 in 13329 replace matriz_3 = 2 in 13329 replace matriz_5 = 2 in 13329 replace matriz_2 = 1 in 13381 replace matriz_3 = 2 in 13381 replace matriz_4 = 2 in 13381 replace matriz_2 = 1 in 13526 replace matriz_3 = 2 in 13526 replace matriz_4 = 2 in 13526 replace matriz_5 = 2 in 13526 replace matriz_2 = 1 in 13549 replace matriz_2 = 1 in 13623 replace matriz_2 = 1 in 13629 replace matriz_3 = 2 in 13629 replace matriz_2 = 1 in 13662 replace matriz_3 = 2 in 13662 replace matriz_4 = 2 in 13662 replace matriz_2 = 1 in 13682 replace matriz_3 = 2 in 13682 replace matriz_3 = 2 in 13683 replace matriz_2 = 1 in 13724 replace matriz_3 = 2 in 13724 replace matriz_4 = 2 in 13724 replace matriz_2 = 1 in 13757 replace matriz_2 = 1 in 13761 replace matriz_2 = 1 in 13789 replace matriz_3 = 2 in 13789 replace matriz_4 = 2 in 13789 replace matriz_3 = 2 in 13790 replace matriz_4 = 2 in 13790 replace matriz_2 = 1 in 13810 replace matriz_3 = 2 in 13810 replace matriz_4 = 2 in 13810 replace matriz_2 = 1 in 13818 replace matriz_3 = 2 in 13818 replace matriz_2 = 1 in 13821 replace matriz_3 = 2 in 13821 replace matriz_2 = 1 in 13827 replace matriz_2 = . in 13827 replace matriz_2 = 1 in 13830 replace matriz_2 = 1 in 13999 replace matriz_3 = 2 in 13999 replace matriz_2 = 1 in 14007 replace matriz_3 = 2 in 14007 replace matriz_4 = 2 in 14007 replace matriz_5 = 2 in 14007 replace matriz_6 = 2 in 14007 replace matriz_7 = 2 in 14007 replace matriz_2 = 1 in 14106 replace matriz_3 = 2 in 14106 replace matriz_4 = 2 in 14106 replace matriz_2 = 1 in 14131 replace matriz_3 = 2 in 14131 replace matriz_4 = 2 in 14131 replace matriz_5 = 2 in 14131 replace matriz_6 = 2 in 14131 replace matriz_7 = 2 in 14131 replace matriz_8 = 2 in 14131 replace matriz_9 = 2 in 14131 replace matriz_2 = 1 in 14147 replace matriz_3 = 2 in 14147 replace matriz_2 = 1 in 14212 replace matriz_3 = 2 in 14212 replace matriz_2 = 1 in 14218 replace matriz_3 = 2 in 14218 replace matriz_4 = 2 in 14218 replace matriz_2 = . in 14244 replace matriz_2 = 1 in 14286 replace matriz_3 = 2 in 14286 replace matriz_4 = 2 in 14286 replace matriz_2 = 1 in 14396 replace matriz_3 = 2 in 14396 replace matriz_3 = 2 in 14397 replace matriz_2 = 1 in 14408 replace matriz_3 = 2 in 14408 replace matriz_3 = 2 in 14409 replace matriz_2 = 1 in 14411 replace matriz_3 = . in 14411 replace matriz_2 = 1 in 14418 replace matriz_3 = 2 in 14418 replace matriz_4 = 2 in 14418 replace matriz_5 = 2 in 14418 replace matriz_2 = 1 in 14511 replace matriz_2 = 1 in 14526 replace matriz_3 = 2 in 14526 replace matriz_3 = 2 in 14527 replace matriz_2 = 1 in 14657 replace matriz_3 = 2 in 14657 replace matriz_2 = 1 in 14672 replace matriz_2 = 1 in 14749 replace matriz_3 = 2 in 14749 replace matriz_4 = 2 in 14749 replace matriz_2 = 1 in 14785 replace matriz_2 = 1 in 14898 replace matriz_3 = 2 in 14898 replace matriz_2 = 1 in 15270 replace matriz_2 = 1 in 15466 replace matriz_2 = 1 in 15492 replace matriz_3 = 2 in 15492 replace matriz_2 = 1 in 15503 replace matriz_2 = 1 in 15586 replace matriz_3 = 2 in 15586 replace matriz_4 = 2 in 15586 replace matriz_5 = 2 in 15586 replace matriz_3 = 2 in 15587 replace matriz_4 = 2 in 15587 replace matriz_5 = 2 in 15587 replace matriz_2 = 1 in 15660 replace matriz_2 = . in 15660 replace matriz_2 = 1 in 15671 replace matriz_2 = 1 in 15683 replace matriz_2 = 1 in 15686 replace matriz_3 = 2 in 15686 replace matriz_4 = 2 in 15686 replace matriz_3 = 2 in 15687 replace matriz_4 = 2 in 15687 replace matriz_2 = 1 in 15691 replace matriz_2 = 1 in 15724 replace matriz_3 = 2 in 15724 replace matriz_3 = 2 in 15725 replace matriz_2 = 1 in 15729 replace matriz_2 = 1 in 15731 replace matriz_2 = 1 in 15762 replace matriz_3 = 2 in 15762 replace matriz_2 = 1 in 15804 replace matriz_2 = . in 15836 replace matriz_2 = 1 in 15872 replace matriz_3 = 2 in 15872 replace matriz_2 = 1 in 15875 replace matriz_3 = 2 in 15875 replace matriz_2 = 1 in 15906 replace matriz_3 = 2 in 15906 replace matriz_2 = 1 in 15913 replace matriz_3 = 2 in 15913 replace matriz_2 = 1 in 15920 replace matriz_2 = 1 in 15931 replace matriz_3 = 2 in 15931 replace matriz_2 = 1 in 15934 replace matriz_2 = 1 in 15940 replace matriz_3 = 2 in 15940 replace matriz_3 = 2 in 15941 replace matriz_2 = 1 in 15956 replace matriz_3 = 2 in 15956 replace matriz_2 = 1 in 16004 replace matriz_2 = . in 16004 replace matriz_2 = 1 in 16012 replace matriz_2 = 1 in 16042 replace matriz_2 = 1 in 16052 replace matriz_3 = 2 in 16052 replace matriz_4 = 2 in 16052 replace matriz_2 = 1 in 16056 replace matriz_3 = 2 in 16056 replace matriz_2 = 1 in 16071 replace matriz_3 = 2 in 16071 replace matriz_2 = 1 in 16146 replace matriz_3 = 2 in 16146 replace matriz_4 = 2 in 16146 replace matriz_5 = 2 in 16146 replace matriz_2 = 1 in 16168 replace matriz_2 = 1 in 16183 replace matriz_3 = 2 in 16183 replace matriz_4 = 2 in 16183 replace matriz_2 = 1 in 16239 replace matriz_2 = 1 in 16251 replace matriz_3 = 2 in 16251 replace matriz_2 = 1 in 16268 replace matriz_3 = 2 in 16268 replace matriz_2 = 1 in 16324 replace matriz_2 = 1 in 16364 replace matriz_3 = 2 in 16364 replace matriz_4 = 2 in 16364 replace matriz_5 = 2 in 16364 replace matriz_2 = 1 in 16375 replace matriz_3 = 2 in 16375 replace matriz_4 = 2 in 16375 replace matriz_5 = 2 in 16375 replace matriz_6 = 2 in 16375 replace matriz_7 = 2 in 16375 replace matriz_2 = 1 in 16407 replace matriz_3 = 2 in 16407 replace matriz_2 = 1 in 16423 replace matriz_3 = 2 in 16423 replace matriz_2 = 1 in 16438 replace matriz_3 = 2 in 16438 replace matriz_2 = 1 in 16441 replace matriz_2 = 1 in 16445 replace matriz_2 = 1 in 16447 replace matriz_3 = 2 in 16447 replace matriz_2 = 1 in 16478 replace matriz_2 = 1 in 16497 replace matriz_2 = 1 in 16507 replace matriz_3 = 2 in 16507 replace matriz_4 = 2 in 16507 replace matriz_3 = 2 in 16508 replace matriz_4 = 2 in 16508 replace matriz_2 = 1 in 16539 replace matriz_3 = 2 in 16539 replace matriz_4 = 2 in 16539 replace matriz_2 = 1 in 16543 replace matriz_3 = 2 in 16543 replace matriz_2 = 1 in 16558 replace matriz_3 = 2 in 16558 replace matriz_4 = 2 in 16558 replace matriz_2 = 1 in 16578 replace matriz_2 = 1 in 16766 replace matriz_2 = 4 in 16840 replace matriz_3 = 4 in 16840 replace matriz_2 = 4 in 16850 replace matriz_3 = 4 in 16850 replace matriz_2 = 1 in 16864 replace matriz_3 = 2 in 16864 replace matriz_2 = 1 in 16893 replace matriz_2 = 1 in 17010 replace matriz_2 = 1 in 17060 replace matriz_2 = 1 in 17147 replace matriz_2 = . in 17171 replace matriz_2 = 4 in 17171 replace matriz_3 = 4 in 17171 replace matriz_2 = 4 in 17187 replace matriz_3 = 4 in 17187 replace matriz_3 = 1 in 17188 replace matriz_2 = 1 in 17213 replace matriz_3 = 2 in 17213 replace matriz_2 = 1 in 17259 replace matriz_3 = 2 in 17259 replace matriz_2 = 1 in 17262 replace matriz_3 = 2 in 17262 replace matriz_2 = 1 in 17275 replace matriz_3 = 2 in 17275 replace matriz_2 = 1 in 17278 replace matriz_2 = 1 in 17280 replace matriz_2 = 1 in 17289 replace matriz_2 = 1 in 17349 replace matriz_3 = 2 in 17349 replace matriz_2 = 1 in 17380 replace matriz_3 = 2 in 17380 replace matriz_2 = 4 in 17380 replace matriz_3 = 4 in 17380 replace matriz_2 = 1 in 17389 replace matriz_3 = 2 in 17389 replace matriz_2 = 1 in 17443 replace matriz_3 = 2 in 17443 replace matriz_4 = 2 in 17443 replace matriz_2 = 1 in 17453 replace matriz_3 = 2 in 17453 replace matriz_3 = 2 in 17454 replace matriz_2 = 1 in 17516 replace matriz_3 = 2 in 17516 replace matriz_2 = 1 in 17591 replace matriz_3 = 2 in 17591 replace matriz_2 = 1 in 17740 replace matriz_3 = 2 in 17740 replace matriz_3 = 2 in 17741 replace matriz_4 = 2 in 17740 replace matriz_4 = 2 in 17741 replace matriz_2 = 1 in 17752 replace matriz_3 = 2 in 17752 replace matriz_2 = . in 17752 replace matriz_3 = . in 17752 replace matriz_2 = 1 in 17763 replace matriz_2 = 1 in 17874 replace matriz_2 = 1 in 17906 replace matriz_2 = 1 in 17930 replace matriz_3 = 2 in 17930 replace matriz_2 = 1 in 17933 replace matriz_3 = 2 in 17933 replace matriz_4 = 2 in 17933 replace matriz_5 = 2 in 17933 replace matriz_2 = 1 in 18029 replace matriz_3 = 2 in 18029 replace matriz_2 = 1 in 18213 replace matriz_3 = 2 in 18213 replace matriz_4 = 2 in 18213 replace matriz_2 = 1 in 18233 replace matriz_2 = . in 18233 replace matriz_2 = 1 in 18329 replace matriz_3 = 2 in 18329 replace matriz_4 = 2 in 18329 replace matriz_2 = 1 in 18348 replace matriz_3 = 2 in 18348 replace matriz_2 = 1 in 18354 replace matriz_3 = 2 in 18354 replace matriz_4 = 2 in 18354 replace matriz_2 = 1 in 18371 replace matriz_3 = 2 in 18371 replace matriz_3 = 2 in 18372 replace matriz_2 = 1 in 18380 replace matriz_3 = 2 in 18380 replace matriz_4 = 2 in 18380 replace matriz_2 = 1 in 18391 replace matriz_3 = 2 in 18391 replace matriz_2 = 1 in 18402 replace matriz_3 = 2 in 18402 replace matriz_4 = 2 in 18402 replace matriz_2 = 1 in 18435 replace matriz_3 = 2 in 18435 replace matriz_2 = . in 18532 replace matriz_2 = 1 in 18612 replace matriz_2 = 1 in 18644 replace matriz_3 = 2 in 18644 replace matriz_2 = 1 in 18657 replace matriz_3 = 2 in 18657 replace matriz_4 = 2 in 18657 replace matriz_5 = 2 in 18657 replace matriz_2 = 1 in 18662 replace matriz_3 = 2 in 18662 replace matriz_4 = 2 in 18662 replace matriz_2 = 1 in 19034 replace matriz_3 = 2 in 19034 replace matriz_4 = 2 in 19034 replace matriz_2 = 1 in 19189 replace matriz_2 = 1 in 19345 replace matriz_3 = 2 in 19345 replace matriz_4 = 2 in 19345 replace matriz_2 = 1 in 19392 replace matriz_2 = 4 in 19402 replace matriz_3 = 4 in 19402 replace matriz_2 = 1 in 19415 replace matriz_3 = 2 in 19415 replace matriz_4 = 2 in 19415 replace matriz_2 = 1 in 19430 replace matriz_2 = 1 in 19464 replace matriz_3 = 2 in 19464 replace matriz_2 = 1 in 19475 replace matriz_2 = 1 in 19508 replace matriz_3 = 2 in 19508 replace matriz_4 = 2 in 19508 replace matriz_2 = 1 in 19572 replace matriz_3 = 2 in 19572 replace matriz_4 = 2 in 19572 replace matriz_2 = 1 in 19576 replace matriz_3 = 2 in 19576 replace matriz_4 = 2 in 19576 replace matriz_5 = 2 in 19576 replace matriz_3 = 2 in 19577 replace matriz_4 = 2 in 19577 replace matriz_5 = 2 in 19577 replace matriz_2 = 1 in 19653 replace matriz_3 = 2 in 19653 replace matriz_2 = 1 in 19700 replace matriz_2 = 1 in 19732 replace matriz_2 = . in 19732 replace matriz_3 = 1 in 19732 replace matriz_2 = 4 in 19747 replace matriz_3 = 4 in 19747 replace matriz_2 = 1 in 19804 replace matriz_3 = 2 in 19804 replace matriz_2 = 1 in 19895 replace matriz_3 = 2 in 19895 replace matriz_4 = 2 in 19895 replace matriz_2 = 1 in 19954 replace matriz_3 = 2 in 19954 replace matriz_4 = 2 in 19954 replace matriz_2 = 4 in 20180 replace matriz_3 = 4 in 20180 replace matriz_2 = 1 in 20280 replace matriz_2 = 1 in 20333 replace matriz_3 = 2 in 20333 replace matriz_2 = 1 in 20353 replace matriz_3 = 2 in 20353 replace matriz_2 = 1 in 20510 replace matriz_3 = 2 in 20510 replace matriz_2 = 1 in 20522 replace matriz_3 = 2 in 20522 replace matriz_2 = 1 in 20750 replace matriz_2 = 1 in 20871 replace matriz_2 = 1 in 20923 replace matriz_2 = 1 in 20935 replace matriz_2 = 4 in 20999 replace matriz_3 = 4 in 20999 replace matriz_2 = 1 in 21315 replace matriz_3 = 2 in 21315 replace matriz_4 = 2 in 21315 replace matriz_2 = 1 in 21348 replace matriz_3 = 2 in 21348 replace matriz_4 = 2 in 21348 replace matriz_2 = 1 in 21352 replace matriz_2 = 1 in 21376 replace matriz_3 = 2 in 21376 replace matriz_2 = 4 in 21434 replace matriz_3 = 4 in 21434 replace matriz_2 = 1 in 21699 replace matriz_3 = 2 in 21699 replace matriz_4 = 2 in 21699 replace matriz_2 = 1 in 21757 replace matriz_3 = 2 in 21757 replace matriz_2 = 1 in 21785 replace matriz_3 = 2 in 21785 replace matriz_2 = 1 in 21812 replace matriz_2 = 1 in 21826 replace matriz_3 = 2 in 21826 replace matriz_4 = 2 in 21826 replace matriz_2 = 1 in 22420 replace matriz_3 = 2 in 22420 replace matriz_2 = 1 in 22523 replace matriz_2 = 1 in 22544 replace matriz_2 = . in 22561 replace matriz_2 = . in 22592 replace matriz_2 = 1 in 22684 replace matriz_3 = 2 in 22684 replace matriz_2 = 1 in 22742 replace matriz_3 = 2 in 22742 replace matriz_2 = 1 in 22815 replace matriz_2 = 1 in 22953 replace matriz_3 = 2 in 22953 replace matriz_4 = 2 in 22953 replace matriz_2 = 1 in 23008 replace matriz_3 = 2 in 23008 replace matriz_3 = 2 in 23009 replace matriz_2 = 1 in 23068 replace matriz_3 = 2 in 23068 replace matriz_4 = 2 in 23068 replace matriz_2 = 1 in 23209 replace matriz_3 = 2 in 23209 replace matriz_4 = 2 in 23209 replace matriz_3 = 2 in 23210 replace matriz_4 = 2 in 23210 replace matriz_2 = 1 in 23265 replace matriz_3 = 2 in 23265 replace matriz_4 = 2 in 23265 replace matriz_5 = 2 in 23265 replace matriz_2 = 1 in 23449 replace matriz_3 = 2 in 23449 replace matriz_2 = 1 in 23456 replace matriz_3 = 2 in 23456 replace matriz_4 = 2 in 23456 replace matriz_2 = 1 in 23487 replace matriz_2 = 1 in 23492 replace matriz_2 = 1 in 23503 replace matriz_3 = 2 in 23503 replace matriz_4 = 2 in 23503 replace matriz_2 = 1 in 23546 replace matriz_3 = 2 in 23546 replace matriz_2 = 1 in 23575 replace matriz_2 = 1 in 23599 replace matriz_3 = 2 in 23599 replace matriz_2 = 1 in 23605 replace matriz_3 = 2 in 23605 replace matriz_4 = 2 in 23605 replace matriz_3 = 2 in 23606 replace matriz_4 = 2 in 23606 replace matriz_2 = 1 in 23618 replace matriz_3 = 2 in 23618 replace matriz_2 = 1 in 23621 replace matriz_2 = 1 in 23650 replace matriz_3 = 2 in 23650 replace matriz_2 = 1 in 23659 replace matriz_2 = . in 23682 replace matriz_2 = 1 in 23710 replace matriz_3 = 2 in 23710 replace matriz_2 = 1 in 23713 replace matriz_3 = 2 in 23713 replace matriz_4 = 2 in 23713 replace matriz_2 = 1 in 23741 replace matriz_2 = 1 in 23783 replace matriz_3 = 2 in 23783 replace matriz_2 = 1 in 23836 replace matriz_2 = 1 in 23859 replace matriz_3 = 2 in 23859 replace matriz_4 = 2 in 23859 replace matriz_2 = 1 in 23889 replace matriz_3 = 2 in 23889 replace matriz_2 = 1 in 23951 replace matriz_3 = 2 in 23951 replace matriz_3 = 2 in 23952 replace matriz_2 = 1 in 23978 replace matriz_3 = 2 in 23978 replace matriz_2 = 1 in 24161 replace matriz_2 = 1 in 24176 replace matriz_3 = 2 in 24176 replace matriz_2 = 1 in 24179 replace matriz_3 = 2 in 24179 replace matriz_4 = 2 in 24179 replace matriz_2 = 1 in 24218 replace matriz_2 = 1 in 24257 replace matriz_2 = 1 in 24290 replace matriz_2 = 1 in 24316 replace matriz_3 = 2 in 24316 replace matriz_3 = 2 in 24317 replace matriz_2 = 1 in 24349 replace matriz_2 = 1 in 24385 replace matriz_2 = 1 in 24426 replace matriz_2 = 4 in 24561 replace matriz_3 = 4 in 24561 replace matriz_2 = 1 in 24589 replace matriz_3 = 2 in 24589 replace matriz_4 = 2 in 24589 replace matriz_2 = 1 in 24614 replace matriz_3 = 2 in 24614 replace matriz_4 = 2 in 24614 replace matriz_2 = 1 in 24647 replace matriz_3 = 2 in 24647 replace matriz_4 = 2 in 24647 replace matriz_2 = 1 in 24752 replace matriz_3 = 2 in 24752 replace matriz_3 = 2 in 24753 replace matriz_2 = 1 in 24771 replace matriz_2 = . in 24771 replace matriz_2 = 1 in 24771 replace matriz_3 = 2 in 24771 replace matriz_3 = 2 in 24772 replace matriz_2 = 1 in 24780 replace matriz_3 = 2 in 24780 replace matriz_4 = 2 in 24780 replace matriz_5 = 2 in 24780 replace matriz_2 = 1 in 24800 replace matriz_3 = 2 in 24800 replace matriz_2 = 1 in 24830 replace matriz_2 = 1 in 25023 replace matriz_3 = 2 in 25023 replace matriz_3 = 2 in 25024 replace matriz_2 = 1 in 25117 replace matriz_2 = 1 in 25136 replace matriz_3 = 2 in 25136 replace matriz_2 = 1 in 25180 replace matriz_3 = 2 in 25180 replace matriz_3 = 2 in 25181 replace matriz_2 = 4 in 25239 replace matriz_3 = 4 in 25239 replace matriz_2 = 1 in 25267 replace matriz_3 = 2 in 25267 replace matriz_4 = 2 in 25267 replace matriz_5 = 2 in 25267 replace matriz_6 = 2 in 25267 replace matriz_2 = 1 in 25287 replace matriz_3 = 2 in 25287 replace matriz_4 = 2 in 25287 replace matriz_5 = 2 in 25287 replace matriz_6 = 2 in 25287 replace matriz_2 = 1 in 25323 replace matriz_3 = 2 in 25323 replace matriz_4 = 2 in 25323 replace matriz_2 = 1 in 25372 replace matriz_3 = 2 in 25372 replace matriz_4 = 2 in 25372 replace matriz_5 = 2 in 25372 replace matriz_6 = 2 in 25372 replace matriz_7 = 2 in 25372 replace matriz_8 = 2 in 25372 replace matriz_9 = 2 in 25372 replace matriz_10 = 2 in 25372 replace matriz_2 = 1 in 25529 replace matriz_3 = 2 in 25529 replace matriz_4 = 2 in 25529 replace matriz_2 = 1 in 25747 replace matriz_3 = 2 in 25747 replace matriz_4 = 2 in 25747 ********************************************* ** AV ACTIVITIES ** ********************************************* * AV1: PAID WORK gen av1=0 forval i= 1/144 { replace av1=av1+1 if ((aprin`i'==111 | aprin`i'==121 | aprin`i'==129) & (lugar`i'!=11 & lugar`i'!=12)) | /// (aprin`i'==21 & lugar`i'==13) } replace av1=av1*10 * AV2: PAID WORK AT HOME gen av2=0 forval i= 1/144 { replace av2=av2+1 if ((aprin`i'==111 | aprin`i'==121 | aprin`i'==129) & (lugar`i'==11 | lugar`i'==12)) | /// (aprin`i'==122) } replace av2=av2*10 * AV3: PAID WORK, SECOND JOB gen av3=-9 * AV4: SCHOOL/CLASSES gen av4=0 forval i= 1/144 { replace av4=av4+1 if aprin`i'==210 | aprin`i'==211 } replace av4=av4*10 * AV5: TRAVEL TO/FROM WORK gen av5=0 forval i= 1/144 { replace av5=av5+1 if aprin`i'==910 | aprin`i'==920 } replace av5=av5*10 * AV6: COOK/WASH UP gen av6=0 forval i= 1/144 { replace av6=av6+1 if aprin`i'==311 | aprin`i'==312 } replace av6=av6*10 * AV7: HOUSEWORK gen av7=0 forval i= 1/144 { replace av7=av7+1 if aprin`i'==300 | aprin`i'==321 | aprin`i'==322 | aprin`i'==323 | aprin`i'==329 /// | aprin`i'==331 | aprin`i'==332 | aprin`i'==333 | aprin`i'==339 } replace av7=av7*10 * AV8: OTHER DOMESTIC WORK gen av8=0 forval i= 1/144 { replace av8=av8+1 if aprin`i'==324 | aprin`i'==342 | aprin`i'==343 /// | aprin`i'==351 | aprin`i'==352 | aprin`i'==353 | aprin`i'==354 | aprin`i'==359 | aprin`i'==371 | /// aprin`i'==391 | aprin`i'==392 | aprin`i'==399 | aprin`i'==421 | aprin`i'==422 | aprin`i'==425 | aprin`i'==429 } replace av8=av8*10 * AV9: GARDENING gen av9=0 forval i= 1/144 { replace av9=av9+1 if aprin`i'==341 | aprin`i'==349 } replace av9=av9*10 * AV10: SHOPPING gen av10=0 forval i= 1/144 { replace av10=av10+1 if aprin`i'==361 | aprin`i'==362 | aprin`i'==369 } replace av10=av10*10 * AV11: CHILDCARE gen av11=0 forval i= 1/144 { replace av11=av11+1 if aprin`i'==381 | aprin`i'==382 | aprin`i'==383 | aprin`i'==384 /// | aprin`i'==389 | aprin`i'==423 | aprin`i'==424 } replace av11=av11*10 * AV12: DOMESTIC TRAVEL gen av12=0 forval i= 1/144 { replace av12=av12+1 if aprin`i'==930 | aprin`i'==936 | aprin`i'==938 | aprin`i'==939 } replace av12=av12*10 * AV13: DRESS/PERSONAL CARE gen av13=0 forval i= 1/144 { replace av13=av13+1 if aprin`i'==31 | aprin`i'==39 } replace av13=av13*10 * AV14: CONSUME PERSONAL SERVICES gen av14=0 forval i= 1/144 { replace av14=av14+1 if aprin`i'==363 } replace av14=av14*10 * AV15: MEALS/SNACKS gen av15=0 forval i= 1/144 { replace av15=av15+1 if ((aprin`i'==21) & (lugar`i'!=13 & lugar`i'!=21)) } replace av15=av15*10 *AV16: SLEEP gen av16=0 forval i= 1/144 { replace av16=av16+1 if aprin`i'==11 | aprin`i'==12 } replace av16=av16*10 *AV17: FREE TIME TRAVEL gen av17=0 forval i= 1/144 { replace av17=av17+1 if aprin`i'==900 | aprin`i'==940 | aprin`i'==950 | aprin`i'==960 | aprin`i'==990 } replace av17=av17*10 *AV18: EXCURSIONS gen av18=0 forval i= 1/144 { replace av18=av18+1 if aprin`i'==523 | aprin`i'==524 | aprin`i'==529 } replace av18=av18*10 *AV19: ACTIVE SPORTS PARTICIPATION gen av19=0 forval i= 1/144 { replace av19=av19+1 if aprin`i'==612 | aprin`i'==613 | aprin`i'==614 | aprin`i'==615 | aprin`i'==616 | /// aprin`i'==619 | aprin`i'==621 | aprin`i'==631 } replace av19=av19*10 *AV20: PASSIVE SPORTS PARTICIPATION gen av20=0 forval i= 1/144 { replace av20=av20+1 if aprin`i'==525 } replace av20=av20*10 *AV21: WALKING gen av21=0 forval i= 1/144 { replace av21=av21+1 if aprin`i'==344 | aprin`i'==611 } replace av21=av21*10 *AV22: RELIGIOUS ACTIVITIES gen av22=0 forval i= 1/144 { replace av22=av22+1 if aprin`i'==432 } replace av22=av22*10 *AV23: CIVIC ACTIVITIES gen av23=0 forval i= 1/144 { replace av23=av23+1 if aprin`i'==411 | aprin`i'==431 | aprin`i'==439 | aprin`i'==995 | aprin`i'==996 } replace av23=av23*10 *AV24: CINEMA OR THEATRE gen av24=0 forval i= 1/144 { replace av24=av24+1 if aprin`i'==521 | aprin`i'==522 } replace av24=av24*10 *AV25: DANCES OR PARTIES gen av25=0 forval i= 1/144 { replace av25=av25+1 if aprin`i'==513 } replace av25=av25*10 *AV26: SOCIAL CLUBS gen av26=-9 *AV27: PUBS gen av27=-9 *AV28: RESTAURANTS gen av28=0 forval i= 1/144 { replace av28=av28+1 if (aprin`i'==21 & lugar`i'==21) } replace av28=av28*10 *AV29: VISIT FRIENDS AT THEIR HOMES gen av29=0 forval i= 1/144 { replace av29=av29+1 if ((aprin`i'==511 | aprin`i'==512 | aprin`i'==519) & (lugar`i'!=11 & lugar`i'!=12)) } replace av29=av29*10 *AV30: LISTEN TO RADIO gen av30=0 forval i= 1/144 { replace av30=av30+1 if aprin`i'==831 } replace av30=av30*10 *AV31: WATCH TV OR VIDEO gen av31=0 forval i= 1/144 { replace av31=av31+1 if aprin`i'==821 | aprin`i'==822 | aprin`i'==829 } replace av31=av31*10 *AV32: LISTEN TO RECORDS, TAPES, CDS gen av32=0 forval i= 1/144 { replace av32=av32+1 if aprin`i'==832 | aprin`i'==839 } replace av32=av32*10 *AV33: STUDY, HOMEWORK gen av33=0 forval i= 1/144 { replace av33=av33+1 if aprin`i'==200 | aprin`i'==212 | aprin`i'==221 } replace av33=av33*10 *AV34: READ BOOKS gen av34=0 forval i= 1/144 { replace av34=av34+1 if aprin`i'==812 } replace av34=av34*10 *AV35: READ PAPERS, MAGAZINES gen av35=0 forval i= 1/144 { replace av35=av35+1 if aprin`i'==811 | aprin`i'==819 } replace av35=av35*10 *AV36: RELAX gen av36=0 forval i= 1/144 { replace av36=av36+1 if aprin`i'==531 | aprin`i'==998 } replace av36=av36*10 *AV37: CONVERSATION gen av37=0 forval i= 1/144 { replace av37=av37+1 if aprin`i'==514 } replace av37=av37*10 *AV38: ENTERTAIN FRIENDS AT HOME gen av38=0 forval i= 1/144 { replace av38=av38+1 if (aprin`i'==732) | ((aprin`i'==511 | aprin`i'==512 | aprin`i'==519) & (lugar`i'==11 | lugar`i'==12)) } replace av38=av38*10 *AV39: KNIT, SEW gen av39=-9 *AV40: OTHER LEISURE gen av40=0 forval i= 1/144 { replace av40=av40+1 if aprin`i'==711 | aprin`i'==712 | aprin`i'==713 | aprin`i'==719 | aprin`i'==721 | /// aprin`i'==722 | aprin`i'==723 | aprin`i'==729 | aprin`i'==731 | aprin`i'==733 | aprin`i'==739 | aprin`i'==997 } replace av40=av40*10 *AV41: UNCLASSIFIED OR MISSING ACTIVITIES gen av41=0 forval i= 1/144 { replace av41=av41+1 if aprin`i'==999 } replace av41=av41*10 ********************************************* ** MAIN ACTIVITIES ** ********************************************* *MAIN1: IMPUTED PERSONAL OR HOUSEHOLD CARE gen main1=-9 *MAIN2: SLEEP AND NAPS gen main2=0 forval i= 1/144 { replace main2=main2+1 if aprin`i'==11 | aprin`i'==12 } replace main2=main2*10 *MAIN3: IMPUTED SLEEP gen main3=-9 *MAIN4: WASH, DRESS, CARE FOR SELF gen main4=0 forval i= 1/144 { replace main4=main4+1 if aprin`i'==31 | aprin`i'==39 } replace main4=main4*10 *MAIN5: MEALS AT WORK OR SCHOOL gen main5=0 forval i= 1/144 { replace main5=main5+1 if (aprin`i'==21 & lugar`i'==13) } replace main5=main5*10 forval i= 1/80 { replace main5=lenght_minute_new`i'+main5 if (aprin_new`i'==121 & lenght_minute_new`i'>30) } *MAIN6: OTHER MEALS OR SNACKS gen main6=0 forval i= 1/144 { replace main6=main6+1 if (aprin`i'==21 & lugar`i'!=13 & lugar`i'!=21) } replace main6=main6*10 *MAIN7: PAID WORK - MAIN JOB (NOT AT HOME) gen main7=0 forval i= 1/144 { replace main7=main7+1 if (aprin`i'==111 & lugar`i'!=11 & lugar`i'!=12 /// & lugar`i'!=33 & lugar`i'!=34 & lugar`i'!=39 & lugar`i'!=41 & lugar`i'!=31 & lugar`i'!=32 & lugar`i'!=30) } replace main7=main7*10 *MAIN8: PAID WORK AT HOME gen main8=0 forval i= 1/144 { replace main8=main8+1 if ((aprin`i'==111) & (lugar`i'==11 | lugar`i'==12)) } replace main8=main8*10 *MAIN9: SECOND OR OTHER JOB NOT AT HOME gen main9=-9 *MAIN10: UNPAID WORK TO GENERATE HOUSEHOLD INCOME gen main10=-9 *MAIN11: TRAVEL AS A PART OF WORK gen main11=0 forval i= 1/144 { replace main11=main11+1 if ((aprin`i'==111) & (lugar`i'==33 | lugar`i'==34 | lugar`i'==39 | /// lugar`i'==41 | lugar`i'==31 | lugar`i'==32 | lugar`i'==30)) } replace main11=main11*10 *MAIN12: WORK BREAKS gen main12=0 forval i= 1/80 { replace main12=lenght_minute_new`i'+main12 if (aprin_new`i'==121 & lenght_minute_new`i'<=30) } *MAIN13: OTHER TIME AT WORKPLACE gen main13=0 forval i= 1/144 { replace main13=main13+1 if aprin`i'==129 } replace main13=main13*10 *MAIN14: LOOK FOR WORK gen main14=0 forval i= 1/144 { replace main14=main14+1 if aprin`i'==122 } replace main14=main14*10 *MAIN15: REGULAR SCHOOLING, EDUCATION gen main15=0 forval i= 1/144 { replace main15=main15+1 if aprin`i'==211 } replace main15=main15*10 *MAIN16: HOMEWORK gen main16=0 forval i= 1/144 { replace main16=main16+1 if aprin`i'==200 | aprin`i'==212 } replace main16=main16*10 *MAIN17: LEISURE/OTHER EDUCATION TRAINING gen main17=0 forval i= 1/144 { replace main17=main17+1 if aprin`i'==210 | aprin`i'==221 } replace main17=main17*10 *MAIN18: FOOD PREPARATION, COOK gen main18=0 forval i= 1/144 { replace main18=main18+1 if aprin`i'==311 } replace main18=main18*10 *MAIN19: SET TABLE, WASH/PUT AWAY DISHES gen main19=0 forval i= 1/144 { replace main19=main19+1 if aprin`i'==312 } replace main19=main19*10 *MAIN20: CLEANING gen main20=0 forval i= 1/144 { replace main20=main20+1 if aprin`i'==321 | aprin`i'==322 } replace main20=main20*10 *MAIN21: LAUNDRY, IRONING, CLOTHING REPAIR gen main21=0 forval i= 1/144 { replace main21=main21+1 if aprin`i'==331 | aprin`i'==332 | aprin`i'==333 | aprin`i'==339 } replace main21=main21*10 *MAIN22: MAINTAIN HOME / VEHICLE gen main22=0 forval i= 1/144 { replace main22=main22+1 if aprin`i'==323 | aprin`i'==342 | aprin`i'==351 | aprin`i'==352 | /// aprin`i'==353 | aprin`i'==354 | aprin`i'==359 } replace main22=main22*10 *MAIN23: OTHER DOMESTIC WORK gen main23=0 forval i= 1/144 { replace main23=main23+1 if aprin`i'==300 | aprin`i'==324 | aprin`i'==329 | aprin`i'==371 } replace main23=main23*10 *MAIN24: PURCHASE GOODS gen main24=0 forval i= 1/144 { replace main24=main24+1 if aprin`i'==361 | aprin`i'==369 } replace main24=main24*10 *MAIN25: CONSUME PERSONAL CARE SERVICES gen main25=0 forval i= 1/144 { replace main25=main25+1 if aprin`i'==363 } replace main25=main25*10 *MAIN26: CONSUME OTHER SERVICES gen main26=0 forval i= 1/144 { replace main26=main26+1 if aprin`i'==362 } replace main26=main26*10 *MAIN27: PET CARE (NOT WALK DOG) gen main27=0 forval i= 1/144 { replace main27=main27+1 if aprin`i'==343 } replace main27=main27*10 *MAIN28: PHYSICAL, MEDICAL CHILD CARE gen main28=0 forval i= 1/144 { replace main28=main28+1 if aprin`i'==381 | aprin`i'==423 | aprin`i'==424 } replace main28=main28*10 *MAIN29: TEACH, HELP WITH HOMEWORK gen main29=0 forval i= 1/144 { replace main29=main29+1 if aprin`i'==382 } replace main29=main29*10 *MAIN30: READ TO, TALK OR PLAY WITH CHILDREN gen main30=0 forval i= 1/144 { replace main30=main30+1 if aprin`i'==383 } replace main30=main30*10 *MAIN31: SUPERVISE, ACCOMPANY, OTHER CHILD CARE gen main31=0 forval i= 1/144 { replace main31=main31+1 if aprin`i'==384 | aprin`i'==389 } replace main31=main31*10 *MAIN32: ADULT CARE gen main32=0 forval i= 1/144 { replace main32=main32+1 if aprin`i'==391 | aprin`i'==392 | aprin`i'==399 | /// aprin`i'==421 | aprin`i'==422 | aprin`i'==425 | aprin`i'==429 } replace main32=main32*10 *MAIN33: VOLUNTARY, CIVIC ORGANIZATIONAL ACT gen main33=0 forval i= 1/144 { replace main33=main33+1 if aprin`i'==411 | aprin`i'==431 | /// aprin`i'==439 | aprin`i'==995 | aprin`i'==996 } replace main33=main33*10 *MAIN34: WORSHIP AND RELIGION gen main34=0 forval i= 1/144 { replace main34=main34+1 if aprin`i'==432 } replace main34=main34*10 *MAIN35: GENERAL OUT-OF-HOME LEISURE gen main35=0 forval i= 1/144 { replace main35=main35+1 if (aprin`i'==529 & lugar`i'!=11 & lugar`i'!=12) } replace main35=main35*10 *MAIN36: ATTENDING SPORTING EVENT gen main36=0 forval i= 1/144 { replace main36=main36+1 if aprin`i'==525 } replace main36=main36*10 *MAIN37: CINEMA, THEATRE, OPERA, CONCERT gen main37=0 forval i= 1/144 { replace main37=main37+1 if aprin`i'==521 | aprin`i'==522 } replace main37=main37*10 *MAIN38: OTHER PUBLIC EVENT, VENUE gen main38=0 forval i= 1/144 { replace main38=main38+1 if aprin`i'==523 | aprin`i'==524 } replace main38=main38*10 *MAIN39: RESTAURANT, CAFE, BAR, PUB gen main39=0 forval i= 1/144 { replace main39=main39+1 if (aprin`i'==21 & lugar`i'==21) } replace main39=main39*10 *MAIN40: PARTY, SOCIAL EVENT, GAMBLING gen main40=0 forval i= 1/144 { replace main40=main40+1 if aprin`i'==513 } replace main40=main40*10 *MAIN41: IMPUTED TIME AWAY FROM HOME gen main41=-9 *MAIN42: GENERAL SPORT OR EXERCISE gen main42=0 forval i= 1/144 { replace main42=main42+1 if ((aprin`i'==612 | aprin`i'==614 | aprin`i'==615 | aprin`i'==616 /// | aprin`i'==619 | aprin`i'==631) | (aprin`i'==613 & lugar`i'!=32)) } replace main42=main42*10 *MAIN43: WALKING gen main43=0 forval i= 1/144 { replace main43=main43+1 if aprin`i'==611 } replace main43=main43*10 *MAIN44: CYCLING gen main44=0 forval i= 1/144 { replace main44=main44+1 if (aprin`i'==613 & lugar`i'==32) } replace main44=main44*10 *MAIN45: OTHER OUTSIDE RECREATION gen main45=-9 *MAIN46: GARDENING / PICK MUSHROOMS gen main46=0 forval i= 1/144 { replace main46=main46+1 if aprin`i'==341 | aprin`i'==349 | aprin`i'==621 } replace main46=main46*10 *MAIN47: WALK DOGS gen main47=0 forval i= 1/144 { replace main47=main47+1 if aprin`i'==344 } replace main47=main47*10 *MAIN48: RECEIVE OR VISIT FRIENDS gen main48=0 forval i= 1/144 { replace main48=main48+1 if aprin`i'==512 | aprin`i'==519 } replace main48=main48*10 *MAIN49: CONVERSATION (IN PERSON, PHONE) gen main49=0 forval i= 1/144 { replace main49=main49+1 if aprin`i'==514 } replace main49=main49*10 *MAIN50: OTHER IN-HOME, SOCIAL GAMES gen main50=0 forval i= 1/144 { replace main50=main50+1 if aprin`i'==511 | aprin`i'==731 | aprin`i'==732 | aprin`i'==739 } replace main50=main50*10 *MAIN51: GENERAL INDOOR LEISURE gen main51=0 forval i= 1/144 { replace main51=main51+1 if ((aprin`i'==529 & (lugar`i'==11 | lugar`i'==12)) | aprin`i'==997 | aprin`i'==998) } replace main51=main51*10 *MAIN52: ART OR MUSIC gen main52=0 forval i= 1/144 { replace main52=main52+1 if aprin`i'==711 } replace main52=main52*10 *MAIN53: CORRESPONDENSE (NOT E-LAB MAIL) gen main53=0 forval i= 1/144 { replace main53=main53+1 if aprin`i'==713 } replace main53=main53*10 *MAIN54: KNIT, CRAFTS OR HOBBIES gen main54=0 forval i= 1/144 { replace main54=main54+1 if aprin`i'==712 | aprin`i'==719 } replace main54=main54*10 *MAIN55: RELAX, THINK, DO NOTHING gen main55=0 forval i= 1/144 { replace main55=main55+1 if aprin`i'==531 } replace main55=main55*10 *MAIN56: READ gen main56=0 forval i= 1/144 { replace main56=main56+1 if aprin`i'==811 | aprin`i'==812 | aprin`i'==819 } replace main56=main56*10 *MAIN57: LISTEN TO MUSIC ETC. gen main57=0 forval i= 1/144 { replace main57=main57+1 if aprin`i'==832 | aprin`i'==839 } replace main57=main57*10 *MAIN58: LISTEN TO RADIO gen main58=0 forval i= 1/144 { replace main58=main58+1 if aprin`i'==831 } replace main58=main58*10 *MAIN59: WATCH TV, VIDEO, DVD gen main59=0 forval i= 1/144 { replace main59=main59+1 if aprin`i'==821 | aprin`i'==822 | aprin`i'==829 } replace main59=main59*10 *MAIN60: COMPUTER GAMES gen main60=0 forval i= 1/144 { replace main60=main60+1 if aprin`i'==733 } replace main60=main60*10 *MAIN61: E-LAB MAIL, SURF INTERNET, COMPUTING gen main61=0 forval i= 1/144 { replace main61=main61+1 if aprin`i'==721 | aprin`i'==722 | aprin`i'==723 | aprin`i'==729 } replace main61=main61*10 *MAIN62: NO ACT BUT RECORDED TRANSPORT MODE gen main62=-9 *MAIN63: TRAVEL TO/FROM WORK gen main63=0 forval i= 1/144 { replace main63=main63+1 if aprin`i'==910 } replace main63=main63*10 *MAIN64: EDUCATIONAL TRAVEL gen main64=0 forval i= 1/144 { replace main64=main64+1 if aprin`i'==920 } replace main64=main64*10 *MAIN65: VOLUNTARY / CIVIC / RELIGIOUS TRAVEL gen main65=0 forval i= 1/144 { replace main65=main65+1 if aprin`i'==940 } replace main65=main65*10 *MAIN66: CHILD / ADULT CARE TRAVEL gen main66=0 forval i= 1/144 { replace main66=main66+1 if aprin`i'==938 | aprin`i'==939 } replace main66=main66*10 *MAIN67: SHOP PERSON / HOUSEHOLD CARE TRAVEL gen main67=0 forval i= 1/144 { replace main67=main67+1 if aprin`i'==930 | aprin`i'==936 } replace main67=main67*10 *MAIN68: OTHER TRAVEL gen main68=0 forval i= 1/144 { replace main68=main68+1 if aprin`i'==900 | aprin`i'==950 | aprin`i'==960 | aprin`i'==990 } replace main68=main68*10 *MAIN69: NO RECORDED ACTIVITY gen main69=0 forval i= 1/144 { replace main69=main69+1 if aprin`i'==999 } replace main69=main69*10 egen tot_main=rsum(main1-main69) ******************************************************** ** DEMOGRAPHIC AND SOCIO-ECONOMIC BACKGROUND VARIABLES** ******************************************************** *COUNTR: ES generate country="ES" generate survey=2009 generate swave=0 generate msamp=0 * HLDID: we use the original household identification generate hldid=idhogar * PERSID: we use the orginal person identification generate persid=npers * ID: the survey only recods data for one day so "ID" and "PERSID" are the same generate id=npers * PERSON IDENTIFER OF 1ST AND 2ND PARENT OF DIARIST. gen parntid1=999 gen parntid2=999 for num 2/13: replace parntid1=X if matriz_X==4 & parntid1==999 for num 2/13: replace parntid2=X if matriz_X==4 & parntid1!=999 & parntid2==999 & X!=parntid1 for num 2/13: replace parntid1=npers[_n-1] if matriz_X==4 & parntid1==999 gsort idhogar -edad forval i= 1/13 { forval h= 2/13 { replace parntid2=npers[_n-`i'] if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==2 & parntid2==999 & `h'==npers } } forval i= 1/13 { forval h= 2/13 { replace parntid1=npers[_n-`i'] if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==2 & parntid1==999 & `h'==npers & parntid2!=npers[_n-`i'] } } gen error1=1 if parntid1==999 & parntid2!=999 replace parntid1=parntid2 if error1==1 replace parntid2=-7 if error1==1 replace parntid1=-7 if parntid1==999 replace parntid2=-7 if parntid2==999 * PARTID: Person identifier of spouse or partner of the diarist sort idhogar npers gen partid=999 for num 2/13: replace partid=X if matriz_X==1 forval i= 1/13 { forval h= 2/13 { replace partid=npers[_n-`i'] if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & partid==999 & `h'==npers } } replace partid=-7 if partid==999 * Day of the week generate day=1 if ddiasem1==7 replace day=2 if ddiasem1==1 replace day=3 if ddiasem1==2 replace day=4 if ddiasem1==3 replace day=5 if ddiasem1==4 replace day=6 if ddiasem1==5 replace day=7 if ddiasem1==6 replace day=-8 if ddiasem1==. * Month generate month=999 replace month=2 if trim1==1 replace month=5 if trim1==2 replace month=8 if trim1==3 replace month=11 if trim1==4 /* 1 January-March 2010 2 April-June 2010 3 July-September 2010 4 October-December 2009 */ *Year generate year=2010 if trim1==1 | trim1==2 | trim1==3 replace year=2009 if trim1==4 *Diary generate diary=1 *NCHILD: Number of Children sort idhogar edad generate nchild=0 replace nchild=1 if idhogar!=idhogar[_n-1] & edad<18 replace nchild=nchild[_n-1]+1 if nchild[_n-1]>0 & idhogar==idhogar[_n-1] & edad<18 replace nchild=nchild[_n-1] if nchild[_n-1]>nchild & idhogar==idhogar[_n-1] gsort idhogar -nchild replace nchild=nchild[_n-1] if nchild[_n-1]>nchild & idhogar==idhogar[_n-1] sort idhogar npers *HHLDSIZE: Household Size generate hhldsize=nmh *HHTYPE: Household Type generate hhtype=4 replace hhtype=1 if nmh==1 for num 2/13: replace hhtype=2 if matriz_X==1 & nmh==2 forval i= 1/13 { forval h= 2/13 { replace hhtype=2 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & `h'==npers & nmh==2 } } for num 2/13: replace hhtype=3 if matriz_X==1 & nmh>2 forval i= 1/13 { forval h= 2/13 { replace hhtype=3 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & `h'==npers & nmh>2 } } sort idhogar hhtype replace hhtype=hhtype[_n-1] if idhogar==idhogar[_n-1] sort idhogar npers *AGEKIDX: Youngest Child in Household (categories) sort idhogar edad gen youngest=999 replace youngest=edad if idhogar!=idhogar[_n-1] & edad<18 replace youngest=youngest[_n-1] if youngest[_n-1]!=999 & youngest==999 & idhogar==idhogar[_n-1] gen youngest_temp=999 forval i= 1/13 { forval h= 2/13 { replace youngest_temp=edad[_n-`i'] if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==4 /// & youngest_temp==999 & `h'==npers & edad[_n-`i']=0 & youngest<=4 replace agekidx=2 if youngest>=5 & youngest<=12 replace agekidx=3 if youngest>=13 & youngest<=17 replace agekidx=4 if youngest>=18 & youngest<999 * AGEKID2: Youngest Child in Household gen agekid2=-7 * see agekidx2 for the creation of "youngest" variable replace agekid2=youngest if youngest!=999 * INCORIG: original household income generate incorig=ingresosh replace incorig=-8 if ingresosh==. | ingresosh==5 * INCOME: total household income-grouped generate income=1 if ingresosh==1 replace income=2 if ingresosh==2 | ingresosh==3 replace income=3 if ingresosh==4 replace income=-8 if ingresosh==. | ingresosh==5 *OWNHOME generate ownhome=-9 *URBAN generate urban=-8 replace urban=1 if tamun==1 | tamun==2 | tamun==3 replace urban=2 if tamun==4 | tamun==5 * COMPUTER: does the household have a computer generate computer=999 forval i= 1/144 { replace computer=1 if (aprin`i'==721 | aprin`i'==722 | aprin`i'==723 | aprin`i'==729 | aprin`i'==733 | /// asecu`i'==721 | asecu`i'==722 | asecu`i'==723 | asecu`i'==729 | asecu`i'==733) & (lugar`i'==11 | lugar`i'==12) } sort idhogar computer replace computer=1 if computer[_n-1]==1 & idhogar==idhogar[_n-1] sort idhogar npers replace computer=0 if computer==999 * VEHICLE: does the household have a vehicle generate vehicle=-9 * SEX gen sex=sexo replace sex=2 if sex==6 * AGE gen age=edad replace age=90 if edad>=90 * FAMSTAT: Individual level family status generate famstat=-8 replace famstat=0 if (edad>=18 & edad<40) & nchild==0 & (agekidx==-7 | agekidx==4) replace famstat=3 if edad>=40 & nchild==0 & (agekidx==-7 | agekidx==4) replace famstat=1 if edad>=18 & nchild>0 & agekidx==1 replace famstat=2 if edad>=18 & nchild>0 & (agekidx==2 | agekidx==3) replace famstat=4 if edad<18 & (parntid1>0 | parntid2>0) replace famstat=5 if edad<18 & parntid1==-7 replace famstat=0 if famstat==-8 & (edad>=18 & edad<40) replace famstat=3 if famstat==-8 & edad>=40 * SINGPAR: Whether the diarist is a single parent gen relationship_temp=0 for num 2/13: replace relationship_temp=1 if matriz_X==1 forval i= 1/13 { forval h= 2/13 { replace relationship_temp=1 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & `h'==npers } } gen singpar=1 if (tipohog==5 | tipohog==6) & nchild>0 & relationship_temp==0 & hhtype==4 replace singpar=0 if singpar==. * RELREFP: relationship of the diariest to the household reference person sort idhogar npers gen relrefp=-8 /* SPAIN 2009 original 1 spouse or partner 2 son or daughter 3 brother or sister 4 parent 5 grandchild 6 grandparent 7 son-in-law or daughter-in-law 8 other relative 9 not related MTUS 1 Person 1 2 Spouse / Common-law partner 3 Child 4 Parent 5 Sibling 6 Son / Daugther-in-law 7 Father / Mother-in-law 8 Brother / Sister-in-law 9 Other Relative 10 Not Related */ replace relrefp=1 if npers==1 forval i= 1/13 { forval h= 2/13 { replace relrefp=2 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & `h'==npers replace relrefp=3 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==2 & `h'==npers replace relrefp=4 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==4 & `h'==npers replace relrefp=5 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==3 & `h'==npers replace relrefp=6 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==7 & `h'==npers replace relrefp=9 if idhogar==idhogar[_n-`i'] & /// (matriz_`h'[_n-`i']==5 | matriz_`h'[_n-`i']==6 | matriz_`h'[_n-`i']==8) & `h'==npers replace relrefp=10 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==9 & `h'==npers } } replace relrefp=1 if npers==1 & relrefp==-8 *CIVSTAT: Whether the diarist is in a couple or not gen civstat=2 for num 2/13: replace civstat=1 if matriz_X==1 forval i= 1/13 { forval h= 2/13 { replace civstat=1 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & `h'==npers } } *COHAB: whether the diarist is cohabitating gen cohab=-7 for num 2/13: replace cohab=0 if matriz_X==1 forval i= 1/13 { forval h= 2/13 { replace cohab=0 if idhogar==idhogar[_n-`i'] & matriz_`h'[_n-`i']==1 & `h'==npers } } replace cohab=1 if cohab==0 & (ecivil!=2 & viv_pareja==1) *CITIZEN: Whether citizen of country (i.e. Spain) gen citizen=1 if espanol==1 replace citizen=0 if espanol==6 *REGION gen region=caut *ETHNIC gen ethnic=-9 *EMP: employment status gen emp=-8 replace emp=1 if trabajo==1 | trab_aus==1 replace emp=0 if trabajo==6 forval i= 1/144 { replace emp=1 if emp==0 & (aprin`i'==111 | aprin`i'==121 | aprin`i'==129 | /// asecu`i'==111 | asecu`i'==121 | asecu`i'==129) } * EMPSTAT: employment status gen hoursworked_temp=0 replace hoursworked_temp=horahab if horahab>0 & horahab!=. replace hoursworked_temp=horahab2+hoursworked_temp if horahab2>0 & horahab2!=. gen empstat=999 replace empstat=1 if (trabajo==1 | trab_aus==1) & hoursworked_temp>=30 replace empstat=2 if (trabajo==1 | trab_aus==1) & (hoursworked_temp>0 & hoursworked_temp<30) replace empstat=3 if (trabajo==1 | trab_aus==1) & hoursworked_temp==0 replace empstat=4 if trabajo==6 forval i= 1/144 { replace empstat=3 if empstat==4 & (aprin`i'==111 | aprin`i'==121 | aprin`i'==129 | /// asecu`i'==111 | asecu`i'==121 | asecu`i'==129) } replace empstat=-8 if empstat==999 * UNEMPLOYED: unemployment status gen unemp=1 if hrelactiv==2 replace unemp=0 if hrelactiv!=2 * STUDENT: whether the respondnt is a student gen student=1 if hrelactiv==3 replace student=0 if hrelactiv!=3 * RETIRED: whether the respondent is retired gen retired=1 if hrelactiv==4 replace retired=0 if hrelactiv!=4 * EMPSP: Employment status of spouse or partner sort hldid gen empsp=-3 by hldid: gen spid = empstat if relrefp == 2 sort hldid spid by hldid: replace spid = spid[1] if spid == . by hldid: gen refid = empstat if relrefp == 1 sort hldid refid by hldid: replace refid = refid[1] if refid == . by hldid: replace empsp = refid if relrefp == 2 by hldid: replace empsp = spid if relrefp == 1 replace empsp=-7 if empsp==-3 replace empsp=-8 if empsp==-7 & partid!=-7 * WORKHRS: Hours worked including overtime gen workhrs=999 replace workhrs=horahab if ((horahab>0 & horahab!=.) & (trabajo==1 | trab_aus==1)) replace workhrs=horahab2+workhrs if ((horahab2>0 & horahab2!=.) & (trabajo==1 | trab_aus==1)) replace workhrs=round(workhrs) replace workhrs=-8 if (trabajo==1 | trab_aus==1) & workhrs==999 replace workhrs=-7 if workhrs==999 * EMPINCLM: original monthly income from employment or self-employment gen empinclm=ingres_1 replace empinclm=-8 if empinclm==. | empinclm==8 *OCCUPO: Original occupation gen occupo=cno *ISCO1: ISCO 2008 1-Digit occupation gen isco1=-5 replace isco1=0 if cno==0 /*armed forces occupations*/ replace isco1=1 if cno>=10 & cno<=17 /*managers, senior officials and legislators*/ replace isco1=2 if cno>=20 & cno<=25 /*professionals*/ replace isco1=3 if cno>=26 & cno<=35 /*technicians and associate professionals*/ replace isco1=4 if cno>=40 & cno<=46 /*clerical workers*/ replace isco1=5 if (cno>=50 & con<=53) | cno==78/*service and sales workers*/ replace isco1=6 if cno==60 | cno==61 | cno==62 | cno==63 | cno==94 /*skilled agricultural, fishery, and forestry workers*/ replace isco1=7 if cno==77 | cno==79 /*craft and related trades workers*/ replace isco1=8 if (cno>=70 & cno<=76) | cno==78| (cno>=95 & cno<=98) /*plant and machine operators and assemblers*/ replace isco1=9 if cno>=90 & con<=93 /*elementary occupations*/ replace isco1=-7 if cno==-8 | cno==. * SECTOR: Whether sector of employment is public or private gen sector=-9 * EDUCA: original educational variable gen educa=estudios * EDCAT: harmonised level of education gen edcat=1 if estudios==1 | estudios==2 | estudios==3 replace edcat=2 if estudios==4 replace edcat=3 if (estudios>=5 & estudios<=9) /* 1 no formal education, not able to read or write 2 did not complete primary school 3 completed primary school 4 completed secondary school 5 post-secondary qualification 6 teaching qualification 7 professional qualification 8 university degree 9 higher university degree */ * RUSHED: Whether diarist generally feels rushed gen rushed=-9 * HEALTH: Diarist’s general health. gen health=3 if salud==1 replace health=2 if salud==2 replace health=1 if salud==3 *poor and very poor combined replace health=0 if salud==4 | salud==5 * CARER: Diarist looks after an adult or child with a disability gen carer=0 forval i= 1/144 { replace carer=1 if aprin`i'==391 | aprin`i'==392 | aprin`i'==399 | aprin`i'==425 | /// asecu`i'==391 | asecu`i'==392 | asecu`i'==399 | asecu`i'==425 } * DISAB: Diarist has a disability or long-term limiting health condition. gen disab=-9 * SPPART: time-spent with spouse gen sppart=0 forval i= 1/144 { replace sppart=sppart+1 if pareja`i'==1 } replace sppart=sppart*10 replace sppart=-7 if partid==-7 *drops cases with missing diaries drop if aprin1==. gen error=0 *all hhtype==2 should be civstat==1, not civstat==2 tab civstat if hhtype==2 replace error=1 if hhtype==2 & civstat==2 *check to see if more children than household size replace error=1 if nchild>hhldsize *check to see if young people married tab age if civstat==1 replace error=1 if age<12 & civstat==1 *age of retired (age or retirement is very low for some cases) tab age if retired==1 *replace error=1 if retired==1 & age<50 *famstat=1,2,4 should not be in single person households (hhtype=1) tab famstat if hhtype==1 replace error=1 if hhtype==1 & (famstat==1 | famstat==2 | famstat==4) *famstat=1 and 4 should not be in couple-only households (hhtype=2) tab famstat if hhtype==2 replace error=1 if hhtype==2 & (famstat==1 | famstat==4) *famstat=0,3 should match to agekidx=-7 or 4 & nchild=0, other famstat values *should have no agekidx=-7 or 4 or nchild=0 values tab agekidx if famstat==0 | famstat==3 tab nchild if famstat==0 | famstat==3 replace error=1 if (agekidx==-7 | agekidx==4) & famstat!=0 & famstat!=3 & famstat!=-7 replace error=1 if nchild!=0 & (famstat==0 | famstat==3) *famstat=1 should match to agekidx=1 cases only tab agekidx if famstat==1 replace error=1 if famstat==1 & agekidx!=1 *famstat=2 should match to agekidx=2,3 cases only tab agekidx if famstat==2 replace error=1 if famstat==2 & agekidx!=2 & agekidx!=3 *famstat=4,5 should match to agekidx=1,2 or 3 tab agekidx if famstat==4 | famstat==5 replace error=1 if (famstat==4 | famstat==5) & agekidx!=1 & agekidx!=2 & agekidx!=3 & agekidx!=-8 *all single person households (hhtype==1) should have a household size (hhldsize) of 1 tab hhldsize if hhtype==1 replace error=1 if hhtype==1 & hhldsize>1 * all hhtype==3 should have at least have a household size (hhldsize) of 3 tab hhldsize if hhtype==3 replace error=1 if hhtype==3 & hhldsize<3 & hhldsize!=-7 *all hhtype==2 should be civstat==1, not civstat==2 tab civstat if hhtype==2 replace error=1 if hhtype==2 & civstat==2 *there should be no instances of hhtype==4 and civstat==1 tab hhtype if civstat==1 replace error=1 if hhtype==4 & civstat==1 *there should be no instances of partid==-7 and civstat==1 tab partid if civstat==1 replace error=1 if partid==-7 & civstat==1 *there should be no instances of cohab==-7 and civstat==1 tab cohab if civstat==1 replace error=1 if cohab==-7 & civstat==1 *there should be no instances of cohab==-7 and empsp==-7 tab civstat if empsp==-7 replace error=1 if civstat==1 & empsp==-7 *there should be no instances of relrefp=2 (spouse) and empsp>=0 & empsp<=4 * and partid==-8 | partid==-7 replace error=1 if relrefp==2 & (empsp>=0 & empsp<=4) & (partid==-8 | partid==-7) *there should be no instances of empsp!=-7 and empsp!=-9 and civstat==2 replace error=1 if ((empsp==-8 | (empsp>=1 & empsp<=4)) & civstat==2) *there should be no instances of civstat==2 and cohab==0 or cohab==1 replace error=1 if civstat==2 & (cohab==0 | cohab==1) *there should be no instances of civstat==2 and hhtype==2 replace error=1 if civstat==2 & hhtype==2 *there should be no instances of empsp==-7 and relrefp==2 replace error=1 if empsp==-7 & relrefp==2 *there should be no instances of civstat==2 (not in a relationship) and relrefp==2 (in a relationship) replace error=1 if civstat==2 & relrefp==2 *there should be no instances of emp==1 (in paid work) & empsat==4 (not in paid work) replace error=1 if emp==1 & empstat==4 *there should be no instance of empsp==-7 (no partner) and partid!=-7 replace error=1 if empsp==-7 & partid!=-7 *there should be no instances of empsp!=-7 and empsp!=-9 and civstat==2 replace error=1 if ((empsp==-8 | (empsp>=1 & empsp<=4)) & civstat==2) *there should be no instance of hhtype==2 (couple alone) and hhldsize>2 replace error=1 if hhtype==2 & hhldsize>2 tab error ************************************************************* * Stata syntax to harmonise all the MTUS variable labels * ************************************************************* #delimit; lab var ethnic "Ethnicity"; lab def ethnic -9 "counld not be created"; lab val ethnic ethnic; lab var region "Region of residence"; lab def region 1 "Andalucia" 2 "Aragon" 3 "Asturias (Principado de)" 4 "Balears (Illes)" 5 "Canarias" 6 "Cantabria" 7 "Castilla y Leon" 8 "Castilla-La Mancha" 9 "Catalonia" 10 "Comunidad Valenciana" 11 "Extremadura" 12 "Galicia" 13 "Madrid (Comunidad de)" 14 "Murcia (Region de)" 15 "Navarra (Comunidad Foral de)" 16 "Pais Vasco" 17 "Rioja (La)" 18 "Ceuta y Melilla" ; lab val region region; 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 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 90 "90 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 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 occupo "Original occupations"; lab var isco1 "ISCO1 occupation"; lab def isco1 0 "armed forces occupation" 1 "managers, senior officials and legislators" 2 "professionals" 3 "technicians and associate professionals" 4 "clerical workers" 5 "service and sales workers" 6 "skilled agricultural, fishery, and forestry workers" 7 "craft and related trades workers" 8 "plant and machine operators and assemblers" 9 "elementary occupations" -7 "not applicable/not asked" -8 "missing" -9 "could not be created"; lab val isco1 isco1; 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" -8 "missing" ; lab val educa educa; lab var edcat "Harmonised education"; lab def edcat 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 edcat edcat; 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; #delimit cr compress save ES2009_merge_temp6.dta, replace ********************************************* ** HEF File ** ********************************************* use test2.dta, clear set more off forval i= 1/80 { gen avx`i'=0 gen mainx`i'=0 gen secx`i'=69 } forval i=1/80 { ********************************************* ** AV ACTIVITIES ** ********************************************* * AV1: PAID WORK replace avx`i'=1 if ((aprin_new`i'==111 | aprin_new`i'==121 | aprin_new`i'==129) & (lugar_new`i'!=11 & lugar_new`i'!=12)) | /// (aprin_new`i'==21 & lugar_new`i'==13) * AV2: PAID WORK AT HOME replace avx`i'=2 if ((aprin_new`i'==111 | aprin_new`i'==121 | aprin_new`i'==129) & (lugar_new`i'==11 | lugar_new`i'==12)) | /// (aprin_new`i'==122) * AV4: SCHOOL/CLASSES replace avx`i'=4 if aprin_new`i'==210 | aprin_new`i'==211 * AV5: TRAVEL TO/FROM WORK replace avx`i'=5 if aprin_new`i'==910 | aprin_new`i'==920 * AV6: COOK/WASH UP replace avx`i'=6 if aprin_new`i'==311 | aprin_new`i'==312 * AV7: HOUSEWORK replace avx`i'=7 if aprin_new`i'==300 | aprin_new`i'==321 | aprin_new`i'==322 | aprin_new`i'==323 | aprin_new`i'==329 /// | aprin_new`i'==331 | aprin_new`i'==332 | aprin_new`i'==333 | aprin_new`i'==339 * AV8: OTHER DOMESTIC WORK replace avx`i'=8 if aprin_new`i'==324 | aprin_new`i'==342 | aprin_new`i'==343 /// | aprin_new`i'==351 | aprin_new`i'==352 | aprin_new`i'==353 | aprin_new`i'==354 | aprin_new`i'==359 | aprin_new`i'==371 | /// aprin_new`i'==391 | aprin_new`i'==392 | aprin_new`i'==399 | aprin_new`i'==421 | aprin_new`i'==422 | aprin_new`i'==425 | aprin_new`i'==429 * AV9: GARDENING replace avx`i'=9 if aprin_new`i'==341 | aprin_new`i'==349 * AV10: SHOPPING replace avx`i'=10 if aprin_new`i'==361 | aprin_new`i'==362 | aprin_new`i'==369 * AV11: CHILDCARE replace avx`i'=11 if aprin_new`i'==381 | aprin_new`i'==382 | aprin_new`i'==383 | aprin_new`i'==384 /// | aprin_new`i'==389 | aprin_new`i'==423 | aprin_new`i'==424 * AV12: DOMESTIC TRAVEL replace avx`i'=12 if aprin_new`i'==930 | aprin_new`i'==936 | aprin_new`i'==938 | aprin_new`i'==939 * AV13: DRESS/PERSONAL CARE replace avx`i'=13 if aprin_new`i'==31 | aprin_new`i'==39 * AV14: CONSUME PERSONAL SERVICES replace avx`i'=14 if aprin_new`i'==363 * AV15: MEALS/SNACKS replace avx`i'=15 if ((aprin_new`i'==21) & (lugar_new`i'!=13 & lugar_new`i'!=21)) * AV16: SLEEP replace avx`i'=16 if aprin_new`i'==11 | aprin_new`i'==12 * AV17: FREE TIME TRAVEL replace avx`i'=17 if aprin_new`i'==900 | aprin_new`i'==940 | aprin_new`i'==950 | aprin_new`i'==960 | aprin_new`i'==990 * AV18: EXCURSIONS replace avx`i'=18 if aprin_new`i'==523 | aprin_new`i'==524 | aprin_new`i'==529 * AV19: ACTIVE SPORTS PARTICIPATION replace avx`i'=19 if aprin_new`i'==612 | aprin_new`i'==613 | aprin_new`i'==614 | aprin_new`i'==615 | aprin_new`i'==616 | /// aprin_new`i'==619 | aprin_new`i'==621 | aprin_new`i'==631 * AV20: PASSIVE SPORTS PARTICIPATION replace avx`i'=20 if aprin_new`i'==525 * AV21: WALKING replace avx`i'=21 if aprin_new`i'==344 | aprin_new`i'==611 * AV22: RELIGIOUS ACTIVITIES replace avx`i'=22 if aprin_new`i'==432 * AV23: CIVIC ACTIVITIES replace avx`i'=23 if aprin_new`i'==411 | aprin_new`i'==431 | aprin_new`i'==439 | aprin_new`i'==995 | aprin_new`i'==996 * AV24: CINEMA OR THEATRE replace avx`i'=24 if aprin_new`i'==521 | aprin_new`i'==522 * AV25: DANCES OR PARTIES replace avx`i'=25 if aprin_new`i'==513 * AV28: RESTAURANTS replace avx`i'=28 if (aprin_new`i'==21 & lugar_new`i'==21) * AV29: VISIT FRIENDS AT THEIR HOMES replace avx`i'=29 if ((aprin_new`i'==511 | aprin_new`i'==512 | aprin_new`i'==519) & (lugar_new`i'!=11 & lugar_new`i'!=12)) * AV30: LISTEN TO RADIO replace avx`i'=30 if aprin_new`i'==831 * AV31: WATCH TV OR VIDEO replace avx`i'=31 if aprin_new`i'==821 | aprin_new`i'==822 | aprin_new`i'==829 * AV32: LISTEN TO RECORDS, TAPES, CDS replace avx`i'=32 if aprin_new`i'==832 | aprin_new`i'==839 * AV33: STUDY, HOMEWORK replace avx`i'=33 if aprin_new`i'==200 | aprin_new`i'==212 | aprin_new`i'==221 * AV34: READ BOOKS replace avx`i'=34 if aprin_new`i'==812 * AV35: READ PAPERS, MAGAZINES replace avx`i'=35 if aprin_new`i'==811 | aprin_new`i'==819 * AV36: RELAX replace avx`i'=36 if aprin_new`i'==531 | aprin_new`i'==998 * AV37: CONVERSATION replace avx`i'=37 if aprin_new`i'==514 * AV38: ENTERTAIN FRIENDS AT HOME replace avx`i'=38 if (aprin_new`i'==732) | ((aprin_new`i'==511 | aprin_new`i'==512 | aprin_new`i'==519) & (lugar_new`i'==11 | lugar_new`i'==12)) * AV40: OTHER LEISURE replace avx`i'=40 if aprin_new`i'==711 | aprin_new`i'==712 | aprin_new`i'==713 | aprin_new`i'==719 | aprin_new`i'==721 | /// aprin_new`i'==722 | aprin_new`i'==723 | aprin_new`i'==729 | aprin_new`i'==731 | aprin_new`i'==733 | aprin_new`i'==739 | aprin_new`i'==997 * AV41: UNCLASSIFIED OR MISSING ACTIVITIES replace avx`i'=41 if aprin_new`i'==999 ********************************************* ** MAIN ACTIVITIES ** ********************************************* * MAIN2: SLEEP AND NAPS replace mainx`i'=2 if aprin_new`i'==11 | aprin_new`i'==12 * MAIN4: WASH, DRESS, CARE FOR SELF replace mainx`i'=4 if aprin_new`i'==31 | aprin_new`i'==39 * MAIN5: MEALS AT WORK OR SCHOOL replace mainx`i'=5 if (aprin_new`i'==21 & lugar_new`i'==13) | (aprin_new`i'==121 & lenght_minute_new`i'>30) * MAIN6: OTHER MEALS OR SNACKS replace mainx`i'=6 if (aprin_new`i'==21 & lugar_new`i'!=13 & lugar_new`i'!=21) * MAIN7: PAID WORK - MAIN JOB (NOT AT HOME) replace mainx`i'=7 if (aprin_new`i'==111 & lugar_new`i'!=11 & lugar_new`i'!=12 & /// lugar_new`i'!=33 & lugar_new`i'!=34 & lugar_new`i'!=39 & lugar_new`i'!=41 & lugar_new`i'!=31 & lugar_new`i'!=32 & lugar_new`i'!=30) * MAIN8: PAID WORK AT HOME replace mainx`i'=8 if ((aprin_new`i'==111) & (lugar_new`i'==11 | lugar_new`i'==12)) * MAIN11: TRAVEL AS A PART OF WORK replace mainx`i'=11 if ((aprin_new`i'==111) & (lugar_new`i'==33 | lugar_new`i'==34 | lugar_new`i'==39 | /// lugar_new`i'==41 | lugar_new`i'==31 | lugar_new`i'==32 | lugar_new`i'==30)) * MAIN12: WORK BREAKS replace mainx`i'=12 if (aprin_new`i'==121 & lenght_minute_new`i'<=30) * MAIN13: OTHER TIME AT WORKPLACE replace mainx`i'=13 if aprin_new`i'==129 * MAIN14: LOOK FOR WORK replace mainx`i'=14 if aprin_new`i'==122 * MAIN15: REGULAR SCHOOLING, EDUCATION replace mainx`i'=15 if aprin_new`i'==211 * MAIN16: HOMEWORK replace mainx`i'=16 if aprin_new`i'==200 | aprin_new`i'==212 * MAIN17: LEISURE/OTHER EDUCATION TRAINING replace mainx`i'=17 if aprin_new`i'==210 | aprin_new`i'==221 * MAIN18: FOOD PREPARATION, COOK replace mainx`i'=18 if aprin_new`i'==311 * MAIN19: SET TABLE, WASH/PUT AWAY DISHES replace mainx`i'=19 if aprin_new`i'==312 * MAIN20: CLEANING replace mainx`i'=20 if aprin_new`i'==321 | aprin_new`i'==322 * MAIN21: LAUNDRY, IRONING, CLOTHING REPAIR replace mainx`i'=21 if aprin_new`i'==331 | aprin_new`i'==332 | aprin_new`i'==333 | aprin_new`i'==339 * MAIN22: MAINTAIN HOME / VEHICLE replace mainx`i'=22 if aprin_new`i'==323 | aprin_new`i'==342 | aprin_new`i'==351 | aprin_new`i'==352 | /// aprin_new`i'==353 | aprin_new`i'==354 | aprin_new`i'==359 * MAIN23: OTHER DOMESTIC WORK replace mainx`i'=23 if aprin_new`i'==300 | aprin_new`i'==324 | aprin_new`i'==329 | aprin_new`i'==371 * MAIN24: PURCHASE GOODS replace mainx`i'=24 if aprin_new`i'==361 | aprin_new`i'==369 * MAIN25: CONSUME PERSONAL CARE SERVICES replace mainx`i'=25 if aprin_new`i'==363 * MAIN26: CONSUME OTHER SERVICES replace mainx`i'=26 if aprin_new`i'==362 * MAIN27: PET CARE (NOT WALK DOG) replace mainx`i'=27 if aprin_new`i'==343 * MAIN28: PHYSICAL, MEDICAL CHILD CARE replace mainx`i'=28 if aprin_new`i'==381 | aprin_new`i'==423 | aprin_new`i'==424 * MAIN29: TEACH, HELP WITH HOMEWORK replace mainx`i'=29 if aprin_new`i'==382 * MAIN30: READ TO, TALK OR PLAY WITH CHILDREN replace mainx`i'=30 if aprin_new`i'==383 * MAIN31: SUPERVISE, ACCOMPANY, OTHER CHILD CARE replace mainx`i'=31 if aprin_new`i'==384 | aprin_new`i'==389 * MAIN32: ADULT CARE replace mainx`i'=32 if aprin_new`i'==391 | aprin_new`i'==392 | aprin_new`i'==399 | /// aprin_new`i'==421 | aprin_new`i'==422 | aprin_new`i'==425 | aprin_new`i'==429 * MAIN33: VOLUNTARY, CIVIC ORGANIZATIONAL ACT replace mainx`i'=33 if aprin_new`i'==411 | aprin_new`i'==431 | /// aprin_new`i'==439 | aprin_new`i'==995 | aprin_new`i'==996 * MAIN34: WORSHIP AND RELIGION replace mainx`i'=34 if aprin_new`i'==432 * MAIN35: GENERAL OUT-OF-HOME LEISURE replace mainx`i'=35 if (aprin_new`i'==529 & lugar_new`i'!=11 & lugar_new`i'!=12) * MAIN36: ATTENDING SPORTING EVENT replace mainx`i'=36 if aprin_new`i'==525 * MAIN37: CINEMA, THEATRE, OPERA, CONCERT replace mainx`i'=37 if aprin_new`i'==521 | aprin_new`i'==522 * MAIN38: OTHER PUBLIC EVENT, VENUE replace mainx`i'=38 if aprin_new`i'==523 | aprin_new`i'==524 * MAIN39: RESTAURANT, CAFE, BAR, PUB replace mainx`i'=39 if (aprin_new`i'==21 & lugar_new`i'==21) * MAIN40: PARTY, SOCIAL EVENT, GAMBLING replace mainx`i'=40 if aprin_new`i'==513 * MAIN42: GENERAL SPORT OR EXERCISE replace mainx`i'=42 if ((aprin_new`i'==612 | aprin_new`i'==614 | aprin_new`i'==615 | aprin_new`i'==616 /// | aprin_new`i'==619 | aprin_new`i'==631) | (aprin_new`i'==613 & lugar_new`i'!=32)) * MAIN43: WALKING replace mainx`i'=43 if aprin_new`i'==611 * MAIN44: CYCLING replace mainx`i'=44 if (aprin_new`i'==613 & lugar_new`i'==32) * MAIN46: GARDENING / PICK MUSHROOMS replace mainx`i'=46 if aprin_new`i'==341 | aprin_new`i'==349 | aprin_new`i'==621 * MAIN47: WALK DOGS replace mainx`i'=47 if aprin_new`i'==344 * MAIN48: RECEIVE OR VISIT FRIENDS replace mainx`i'=48 if aprin_new`i'==512 | aprin_new`i'==519 * MAIN49: CONVERSATION (IN PERSON, PHONE) replace mainx`i'=49 if aprin_new`i'==514 * MAIN50: OTHER IN-HOME, SOCIAL GAMES replace mainx`i'=50 if aprin_new`i'==511 | aprin_new`i'==731 | aprin_new`i'==732 | aprin_new`i'==739 * MAIN51: GENERAL INDOOR LEISURE replace mainx`i'=51 if ((aprin_new`i'==529 & (lugar_new`i'==11 | lugar_new`i'==12)) | aprin_new`i'==997 | aprin_new`i'==998) * MAIN52: ART OR MUSIC replace mainx`i'=52 if aprin_new`i'==711 * MAIN53: CORRESPONDENSE (NOT E-LAB MAIL) replace mainx`i'=53 if aprin_new`i'==713 * MAIN54: KNIT, CRAFTS OR HOBBIES replace mainx`i'=54 if aprin_new`i'==712 | aprin_new`i'==719 * MAIN55: RELAX, THINK, DO NOTHING replace mainx`i'=55 if aprin_new`i'==531 * MAIN56: READ replace mainx`i'=56 if aprin_new`i'==811 | aprin_new`i'==812 | aprin_new`i'==819 * MAIN57: LISTEN TO MUSIC ETC. replace mainx`i'=57 if aprin_new`i'==832 | aprin_new`i'==839 * MAIN58: LISTEN TO RADIO replace mainx`i'=58 if aprin_new`i'==831 * MAIN59: WATCH TV, VIDEO, DVD replace mainx`i'=59 if aprin_new`i'==821 | aprin_new`i'==822 | aprin_new`i'==829 * MAIN60: COMPUTER GAMES replace mainx`i'=60 if aprin_new`i'==733 * MAIN61: E-LAB MAIL, SURF INTERNET, COMPUTING replace mainx`i'=61 if aprin_new`i'==721 | aprin_new`i'==722 | aprin_new`i'==723 | aprin_new`i'==729 * MAIN63: TRAVEL TO/FROM WORK replace mainx`i'=63 if aprin_new`i'==910 * MAIN64: EDUCATIONAL TRAVEL replace mainx`i'=64 if aprin_new`i'==920 * MAIN65: VOLUNTARY / CIVIC / RELIGIOUS TRAVEL replace mainx`i'=65 if aprin_new`i'==940 * MAIN66: CHILD / ADULT CARE TRAVEL replace mainx`i'=66 if aprin_new`i'==938 | aprin_new`i'==939 * MAIN67: SHOP PERSON / HOUSEHOLD CARE TRAVEL replace mainx`i'=67 if aprin_new`i'==930 | aprin_new`i'==936 * MAIN68: OTHER TRAVEL replace mainx`i'=68 if aprin_new`i'==900 | aprin_new`i'==950 | aprin_new`i'==960 | aprin_new`i'==990 * MAIN69: NO RECORDED ACTIVITY replace mainx`i'=69 if aprin_new`i'==999 ********************************************* ** SEC ACTIVITIES ** ********************************************* * SEC2: SLEEP AND NAPS replace secx`i'=2 if asecu_new`i'==11 | asecu_new`i'==12 * SEC4: WASH, DRESS, CARE FOR SELF replace secx`i'=4 if asecu_new`i'==31 | asecu_new`i'==39 * SEC5: MEALS AT WORK OR SCHOOL replace secx`i'=5 if (asecu_new`i'==21 & lugar_new`i'==13) | (asecu_new`i'==121 & lenght_minute_new`i'>30) * SEC6: OTHER MEALS OR SNACKS replace secx`i'=6 if (asecu_new`i'==21 & lugar_new`i'!=13 & lugar_new`i'!=21) * SEC7: PAID WORK - sec JOB (NOT AT HOME) replace secx`i'=7 if (asecu_new`i'==111 & lugar_new`i'!=11 & lugar_new`i'!=12 & /// lugar_new`i'!=33 & lugar_new`i'!=34 & lugar_new`i'!=39 & lugar_new`i'!=41 & lugar_new`i'!=31 & lugar_new`i'!=32 & lugar_new`i'!=30) * SEC8: PAID WORK AT HOME replace secx`i'=8 if ((asecu_new`i'==111) & (lugar_new`i'==11 | lugar_new`i'==12)) * SEC11: TRAVEL AS A PART OF WORK replace mainx`i'=11 if ((asecu_new`i'==111) & (lugar_new`i'==33 | lugar_new`i'==34 | lugar_new`i'==39 | /// lugar_new`i'==41 | lugar_new`i'==31 | lugar_new`i'==32 | lugar_new`i'==30)) * SEC12: WORK BREAKS replace secx`i'=12 if (asecu_new`i'==121 & lenght_minute_new`i'<=30) * SEC13: OTHER TIME AT WORKPLACE replace secx`i'=13 if asecu_new`i'==129 * SEC14: LOOK FOR WORK replace secx`i'=14 if asecu_new`i'==122 * SEC15: REGULAR SCHOOLING, EDUCATION replace secx`i'=15 if asecu_new`i'==211 * SEC16: HOMEWORK replace secx`i'=16 if asecu_new`i'==200 | asecu_new`i'==212 * SEC17: LEISURE/OTHER EDUCATION TRAINING replace secx`i'=17 if asecu_new`i'==210 | asecu_new`i'==221 * SEC18: FOOD PREPARATION, COOK replace secx`i'=18 if asecu_new`i'==311 * SEC19: SET TABLE, WASH/PUT AWAY DISHES replace secx`i'=19 if asecu_new`i'==312 * SEC20: CLEANING replace secx`i'=20 if asecu_new`i'==321 | asecu_new`i'==322 * SEC21: LAUNDRY, IRONING, CLOTHING REPAIR replace secx`i'=21 if asecu_new`i'==331 | asecu_new`i'==332 | asecu_new`i'==333 | asecu_new`i'==339 * SEC22: MAINTAIN HOME / VEHICLE replace secx`i'=22 if asecu_new`i'==323 | asecu_new`i'==342 | asecu_new`i'==351 | asecu_new`i'==352 | /// asecu_new`i'==353 | asecu_new`i'==354 | asecu_new`i'==359 * SEC23: OTHER DOMESTIC WORK replace secx`i'=23 if asecu_new`i'==300 | asecu_new`i'==324 | asecu_new`i'==329 | asecu_new`i'==371 * SEC24: PURCHASE GOODS replace secx`i'=24 if asecu_new`i'==361 | asecu_new`i'==369 * SEC25: CONSUME PERSONAL CARE SERVICES replace secx`i'=25 if asecu_new`i'==363 * SEC26: CONSUME OTHER SERVICES replace secx`i'=26 if asecu_new`i'==362 * SEC27: PET CARE (NOT WALK DOG) replace secx`i'=27 if asecu_new`i'==343 * SEC28: PHYSICAL, MEDICAL CHILD CARE replace secx`i'=28 if asecu_new`i'==381 | asecu_new`i'==423 | asecu_new`i'==424 * SEC29: TEACH, HELP WITH HOMEWORK replace secx`i'=29 if asecu_new`i'==382 * SEC30: READ TO, TALK OR PLAY WITH CHILDREN replace secx`i'=30 if asecu_new`i'==383 * SEC31: SUPERVISE, ACCOMPANY, OTHER CHILD CARE replace secx`i'=31 if asecu_new`i'==384 | asecu_new`i'==389 * SEC32: ADULT CARE replace secx`i'=32 if asecu_new`i'==391 | asecu_new`i'==392 | asecu_new`i'==399 | /// asecu_new`i'==421 | asecu_new`i'==422 | asecu_new`i'==425 | asecu_new`i'==429 * SEC33: VOLUNTARY, CIVIC ORGANIZATIONAL ACT replace secx`i'=33 if asecu_new`i'==411 | asecu_new`i'==431 | /// asecu_new`i'==439 | asecu_new`i'==995 | asecu_new`i'==996 * SEC34: WORSHIP AND RELIGION replace secx`i'=34 if asecu_new`i'==432 * SEC35: GENERAL OUT-OF-HOME LEISURE replace secx`i'=35 if (asecu_new`i'==529 & lugar_new`i'!=11 & lugar_new`i'!=12) * SEC36: ATTENDING SPORTING EVENT replace secx`i'=36 if asecu_new`i'==525 * SEC37: CINEMA, THEATRE, OPERA, CONCERT replace secx`i'=37 if asecu_new`i'==521 | asecu_new`i'==522 * SEC38: OTHER PUBLIC EVENT, VENUE replace secx`i'=38 if asecu_new`i'==523 | asecu_new`i'==524 * SEC39: RESTAURANT, CAFE, BAR, PUB replace secx`i'=39 if (asecu_new`i'==21 & lugar_new`i'==21) * SEC40: PARTY, SOCIAL EVENT, GAMBLING replace secx`i'=40 if asecu_new`i'==513 * SEC42: GENERAL SPORT OR EXERCISE replace secx`i'=42 if ((asecu_new`i'==612 | asecu_new`i'==614 | asecu_new`i'==615 | asecu_new`i'==616 /// | asecu_new`i'==619 | asecu_new`i'==631) | (asecu_new`i'==613 & lugar_new`i'!=32)) * SEC43: WALKING replace secx`i'=43 if asecu_new`i'==611 * SEC44: CYCLING replace secx`i'=44 if (asecu_new`i'==613 & lugar_new`i'==32) * SEC46: GARDENING / PICK MUSHROOMS replace secx`i'=46 if asecu_new`i'==341 | asecu_new`i'==349 | asecu_new`i'==621 * SEC47: WALK DOGS replace secx`i'=47 if asecu_new`i'==344 * SEC48: RECEIVE OR VISIT FRIENDS replace secx`i'=48 if asecu_new`i'==512 | asecu_new`i'==519 * SEC49: CONVERSATION (IN PERSON, PHONE) replace secx`i'=49 if asecu_new`i'==514 * SEC50: OTHER IN-HOME, SOCIAL GAMES replace secx`i'=50 if asecu_new`i'==511 | asecu_new`i'==731 | asecu_new`i'==732 | asecu_new`i'==739 * SEC51: GENERAL INDOOR LEISURE replace secx`i'=51 if ((asecu_new`i'==529 & (lugar_new`i'==11 | lugar_new`i'==12)) | asecu_new`i'==997 | asecu_new`i'==998) * SEC52: ART OR MUSIC replace secx`i'=52 if asecu_new`i'==711 * SEC53: CORRESPONDENSE (NOT E-LAB MAIL) replace secx`i'=53 if asecu_new`i'==713 * SEC54: KNIT, CRAFTS OR HOBBIES replace secx`i'=54 if asecu_new`i'==712 | asecu_new`i'==719 * SEC55: RELAX, THINK, DO NOTHING replace secx`i'=55 if asecu_new`i'==531 * SEC56: READ replace secx`i'=56 if asecu_new`i'==811 | asecu_new`i'==812 | asecu_new`i'==819 * SEC57: LISTEN TO MUSIC ETC. replace secx`i'=57 if asecu_new`i'==832 | asecu_new`i'==839 * SEC58: LISTEN TO RADIO replace secx`i'=58 if asecu_new`i'==831 * SEC59: WATCH TV, VIDEO, DVD replace secx`i'=59 if asecu_new`i'==821 | asecu_new`i'==822 | asecu_new`i'==829 * SEC60: COMPUTER GAMES replace secx`i'=60 if asecu_new`i'==733 * SEC61: E-LAB MAIL, SURF INTERNET, COMPUTING replace secx`i'=61 if asecu_new`i'==721 | asecu_new`i'==722 | asecu_new`i'==723 | asecu_new`i'==729 * SEC63: TRAVEL TO/FROM WORK replace secx`i'=63 if asecu_new`i'==910 * SEC64: EDUCATIONAL TRAVEL replace secx`i'=64 if asecu_new`i'==920 * SEC65: VOLUNTARY / CIVIC / RELIGIOUS TRAVEL replace secx`i'=65 if asecu_new`i'==940 * SEC66: CHILD / ADULT CARE TRAVEL replace secx`i'=66 if asecu_new`i'==938 | asecu_new`i'==939 * SEC67: SHOP PERSON / HOUSEHOLD CARE TRAVEL replace secx`i'=67 if asecu_new`i'==930 | asecu_new`i'==936 * SEC68: OTHER TRAVEL replace secx`i'=68 if asecu_new`i'==900 | asecu_new`i'==950 | asecu_new`i'==960 | asecu_new`i'==990 * SEC69: NO RECORDED ACTIVITY replace secx`i'=69 if asecu_new`i'==999 } * CDAY * gen cday=-9 compress drop unique gen unique=(idhogar*100)+npers * RESHAPE TO LONG FORMAT keep country survey swave msamp hldid persid id day cday month year diary sex /// age mainx* avx* secx* lugar_new* aprin_new* asecu_new* solo_new* pareja_new* padres_new* /// menor_new* otmh_new* otcon_new* start_minute_new* end_minute_new* lenght_minute_new* unique reshape long mainx avx secx lugar_new aprin_new asecu_new solo_new pareja_new padres_new /// menor_new otmh_new otcon_new start_minute_new end_minute_new lenght_minute_new, i(unique) j(epnum) set more off * START * gen start=start_minute_new * END * gen end=end_minute_new * TIME * generate time=lenght_minute_new * CLOCKST * gen clockst_temp=0 replace clockst_temp=360+start_minute_new if start_minute_new<=1200 replace clockst_temp=start_minute_new-1200 if start_minute_new>=1200 gen clockst_hour=trunc(clockst_temp/60) gen clockst_minute=((clockst_temp-(clockst_hour*60))*0.01) gen clockst=clockst_hour+clockst_minute format clockst %12.2f * MAIN * rename mainx main * SEC* rename secx sec * AV * rename avx av * INOUT * generate inout=-8 replace inout=1 if lugar_new==11 | lugar_new==12 | lugar_new==13 | lugar_new==14 | lugar_new==21 | lugar_new==22 | lugar_new==23 | lugar_new==25 replace inout=2 if lugar_new==24 | lugar_new==26 | lugar_new==31 | lugar_new==32 replace inout=3 if lugar_new==33 | lugar_new==34 | lugar_new==39 | lugar_new==41 replace inout=1 if inout==-8 & (aprin_new==11 | aprin_new==12 | aprin_new==31 | aprin_new==39 | aprin_new==524 | aprin_new==721 /// | asecu_new==11 | asecu_new==12 | asecu_new==31 | asecu_new==39 | asecu_new==524 | asecu_new==721) replace inout=2 if inout==-8 & (aprin_new==322 | aprin_new==341 | aprin_new==344 | aprin_new==611 | aprin_new==612 | aprin_new==613 | /// aprin_new==621 | asecu_new==322 | asecu_new==341 | asecu_new==344 | asecu_new==611 | asecu_new==612 | asecu_new==613 | asecu_new==621) * ELOC * generate eloc=-8 replace eloc=1 if lugar_new==11 | lugar_new==12 replace eloc=2 if lugar_new==14 replace eloc=3 if lugar_new==13 & (aprin_new!=211 & asecu_new!=211) replace eloc=4 if lugar_new==13 & (aprin_new==211 | asecu_new==211) replace eloc=5 if lugar_new==22 | lugar_new==23 replace eloc=6 if lugar_new==21 replace eloc=7 if lugar_new==29 & (aprin_new==432 | asecu_new==432) replace eloc=8 if lugar_new==30 | lugar_new==31 | lugar_new==32 | lugar_new==33 | lugar_new==34 | lugar_new==39 | lugar_new==41 replace eloc=9 if lugar_new==24 | lugar_new==25 | lugar_new==26 | (lugar_new==29 & (aprin_new!=432 & asecu_new!=432)) * ICT * gen ict=0 replace ict=1 if aprin_new==721 | aprin_new==722 | aprin_new==723 | aprin_new==729 | aprin_new==733 | /// asecu_new==721 | asecu_new==722 | asecu_new==723 | asecu_new==729 | asecu_new==733 * MTRAV * gen mtrav=-7 replace mtrav=1 if lugar_new==33 | lugar_new==34 | lugar_new==39 replace mtrav=2 if lugar_new==41 replace mtrav=3 if lugar_new==31 replace mtrav=4 if lugar_new==32 replace mtrav=5 if lugar_new==30 * ALONE * generate alone=0 replace alone=1 if solo==1 & (menor_new!=1 & pareja_new!=1 & padres_new!=1) * CHILD * generate child=0 replace child=1 if menor_new==1 * SPPART * generate sppart=0 replace sppart=1 if pareja_new==1 * OAD * gen oad=0 replace oad=1 if padres_new==1 label drop intervalo drop if start==. * SEC62: NO ACT BUT RECORDED TRANSPORT MODE sort unique epnum replace sec=62 if ((hldid==hldid[_n-1] & unique==unique[_n-1] & main!=11 & main!=63 & main!=64 & main!=65 & main!=66 & main!=67 & main!=68 & /// main[_n-1]!=11 & main[_n-1]!=63 & main[_n-1]!=64 & main[_n-1]!=65 & main[_n-1]!=66 & main[_n-1]!=67 & main[_n-1]!=68 & mtrav==-7 & mtrav[_n-1]==-7) & /// ((eloc[_n-1]==1 & eloc!=1 & eloc!=-8) | (eloc[_n-1]!=1 & eloc[_n-1]!=-8 & eloc[_n-1]!=6 & eloc!=1 & eloc!=-8 & eloc!=eloc[_n-1]))) gsort unique-epnum replace sec=62 if ((hldid==hldid[_n-1] & unique==unique[_n-1] & main!=11 & main!=63 & main!=64 & main!=65 & main!=66 & main!=67 & main!=68 & /// main[_n-1]!=11 & main[_n-1]!=63 & main[_n-1]!=64 & main[_n-1]!=65 & main[_n-1]!=66 & main[_n-1]!=67 & main[_n-1]!=68 & mtrav==-7 & mtrav[_n-1]==-7) & /// (eloc[_n-1]==1 & eloc!=1 & eloc!=-8)) sort unique epnum compress save ES2009templong.dta, replace use ES2009templong.dta, clear keep unique epnum sec reshape wide sec, i(unique) j(epnum) merge 1:1 unique using ES2009_merge_temp6.dta drop _merge ********************************************* ** DIARY QUALITY CHECK ** ********************************************* set more off *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 gen number_episodes=0 forval i= 1/80 { replace number_episodes=number_episodes+1 if aprin_new`i'!=. } *2+ OR MORE OF THESE BASIC ACTIVITIES MISSING: SLEEP OR REST, EATING OR DRINKING, PERSONAL CARE, TRAVEL/EXERCISE gen sleep=0 forval i= 1/144 { replace sleep=sleep+1 if aprin`i'==11 | aprin`i'==12 } replace sleep=sleep*10 gen travel_exercise=0 forval i= 1/144 { replace travel_exercise=travel_exercise+1 if aprin`i'==341 | aprin`i'==344 | aprin`i'==349 | /// aprin`i'==611 | aprin`i'==612 | aprin`i'==613 | aprin`i'==614 | aprin`i'==615 | aprin`i'==616 | /// aprin`i'==619 | aprin`i'==621 | aprin`i'==631 | aprin`i'==900 | aprin`i'==910 | aprin`i'==920 | /// aprin`i'==930 | aprin`i'==936 | aprin`i'==938 | aprin`i'==939 | aprin`i'==940 | aprin`i'==950 | /// aprin`i'==960 | aprin`i'==990 | /// asecu`i'==341 | asecu`i'==344 | asecu`i'==349 | asecu`i'==611 | asecu`i'==612 | asecu`i'==613 | /// asecu`i'==614 | asecu`i'==615 | asecu`i'==616 | asecu`i'==619 | asecu`i'==621 | asecu`i'==631 | /// asecu`i'==900 | asecu`i'==910 | asecu`i'==920 | asecu`i'==930 | asecu`i'==936 | asecu`i'==938 | /// asecu`i'==939 | asecu`i'==940 | asecu`i'==950 | asecu`i'==960 | asecu`i'==990 | /// lugar`i'==30 | lugar`i'==31 | lugar`i'==32 | lugar`i'==33 | lugar`i'==34 | lugar`i'==39 | lugar`i'==41 } forval i= 1/80 { replace travel_exercise=travel_exercise+1 if sec`i'==62 } replace travel_exercise=travel_exercise*10 gen eating_drinking=0 forval i= 1/144 { replace eating_drinking=eating_drinking+1 if aprin`i'==21 | aprin`i'==121 | aprin`i'==311 | /// asecu`i'==21 | asecu`i'==121 | asecu`i'==311 | lugar`i'==21 } replace eating_drinking=eating_drinking*10 gen personal_care=0 forval i= 1/144 { replace personal_care=personal_care+1 if aprin`i'==31 | aprin`i'==39 | aprin`i'==363 | /// asecu`i'==31 | asecu`i'==39 | asecu`i'==363 } replace personal_care=personal_care*10 gen other_care=0 forval i= 1/144 { replace other_care=other_care+1 if aprin`i'==342 | aprin`i'==343 | aprin`i'==344 | aprin`i'==381 | /// aprin`i'==382 | aprin`i'==383 | aprin`i'==384 | aprin`i'==389 | aprin`i'==391 | aprin`i'==392 | /// aprin`i'==399 | aprin`i'==421 | aprin`i'==422 | aprin`i'==423 | aprin`i'==424 | aprin`i'==425 | /// aprin`i'==429 | aprin`i'==938 | aprin`i'==939 | /// asecu`i'==342 | asecu`i'==343 | asecu`i'==344 | asecu`i'==381 | /// asecu`i'==382 | asecu`i'==383 | asecu`i'==384 | asecu`i'==389 | asecu`i'==391 | asecu`i'==392 | /// asecu`i'==399 | asecu`i'==421 | asecu`i'==422 | asecu`i'==423 | asecu`i'==424 | asecu`i'==425 | /// asecu`i'==429 | asecu`i'==938 | asecu`i'==939 | /// lugar`i'==30 | lugar`i'==31 | lugar`i'==32 | lugar`i'==33 | lugar`i'==34 | lugar`i'==39 | lugar`i'==41 } replace other_care=other_care*10 *TIME AT HOME gen athome=0 forval i= 1/144 { replace athome=athome+1 if lugar`i'==11 | lugar`i'==12 } replace athome=athome*10 *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 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 ************************************************************************************************************************************** *ORIGINAL WEIGHT generate ocombwt=factorf 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 #delimit; 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 ocombwt "Original weight"; lab var propwt "Proposed weight"; #delimit cr save ES2009_merge_temp7.dta, replace keep unique badcase sec* reshape long sec, i(unique) j(epnum) drop sec save ES2009_badcase_temp.dta, replace ** WE NOW SAVE THE HAF DATASETS ****************************** set more off * Race and Region Files * use ES2009_merge_temp7.dta, clear keep country survey swave msamp hldid persid region ethnic order country survey swave msamp hldid persid region ethnic sort swave msamp hldid persid compress save Region-Race-ES2009.dta, replace * HAF * use ES2009_merge_temp7.dta, clear keep country survey swave msamp hldid persid id parntid1 parntid2 partid day /// month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig /// income ownhome urban computer vehicle sex age famstat singpar relrefp civstat /// cohab citizen empstat emp unemp student retired empsp workhrs empinclm occupo /// isco1 sector educa edcat rushed health carer disab main1 main2 main3 main4 /// main5 main6 main7 main8 main9 main10 main11 main12 main13 main14 main15 /// main16 main17 main18 main19 main20 main21 main22 main23 main24 main25 main26 /// main27 main28 main29 main30 main31 main32 main33 main34 main35 main36 main37 /// main38 main39 main40 main41 main42 main43 main44 main45 main46 main47 main48 /// main49 main50 main51 main52 main53 main54 main55 main56 main57 main58 main59 /// main60 main61 main62 main63 main64 main65 main66 main67 main68 main69 av1 av2 /// av3 av4 av5 av6 av7 av8 av9 av10 av11 av12 av13 av14 av15 av16 av17 av18 av19 /// av20 av21 av22 av23 av24 av25 av26 av27 av28 av29 av30 av31 av32 av33 av34 /// av35 av36 av37 av38 av39 av40 av41 sppart ocombwt propwt order country survey swave msamp hldid persid id parntid1 parntid2 partid day /// month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig /// income ownhome urban computer vehicle sex age famstat singpar relrefp civstat /// cohab citizen empstat emp unemp student retired empsp workhrs empinclm occupo /// isco1 sector educa edcat rushed health carer disab main1 main2 main3 main4 /// main5 main6 main7 main8 main9 main10 main11 main12 main13 main14 main15 /// main16 main17 main18 main19 main20 main21 main22 main23 main24 main25 main26 /// main27 main28 main29 main30 main31 main32 main33 main34 main35 main36 main37 /// main38 main39 main40 main41 main42 main43 main44 main45 main46 main47 main48 /// main49 main50 main51 main52 main53 main54 main55 main56 main57 main58 main59 /// main60 main61 main62 main63 main64 main65 main66 main67 main68 main69 av1 av2 /// av3 av4 av5 av6 av7 av8 av9 av10 av11 av12 av13 av14 av15 av16 av17 av18 av19 /// av20 av21 av22 av23 av24 av25 av26 av27 av28 av29 av30 av31 av32 av33 av34 av35 /// av36 av37 av38 av39 av40 av41 sppart ocombwt propwt sort swave msamp hldid persid id compress save ES2009haf.dta, replace ** WE NOW SAVE THE W6 DATASETS ****************************** set more off * HEF * use ES2009templong.dta, replace merge 1:1 unique epnum using ES2009_badcase_temp.dta drop if start==. keep country 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 save ES2009hef.dta, replace *delete temporary files erase diario2_wide_temp.dta erase ES2009templong.dta erase ES2009_merge_temp1.dta erase ES2009_merge_temp2.dta erase ES2009_merge_temp3.dta erase ES2009_merge_temp4.dta erase ES2009_merge_temp5.dta erase ES2009_merge_temp6.dta erase ES2009_merge_temp7.dta erase ES2009_badcase_temp.dta