********************************************************************* ********************* UK2014 -> MTUSX ******************************* ********************************************************************* ********************** * EPISODIC FOR MTUSX * ********************** * country* gen country= "UK" * survey* gen survey= 2014 *swave* gen swave=0 * msamp* gen msamp=0 * main * gen main = . *replace main = 1 replace main = 2 if act1_ == 110|act1_ == 111|act1_ == 120 *replace main = 3 replace main = 4 if act1_ == 0|act1_ == 300|act1_ == 310|act1_ == 390 replace main = 5 if (act1_ == 1310)|(act1_ == 210 & wher_ == 13) replace main = 6 if act1_ == 210 & wher_ != 13 replace main = 7 if (act1_ == 1000|act1_ == 1100|act1_ == 1110|act1_ == 1300) /// & (wher_ != 11 & wher_ != 12) //job1 replace main = 8 if (act1_ == 1000|act1_ == 1100|act1_ == 1110|act1_ == 1120|act1_ == 1210 /// |act1_ == 1220|act1_ == 1300|act1_ == 1390|act1_ == 1399) & (wher_ == 11|wher_ == 12) //job12home replace main = 9 if act1_ == 1210 & (wher_ != 11 & wher_ != 12) //job2 *replace main = 10 replace main = 11 if act1_ == 9110 replace main = 12 if (act1_ == 1120|act1_ == 1220) & (wher_ != 11 & wher_ != 12) replace main = 13 if (act1_ == 1390|act1_ == 1399) & (wher_ != 11 & wher_ != 12) replace main = 14 if act1_ == 1391 replace main = 15 if act1_ == 2100|act1_ == 2110|act1_ == 2190 replace main = 16 if act1_ == 2000|act1_ == 2120|act1_ == 2210 *replace main = 17 replace main = 18 if act1_ == 3100|act1_ == 3110|act1_ == 3120|act1_ == 3140 replace main = 19 if act1_ == 3130|act1_ == 3190 replace main = 20 if act1_ == 3210|act1_ == 3220|act1_ == 3250 replace main = 21 if act1_ == 3300|act1_ == 3310|act1_ == 3320|act1_ == 3390 replace main = 22 if act1_ == 3200|act1_ == 3230|act1_ == 3290|act1_ == 3420 /// |act1_ == 3500|act1_ == 3510|act1_ == 3520|act1_ == 3530|act1_ == 3539 /// |act1_ == 3540|act1_ == 3590 replace main = 23 if act1_ == 3000|act1_ == 3240|act1_ == 3710|act1_ == 3713 replace main = 23 if act1_ == 3720|act1_ == 3727|act1_ == 3729 //hh management using internet replace main = 24 if act1_ == 3600|act1_ == 3610|act1_ == 3611|act1_ == 3612 /// |act1_ == 3613|act1_ == 3614|act1_ == 3615|act1_ == 3619|act1_ == 3690 replace main = 24 if act1_ == 3721|act1_ == 3722|act1_ == 3723|act1_ == 3724 /// |act1_ == 3725|act1_ == 3726 //shopping using internet replace main = 25 if act1_ == 3630 replace main = 26 if act1_ == 3620 replace main = 27 if act1_ == 3430 replace main = 28 if act1_ == 3800|act1_ == 3810|act1_ == 3811|act1_ == 3819 replace main = 29 if act1_ == 3820 replace main = 30 if act1_ == 3830 replace main = 31 if act1_ == 3840|act1_ == 3890 replace main = 32 if act1_ == 3910|act1_ == 3911|act1_ == 3914|act1_ == 3919 /// |act1_ == 3920|act1_ == 3921|act1_ == 3924|act1_ == 3929|act1_ == 4280 /// |act1_ == 4281|act1_ == 4284|act1_ == 4289 replace main = 33 if act1_ == 4000|act1_ == 4100|act1_ == 4110|act1_ == 4120 /// |act1_ == 4190|act1_ == 4200|act1_ == 4210|act1_ == 4220|act1_ == 4230 /// |act1_ == 4240|act1_ == 4250|act1_ == 4260|act1_ == 4275|act1_ == 4276 /// |act1_ == 4277 |act1_ == 4278|act1_ == 4282|act1_ == 4283|act1_ == 4290 /// |act1_ == 4300|act1_ == 4310|act1_ == 4390|act1_ == 9950|act1_ == 4270 /// |act1_ == 4271|act1_ == 4272|act1_ == 4273|act1_ == 4274|act1_ == 4279 replace main = 34 if act1_ == 4320 replace main = 35 if act1_ == 5000|act1_ == 5200|act1_ == 5299|act1_ == 5240 /// |act1_ == 5241|act1_ == 5249|act1_ == 5291|act1_ == 5292|act1_ == 5293 /// |act1_ == 5294|act1_ == 5295 replace main = 35 if act1_ == 5243|act1_ == 5244 // library using internet replace main = 36 if act1_ == 5250 replace main = 37 if act1_ == 5210|act1_ == 5220|act1_ == 5221|act1_ == 5222 /// |act1_ == 5223|act1_ == 5224|act1_ == 5225|act1_ == 5229 replace main = 38 if act1_ == 5230|act1_ == 5290|act1_ == 5299 *replace main = 39 //restaurant etc replace main = 40 if act1_ == 5130|act1_ == 7340 replace main = 41 if act1_ == 5105 replace main = 42 if act1_ == 6000|act1_ == 6100|act1_ == 6120|act1_ == 6132 /// |act1_ == 6140|act1_ == 6141|act1_ == 6142|act1_ == 6143|act1_ == 6144 /// |act1_ == 6149|act1_ == 6150|act1_ == 6160|act1_ == 6170|act1_ == 6171 /// |act1_ == 6179|act1_ == 6190|act1_ == 6310|act1_ == 6311|act1_ == 6312 replace main = 43 if act1_ == 6110|act1_ == 6111|act1_ == 6119 replace main = 44 if act1_ == 6130|act1_ == 6131 *replace main = 45 replace main = 46 if act1_ == 3400|act1_ == 3410|act1_ == 3490|act1_ == 6200 /// |act1_ == 6210|act1_ == 6220|act1_ == 6290 replace main = 47 if act1_ == 3440 replace main = 48 if act1_ == 5100|act1_ == 5120|act1_ == 5190 replace main = 49 if act1_ == 5110|act1_ == 5140 replace main = 50 if act1_ == 7300|act1_ == 7310|act1_ == 7320|act1_ == 7321 /// |act1_ == 7322|act1_ == 7329|act1_ == 7390 replace main = 51 if act1_ == 7000 replace main = 52 if act1_ == 7100|act1_ == 7110|act1_ == 7111|act1_ == 7112 /// |act1_ == 7119|act1_ == 7120|act1_ == 7121|act1_ == 7129|act1_ == 7130 /// |act1_ == 7140 replace main = 53 if act1_ == 7170 replace main = 54 if act1_ == 3330|act1_ == 3531|act1_ == 7150|act1_ == 7160 /// |act1_ == 7190 replace main = 55 if act1_ == 5310|act1_ == 9940 replace main = 56 if act1_ == 8100|act1_ == 8110|act1_ == 8120|act1_ == 8190 /// |act1_ == 5242|act1_ == 5245 replace main = 57 if act1_ == 8300|act1_ == 8320|act1_ == 5246 replace main = 58 if act1_ == 8310|act1_ == 8311|act1_ == 8312|act1_ == 8319 replace main = 59 if act1_ == 8000|act1_ == 8210|act1_ == 8211|act1_ == 8212 /// |act1_ == 8219|act1_ == 8220|act1_ == 8221|act1_ == 8222|act1_ == 8229 replace main = 60 if act1_ == 7330 replace main = 61 if act1_ == 7220|act1_ == 7230|act1_ == 7231|act1_ == 7239 /// |act1_ == 7240|act1_ == 7241|act1_ == 7249|act1_ == 7250|act1_ == 7251 /// |act1_ == 7259 replace main = 63 if act1_ == 9100|act1_ == 9120|act1_ == 9130|act1_ == 9140 replace main = 64 if act1_ == 9210 replace main = 65 if act1_ == 9400|act1_ == 9410|act1_ == 9420|act1_ == 9430|act1_ == 9440 replace main = 66 if act1_ == 9230|act1_ == 9380|act1_ == 9390 replace main = 67 if act1_ == 9010|act1_ == 9310|act1_ == 9360|act1_ == 9370|act1_ == 9800 replace main = 68 if act1_ == 9000|act1_ == 9500|act1_ == 9510|act1_ == 9520 /// |act1_ == 9600|act1_ == 9610|act1_ == 9620|act1_ == 9630|act1_ == 9710 /// |act1_ == 9720|act1_ == 9810|act1_ == 9820|act1_ == 9890 replace main = 69 if act1_ == 9960|act1_ == 9970|act1_ == 9980 /// |act1_ == 9990|act1_ == 9999 * sec * gen sec = . *replace sec = 1 replace sec = 2 if act2_ == 110|act2_ == 111|act2_ == 120 *replace sec = 3 replace sec = 4 if act2_ == 0|act2_ == 300|act2_ == 310|act2_ == 390 replace sec = 5 if (act2_ == 1310)|(act2_ == 210 & wher_ == 13) replace sec = 6 if act2_ == 210 & wher_ != 13 replace sec = 7 if (act2_ == 1000|act2_ == 1100|act2_ == 1110|act2_ == 1300) /// & (wher_ != 11 & wher_ != 12) replace sec = 8 if (act2_ == 1000|act2_ == 1100|act2_ == 1110|act2_ == 1120|act2_ == 1210 /// |act2_ == 1220|act2_ == 1300|act2_ == 1390|act2_ == 1399) & (wher_ == 11|wher_ == 12) //job12home replace sec = 9 if act2_ == 1210 & (wher_ != 11 & wher_ != 12) *replace sec = 10 replace sec = 11 if act2_ == 9110 replace sec = 12 if (act2_ == 1120|act2_ == 1220) & (wher_ != 11 & wher_ != 12) replace sec = 13 if (act2_ == 1390|act2_ == 1399) & (wher_ != 11 & wher_ != 12) replace sec = 14 if act2_ == 1391 replace sec = 15 if act2_ == 2100|act2_ == 2110|act2_ == 2190 replace sec = 16 if act2_ == 2000|act2_ == 2120|act2_ == 2210 *replace sec = 17 replace sec = 18 if act2_ == 3100|act2_ == 3110|act2_ == 3120|act2_ == 3140 replace sec = 19 if act2_ == 3130|act2_ == 3190 replace sec = 20 if act2_ == 3210|act2_ == 3220|act2_ == 3250 replace sec = 21 if act2_ == 3300|act2_ == 3310|act2_ == 3320|act2_ == 3390 replace sec = 22 if act2_ == 3200|act2_ == 3230|act2_ == 3290|act2_ == 3420 /// |act2_ == 3500|act2_ == 3510|act2_ == 3520|act2_ == 3530|act2_ == 3539 /// |act2_ == 3540|act2_ == 3590 replace sec = 23 if act2_ == 3000|act2_ == 3240|act2_ == 3710|act2_ == 3713 replace sec = 23 if act2_ == 3720|act2_ == 3727|act2_ == 3729 //hh management using internet replace sec = 24 if act2_ == 3600|act2_ == 3610|act2_ == 3611|act2_ == 3612 /// |act2_ == 3613|act2_ == 3614|act2_ == 3615|act2_ == 3619|act2_ == 3690 replace sec = 24 if act2_ == 3721|act2_ == 3722|act2_ == 3723|act2_ == 3724 /// |act2_ == 3725|act2_ == 3726 //shopping using internet replace sec = 25 if act2_ == 3630 replace sec = 26 if act2_ == 3620 replace sec = 27 if act2_ == 3430 replace sec = 28 if act2_ == 3800|act2_ == 3810|act2_ == 3811|act2_ == 3819 replace sec = 29 if act2_ == 3820 replace sec = 30 if act2_ == 3830 replace sec = 31 if act2_ == 3840|act2_ == 3890 replace sec = 32 if act2_ == 3910|act2_ == 3911|act2_ == 3914|act2_ == 3919 /// |act2_ == 3920|act2_ == 3921|act2_ == 3924|act2_ == 3929|act2_ == 4280 /// |act2_ == 4281|act2_ == 4284|act2_ == 4289 replace sec = 33 if act2_ == 4000|act2_ == 4100|act2_ == 4110|act2_ == 4120 /// |act2_ == 4190|act2_ == 4200|act2_ == 4210|act2_ == 4220|act2_ == 4230 /// |act2_ == 4240|act2_ == 4250|act2_ == 4260|act2_ == 4275|act2_ == 4276 /// |act2_ == 4277 |act2_ == 4278|act2_ == 4282|act2_ == 4283|act2_ == 4290 /// |act2_ == 4300|act2_ == 4310|act2_ == 4390|act2_ == 9950|act2_ == 4270 /// |act2_ == 4271|act2_ == 4272|act2_ == 4273|act2_ == 4274|act2_ == 4279 replace sec = 34 if act2_ == 4320 replace sec = 35 if act2_ == 5000|act2_ == 5200|act2_ == 5299|act2_ == 5240 /// |act2_ == 5241|act2_ == 5249|act2_ == 5291|act2_ == 5292|act2_ == 5293 /// |act2_ == 5294|act2_ == 5295 replace sec = 35 if act2_ == 5243|act2_ == 5244 // library using internet replace sec = 36 if act2_ == 5250 replace sec = 37 if act2_ == 5210|act2_ == 5220|act2_ == 5221|act2_ == 5222 /// |act2_ == 5223|act2_ == 5224|act2_ == 5225|act2_ == 5229 replace sec = 38 if act2_ == 5230|act2_ == 5290|act2_ == 5299 *replace sec = 39 //restaurant etc replace sec = 40 if act2_ == 5130|act2_ == 7340 replace sec = 41 if act2_ == 5105 replace sec = 42 if act2_ == 6000|act2_ == 6100|act2_ == 6120|act2_ == 6132 /// |act2_ == 6140|act2_ == 6141|act2_ == 6142|act2_ == 6143|act2_ == 6144 /// |act2_ == 6149|act2_ == 6150|act2_ == 6160|act2_ == 6170|act2_ == 6171 /// |act2_ == 6179|act2_ == 6190|act2_ == 6310|act2_ == 6311|act2_ == 6312 replace sec = 43 if act2_ == 6110|act2_ == 6111|act2_ == 6119 replace sec = 44 if act2_ == 6130|act2_ == 6131 *replace sec = 45 replace sec = 46 if act2_ == 3400|act2_ == 3410|act2_ == 3490|act2_ == 6200 /// |act2_ == 6210|act2_ == 6220|act2_ == 6290 replace sec = 47 if act2_ == 3440 replace sec = 48 if act2_ == 5100|act2_ == 5120|act2_ == 5190 replace sec = 49 if act2_ == 5110|act2_ == 5140 replace sec = 50 if act2_ == 7300|act2_ == 7310|act2_ == 7320|act2_ == 7321 /// |act2_ == 7322|act2_ == 7329|act2_ == 7390 replace sec = 51 if act2_ == 7000 replace sec = 52 if act2_ == 7100|act2_ == 7110|act2_ == 7111|act2_ == 7112 /// |act2_ == 7119|act2_ == 7120|act2_ == 7121|act2_ == 7129|act2_ == 7130 /// |act2_ == 7140 replace sec = 53 if act2_ == 7170 replace sec = 54 if act2_ == 3330|act2_ == 3531|act2_ == 7150|act2_ == 7160 /// |act2_ == 7190 replace sec = 55 if act2_ == 5310|act2_ == 9940 replace sec = 56 if act2_ == 8100|act2_ == 8110|act2_ == 8120|act2_ == 8190 /// |act2_ == 5242|act2_ == 5245 replace sec = 57 if act2_ == 8300|act2_ == 8320|act2_ == 5246 replace sec = 58 if act2_ == 8310|act2_ == 8311|act2_ == 8312|act2_ == 8319 replace sec = 59 if act2_ == 8000|act2_ == 8210|act2_ == 8211|act2_ == 8212 /// |act2_ == 8219|act2_ == 8220|act2_ == 8221|act2_ == 8222|act2_ == 8229 replace sec = 60 if act2_ == 7330 replace sec = 61 if act2_ == 7220|act2_ == 7230|act2_ == 7231|act2_ == 7239 /// |act2_ == 7240|act2_ == 7241|act2_ == 7249|act2_ == 7250|act2_ == 7251 /// |act2_ == 7259 replace sec = 63 if act2_ == 9100|act2_ == 9120|act2_ == 9130|act2_ == 9140 replace sec = 64 if act2_ == 9210 replace sec = 65 if act2_ == 9400|act2_ == 9410|act2_ == 9420|act2_ == 9430|act2_ == 9440 replace sec = 66 if act2_ == 9230|act2_ == 9380|act2_ == 9390 replace sec = 67 if act2_ == 9010|act2_ == 9310|act2_ == 9360|act2_ == 9370|act2_ == 9800 replace sec = 68 if act2_ == 9000|act2_ == 9500|act2_ == 9510|act2_ == 9520 /// |act2_ == 9600|act2_ == 9610|act2_ == 9620|act2_ == 9630|act2_ == 9710 /// |act2_ == 9720|act2_ == 9810|act2_ == 9820|act2_ == 9890 replace sec = 69 if act2_ == 9960|act2_ == 9970|act2_ == 9980 /// |act2_ == 9990|act2_ == 9999 * av * gen av=. replace av = 1 if main ==5 | main==7 | main==10 | main==12 | main==13 replace av = 2 if main==8 | main==14 replace av = 3 if main==9 replace av = 4 if main==15 | main==17 replace av = 5 if main==11 | main==63 | main==64 replace av = 6 if main==18 | main==19 replace av = 7 if main==20 | main==21 replace av = 8 if main==22 | main==23 | main==27 | main==32 replace av = 9 if main==46 replace av = 10 if main==24 | main==26 replace av = 11 if main==28 | main==29 | main==30 | main==31 replace av = 12 if main==66 | main==67 replace av = 13 if main==1 | main==4 replace av = 14 if main==25 replace av = 15 if main==6 replace av = 16 if main==2 | main==3 replace av = 17 if main==62 | main==65 | main==68 replace av = 18 if main==35 | main==38 | main==45 replace av = 19 if main==42 | main==44 replace av = 20 if main==36 replace av = 21 if main==43 | main==47 replace av = 22 if main==34 replace av = 23 if main==33 replace av = 24 if main==37 replace av = 25 if main==40 replace av = 28 if main==39 replace av = 29 if main==48 replace av = 38 if main==50 replace av = 30 if main==58 replace av = 31 if main==59 replace av = 32 if main==57 replace av = 33 if main==16 replace av = 34 if main==56 replace av = 36 if main==55 replace av = 37 if main==49 replace av = 39 if main==51 | main==52 | main==53 replace av = 40 if main==54 | main==60 | main==61 replace av = 41 if main==41 | main==69 *core25* gen core25 = main replace core25 = 1 if main ==2 | main==3 replace core25 = 2 if main ==5 | main==6 replace core25 = 3 if main ==1 | main==4 recode core25(7 8 9 10 11 12 13 14 =4) (15 16 17 =5) /// (18 19=6) (20 21 23 = 7) (22=8) (24 25 26=9) (46=10) (27 47=11) (32=12) (28 31=13) (29 30=14) /// (34=15) (33=16) (63 64=17) (62 65 66 67 68=18) (42 43 44=19) (57 58 59=20) (56=21) /// (60 61=22) (35 36 37 38 39 40 41 45=23) (48 49 50 51 52 53 54 55=24) (69=25) * hldid * gen hldid= serial * persid * gen persid = pnum * id * gen id = daynum * day * gen day =DiaryDay_Act * month * gen month= IMonth * year * gen year = IYear *cday * generate ddd= string( DiaryDate_Act, "%td") gen cday=substr(ddd, 1,2) destring cday, replace * diary * gen diary=DayNum_DiaryDay * time * gen time=eptime * clockst * gen str godz= "." replace godz = "04.00" if slot==1 replace godz = "04.10-04.20" if slot==2 replace godz = "04.20-04.30" if slot==3 replace godz = "04.30-04.40" if slot==4 replace godz = "04.40-04.50" if slot==5 replace godz = "04.50-05.00" if slot==6 replace godz = "05.00-05.10" if slot==7 replace godz = "05.10-05.20" if slot==8 replace godz = "05.20-05.30" if slot==9 replace godz = "05.30-05.40" if slot==10 replace godz = "05.40-05.50" if slot==11 replace godz = "05.50-06.00" if slot==12 replace godz = "06.00-06.10" if slot==13 replace godz = "06.10-06.20" if slot==14 replace godz = "06.20-06.30" if slot==15 replace godz = "06.30-06.40" if slot==16 replace godz = "06.40-06.50" if slot==17 replace godz = "06.50-07.00" if slot==18 replace godz = "07.00-07.10" if slot==19 replace godz = "07.10-07.20" if slot==20 replace godz = "07.20-07.30" if slot==21 replace godz = "07.30-07.40" if slot==22 replace godz = "07.40-07.50" if slot==23 replace godz = "07.50-08.00" if slot==24 replace godz = "08.00-08.10" if slot==25 replace godz = "08.10-08.20" if slot==26 replace godz = "08.20-08.30" if slot==27 replace godz = "08.30-08.40" if slot==28 replace godz = "08.40-08.50" if slot==29 replace godz = "08.50-09.00" if slot==30 replace godz = "09.00-09.10" if slot==31 replace godz = "09.10-09.20" if slot==32 replace godz = "09.20-09.30" if slot==33 replace godz = "09.30-09.40" if slot==34 replace godz = "09.40-09.50" if slot==35 replace godz = "09.50-10.00" if slot==36 replace godz = "10.00-10.10" if slot==37 replace godz = "10.10-10.20" if slot==38 replace godz = "10.20-10.30" if slot==39 replace godz = "10.30-10.40" if slot==40 replace godz = "10.40-10.50" if slot==41 replace godz = "10.50-11.00" if slot==42 replace godz = "11.00-11.10" if slot==43 replace godz = "11.10-11.20" if slot==44 replace godz = "11.20-11.30" if slot==45 replace godz = "11.30-11.40" if slot==46 replace godz = "11.40-11.50" if slot==47 replace godz = "11.50-12.00" if slot==48 replace godz = "12.00-12.10" if slot==49 replace godz = "12.10-12.20" if slot==50 replace godz = "12.20-12.30" if slot==51 replace godz = "12.30-12.40" if slot==52 replace godz = "12.40-12.50" if slot==53 replace godz = "12.50-13.00" if slot==54 replace godz = "13.00-13.10" if slot==55 replace godz = "13.10-13.20" if slot==56 replace godz = "13.20-13.30" if slot==57 replace godz = "13.30-13.40" if slot==58 replace godz = "13.40-13.50" if slot==59 replace godz = "13.50-14.00" if slot==60 replace godz = "14.00-14.10" if slot==61 replace godz = "14.10-14.20" if slot==62 replace godz = "14.20-14.30" if slot==63 replace godz = "14.30-14.40" if slot==64 replace godz = "14.40-14.50" if slot==65 replace godz = "14.50-15.00" if slot==66 replace godz = "15.00-15.10" if slot==67 replace godz = "15.10-15.20" if slot==68 replace godz = "15.20-15.30" if slot==69 replace godz = "15.30-15.40" if slot==70 replace godz = "15.40-15.50" if slot==71 replace godz = "15.50-16.00" if slot==72 replace godz = "16.00-16.10" if slot==73 replace godz = "16.10-16.20" if slot==74 replace godz = "16.20-16.30" if slot==75 replace godz = "16.30-16.40" if slot==76 replace godz = "16.40-16.50" if slot==77 replace godz = "16.50-17.00" if slot==78 replace godz = "17.00-17.10" if slot==79 replace godz = "17.10-17.20" if slot==80 replace godz = "17.20-17.30" if slot==81 replace godz = "17.30-17.40" if slot==82 replace godz = "17.40-17.50" if slot==83 replace godz = "17.50-18.00" if slot==84 replace godz = "18.00-18.10" if slot==85 replace godz = "18.10-18.20" if slot==86 replace godz = "18.20-18.30" if slot==87 replace godz = "18.30-18.40" if slot==88 replace godz = "18.40-18.50" if slot==89 replace godz = "18.50-19.00" if slot==90 replace godz = "19.00-19.10" if slot==91 replace godz = "19.10-19.20" if slot==92 replace godz = "19.20-19.30" if slot==93 replace godz = "19.30-19.40" if slot==94 replace godz = "19.40-19.50" if slot==95 replace godz = "19.50-20.00" if slot==96 replace godz = "20.00-20.10" if slot==97 replace godz = "20.10-20.20" if slot==98 replace godz = "20.20-20.30" if slot==99 replace godz = "20.30-20.40" if slot==100 replace godz = "20.40-20.50" if slot==101 replace godz = "20.50-21.00" if slot==102 replace godz = "21.00-21.10" if slot==103 replace godz = "21.10-21.20" if slot==104 replace godz = "21.20-21.30" if slot==105 replace godz = "21.30-21.40" if slot==106 replace godz = "21.40-21.50" if slot==107 replace godz = "21.50-22.00" if slot==108 replace godz = "22.00-22.10" if slot==109 replace godz = "22.10-22.20" if slot==110 replace godz = "22.20-22.30" if slot==111 replace godz = "22.30-22.40" if slot==112 replace godz = "22.40-22.50" if slot==113 replace godz = "22.50-23.00" if slot==114 replace godz = "23.00-23.10" if slot==115 replace godz = "23.10-23.20" if slot==116 replace godz = "23.20-23.30" if slot==117 replace godz = "23.30-23.40" if slot==118 replace godz = "23.40-23.50" if slot==119 replace godz = "23.50-00.00" if slot==120 replace godz = "00.00-00.10" if slot==121 replace godz = "00.10-00.20" if slot==122 replace godz = "00.20-00.30" if slot==123 replace godz = "00.30-00.40" if slot==124 replace godz = "00.40-00.50" if slot==125 replace godz = "00.50-01.00" if slot==126 replace godz = "01.00-01.10" if slot==127 replace godz = "01.10-01.20" if slot==128 replace godz = "01.20-01.30" if slot==129 replace godz = "01.30-01.40" if slot==130 replace godz = "01.40-01.50" if slot==131 replace godz = "01.50-02.00" if slot==132 replace godz = "02.00-02.10" if slot==133 replace godz = "02.10-02.20" if slot==134 replace godz = "02.20-02.30" if slot==135 replace godz = "02.30-02.40" if slot==136 replace godz = "02.40-02.50" if slot==137 replace godz = "02.50-03.00" if slot==138 replace godz = "03.00-03.10" if slot==139 replace godz = "03.10-03.20" if slot==140 replace godz = "03.20-03.30" if slot==141 replace godz = "03.30-03.40" if slot==142 replace godz = "03.40-03.50" if slot==143 replace godz = "03.50-04.00" if slot==144 */ *clockst* split godz, p(-) rename godz1 clockst drop godz2 * start * gen start= . replace start = 0 if slot==1 replace start = (slot*10)-10 if start !=0 * end * gen end = start + time * eloc * gen eloc= wher_ recode eloc (-9 0 10 99=-8) (11 12=1) (14=2) (13=3) (15=6) (16/18 20 21=9) (19=5) (30/90=8) * mtrav * gen mtrav= wher_ recode mtrav (-9 0 10 99=-8) (11/21=-7) (30 33/39 41=1) (40 42/49=2) (31=3) (32=4) (90=5) *inout * gen inout =wher_ recode inout (-9 0 10 99=-8) (30/90=3) (11 12 13 14 15 16 17 20 21=1) (18=2) recode inout (19=1) * ict * gen ict= act1_ recode ict (5244 7000 7220/7259 7330=1) replace ict= 0 if ict !=1 replace ict=1 if Device==1 * alone * gen alone= WithAlone * child * gen child=WithChild * sppart* gen sppart= WithSpouse * oad* gen oad=WithOther replace oad=1 if WithOtherYK==1 * animal * gen animal= act1_ recode animal (3430/3490=1) replace animal =0 if animal!=1 ******************************************************************* ******************* * background vars * ******************* * hhtype * gen hhtype=. replace hhtype =1 if hhsize==1 replace hhtype =2 if hhsize==2 & (NumSSex==2 | NumCPart==2 | NumMPart==2) & NumChild==0 replace hhtype=3 if hhsize >2 & (NumSSex>=2 | NumCPart>=2 | NumMPart>=2) replace hhtype=4 if hhtype==. * hhsize * gen hhsize= DVHsize * computer * gen computer=Comp recode computer (2=0) * vehicle * gen vehicle=VehOwn recode vehicle (2=0) *ownhome * gen ownhome = . replace ownhome=1 if Tenure ==1 | Tenure==2 replace ownhome=2 if Tenure ==3 | Tenure==4 | Tenure==5 replace ownhome=3 if Tenure ==6 * urban * gen urban=-9 * income * gen income=Income recode income (1/1100=1) replace income = 2 if income >1100 & income <3000 replace income =3 if income >=3000 replace income =-8 if income<0 * sex * gen sex=DMSex_P1 gen sex=DMSex * age * gen age = DVAge // TUTUTU?/// * famstat * gen famstat=. replace famstat=0 if age >=18 & age <=39 & nchild==0 replace famstat=1 if age >=18 & agekid2 <5 replace famstat=2 if age >=18 & agekid2 >=5 & nchild!=0 replace famstat=3 if age >=40 & nchild==0 replace famstat=4 if age <18 & NumAdult>=1 replace famstat=5 if famstat==. *singpar * gen singpar = . replace singpar=1 if (NumSSex==0 & NumCPart==0 & NumMPart==0) & agekid2<18 replace singpar=1 if agekid2 <18 & hhldsize ==2 *relrefp * gen relrefp = -9 *citizen * gen citizen= Citizen1 recode citizen (-9 -1=-8) *whereborn* gen whereborn=PlBornC label val whereborn PlBornC *empstat* gen empstat= deconact recode empstat (-9 =-8) (-1=-7)(3 5=3) (6/13=4) *emp* gen emp= 1 if empstat ==1 | empstat==2 | empstat==3 replace emp= 0 if empstat ==4 replace emp= -8 if emp==. *unemp* gen unemp=. replace unemp= 1 if deconact==6 replace unemp= 0 if unemp==. *student * gen student =. replace student =1 if deconact==8 replace student =0 if student==. *retired * gen retired=. replace retired = 1 if deconact==7 replace retired = 0 if retired==. *empsp* gen empsps = . replace empsp= empstat[_n+1] if partid==2 & serial==serial[_n+1] replace empsp= empstat[_n-1] if partid==1 & serial==serial[_n-1] *workhrs* gen workhrs=HrWkAc *isco1 * gen isco1=-9 *sector * gen sector=Sector recode sector (2=1) (1=2) (-9=-8) (-1=-7) *edcat* gen edcat=HiQual recode edcat (25/31=1) (20/24=2) (14/19=2) (10/13=3) (1/9=3) (32/34=-8) (-1=-7) *rushed * gen rushed=Rushed recode rushed (3=0) (1=2) (2=1) (-1=-7) *health * gen health=GenHlth recode health (4 5 =0 ) (3=1) (2=2) (1=3) (-1=-7) (-9=-8) *carer * gen carer=Carer recode carer (2=0) (-1=-7) (-9=-8) *disab * gen disab=CutDown recode disab (2=0) (-1=-7) (-9=-8) *ocombtw * gen ocombwt= ind_wt recode ocombwt (.=-8) ********* * merge * ********* merge m:1 hldid persid using uktus15_individual.dta, keepusing(sex citizen relrefp whereborn /// empstat emp unemp student retired workhrs isco1 sector empsp edcat rushed health carer disab ocombwt) merge m:1 hldid using uktus15_household.dta, keepusing(hhtype hhsize computer vehicle ownhome urban /// income agekid2 agekidx nchild singpar) *propwt * egen count=count(badcase) egen countp_bis=count(badcase) if badcase==0 egen countp=min(countp_bis) sort sex age day egen daywt = group(sex age day) if badcase==0 egen ngroupsd=max(daywt) if badcase==0 by sex age day: egen daycount2=count(daywt) if badcase==0 sort sex age egen weekwt=group(sex age) if badcase==0 by sex age: egen wkcount2=count(weekwt) if badcase==0 gen propwt=((wkcount2/7)/daycount2) if badcase==0 replace propwt=0 if badcase!=0 replace propwt=propwt*(count/countp) egen mean_weight=mean(propwt) replace propwt=propwt/mean_weight *deleting redundant vars* keep country survey swave msamp hldid persid id day cday month year diary nowght /// time clockst start end epnum main core25 sec av inout eloc ict mtrav alone child sppart oad /// animal parntid1 parntid2 partid hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer /// vehicle sex age famstat singpar relrefp civstat cohab citizen whereborn empstat emp unemp student retired empsp /// workhrs isco1 sector edcat rushed health carer disab ocombwt propwt order country survey swave msamp hldid persid id day cday month year diary nowght /// time clockst start end epnum main core25 sec av inout eloc ict mtrav alone child sppart oad /// animal parntid1 parntid2 partid hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer /// vehicle sex age famstat singpar relrefp civstat cohab citizen whereborn empstat emp unemp student retired empsp /// workhrs isco1 sector edcat rushed health carer disab ocombwt propwt