***************************************************************** *syntax to create the MTUS World 5.3, 5.8 and 6.0 files for the * *UK 2005 Omnibus precoded time diary survey * *written by Dr. Kimberly Fisher, Centre for Time Use Research * *University of Oxford, 15 March 2009, updated 6 September 2013 * *****************************************************************. GET FILE='C:\Users\Kimberly Fisher\Documents\MTUS-archive\UK\2005\timeusefinal_for_archive2.sav' /keep serial weekend Month dyear DiaryDay Net_wgt DMHSIZE NumAdult NumChild NumDepCh AGEYOUNG HHTypb Ten1 car sumgross Gora FullEd ethnic RESPSEX RESPAGE RESPMAR RESPWith RELHRP HighEd Highed4 Wrking Qhealth1 JbAway OwnBus RelBus Looked StartJ YInAct DVILO3a SVise Solo FtPtWk Parthrs ES2000 NSSECB sumgross TotUs1 ecact nation1 aprim1 aprim8 aprim11 aprim12 aprim27 pact1 pact2 pact3 pact4 pact5 pact6 pact7 pact8 pact9 pact10 pact11 pact12 pact13 pact14 pact15 pact16 pact17 pact18 pact19 pact20 pact21 pact22 pact23 pact24 pact25 pact26 pact27 pact28 pact29 pact30 pact31 pact32 pact33 pact34 pact35 pact36 pact37 pact38 pact39 pact40 pact41 pact42 pact43 pact44 pact45 pact46 pact47 pact48 pact49 pact50 pact51 pact52 pact53 pact54 pact55 pact56 pact57 pact58 pact59 pact60 pact61 pact62 pact63 pact64 pact65 pact66 pact67 pact68 pact69 pact70 pact71 pact72 pact73 pact74 pact75 pact76 pact77 pact78 pact79 pact80 pact81 pact82 pact83 pact84 pact85 pact86 pact87 pact88 pact89 pact90 pact91 pact92 pact93 pact94 pact95 pact96 pact97 pact98 pact99 pact100 pact101 pact102 pact103 pact104 pact105 pact106 pact107 pact108 pact109 pact110 pact111 pact112 pact113 pact114 pact115 pact116 pact117 pact118 pact119 pact120 pact121 pact122 pact123 pact124 pact125 pact126 pact127 pact128 pact129 pact130 pact131 pact132 pact133 pact134 pact135 pact136 pact137 pact138 pact139 pact140 pact141 pact142 pact143 pact144 sact1 sact2 sact3 sact4 sact5 sact6 sact7 sact8 sact9 sact10 sact11 sact12 sact13 sact14 sact15 sact16 sact17 sact18 sact19 sact20 sact21 sact22 sact23 sact24 sact25 sact26 sact27 sact28 sact29 sact30 sact31 sact32 sact33 sact34 sact35 sact36 sact37 sact38 sact39 sact40 sact41 sact42 sact43 sact44 sact45 sact46 sact47 sact48 sact49 sact50 sact51 sact52 sact53 sact54 sact55 sact56 sact57 sact58 sact59 sact60 sact61 sact62 sact63 sact64 sact65 sact66 sact67 sact68 sact69 sact70 sact71 sact72 sact73 sact74 sact75 sact76 sact77 sact78 sact79 sact80 sact81 sact82 sact83 sact84 sact85 sact86 sact87 sact88 sact89 sact90 sact91 sact92 sact93 sact94 sact95 sact96 sact97 sact98 sact99 sact100 sact101 sact102 sact103 sact104 sact105 sact106 sact107 sact108 sact109 sact110 sact111 sact112 sact113 sact114 sact115 sact116 sact117 sact118 sact119 sact120 sact121 sact122 sact123 sact124 sact125 sact126 sact127 sact128 sact129 sact130 sact131 sact132 sact133 sact134 sact135 sact136 sact137 sact138 sact139 sact140 sact141 sact142 sact143 sact144 Compfg1 Compfg2 Compfg3 Compfg4 Compfg5 Compfg6 Compfg7 Compfg8 Compfg9 Compfg10 Compfg11 Compfg12 Compfg13 Compfg14 Compfg15 Compfg16 Compfg17 Compfg18 Compfg19 Compfg20 Compfg21 Compfg22 Compfg23 Compfg24 Compfg25 Compfg26 Compfg27 Compfg28 Compfg29 Compfg30 Compfg31 Compfg32 Compfg33 Compfg34 Compfg35 Compfg36 Compfg37 Compfg38 Compfg39 Compfg40 Compfg41 Compfg42 Compfg43 Compfg44 Compfg45 Compfg46 Compfg47 Compfg48 Compfg49 Compfg50 Compfg51 Compfg52 Compfg53 Compfg54 Compfg55 Compfg56 Compfg57 Compfg58 Compfg59 Compfg60 Compfg61 Compfg62 Compfg63 Compfg64 Compfg65 Compfg66 Compfg67 Compfg68 Compfg69 Compfg70 Compfg71 Compfg72 Compfg73 Compfg74 Compfg75 Compfg76 Compfg77 Compfg78 Compfg79 Compfg80 Compfg81 Compfg82 Compfg83 Compfg84 Compfg85 Compfg86 Compfg87 Compfg88 Compfg89 Compfg90 Compfg91 Compfg92 Compfg93 Compfg94 Compfg95 Compfg96 Compfg97 Compfg98 Compfg99 Compfg100 Compfg101 Compfg102 Compfg103 Compfg104 Compfg105 Compfg106 Compfg107 Compfg108 Compfg109 Compfg110 Compfg111 Compfg112 Compfg113 Compfg114 Compfg115 Compfg116 Compfg117 Compfg118 Compfg119 Compfg120 Compfg121 Compfg122 Compfg123 Compfg124 Compfg125 Compfg126 Compfg127 Compfg128 Compfg129 Compfg130 Compfg131 Compfg132 Compfg133 Compfg134 Compfg135 Compfg136 Compfg137 Compfg138 Compfg139 Compfg140 Compfg141 Compfg142 Compfg143 Compfg144 lact1 lact2 lact3 lact4 lact5 lact6 lact7 lact8 lact9 lact10 lact11 lact12 lact13 lact14 lact15 lact16 lact17 lact18 lact19 lact20 lact21 lact22 lact23 lact24 lact25 lact26 lact27 lact28 lact29 lact30 lact31 lact32 lact33 lact34 lact35 lact36 lact37 lact38 lact39 lact40 lact41 lact42 lact43 lact44 lact45 lact46 lact47 lact48 lact49 lact50 lact51 lact52 lact53 lact54 lact55 lact56 lact57 lact58 lact59 lact60 lact61 lact62 lact63 lact64 lact65 lact66 lact67 lact68 lact69 lact70 lact71 lact72 lact73 lact74 lact75 lact76 lact77 lact78 lact79 lact80 lact81 lact82 lact83 lact84 lact85 lact86 lact87 lact88 lact89 lact90 lact91 lact92 lact93 lact94 lact95 lact96 lact97 lact98 lact99 lact100 lact101 lact102 lact103 lact104 lact105 lact106 lact107 lact108 lact109 lact110 lact111 lact112 lact113 lact114 lact115 lact116 lact117 lact118 lact119 lact120 lact121 lact122 lact123 lact124 lact125 lact126 lact127 lact128 lact129 lact130 lact131 lact132 lact133 lact134 lact135 lact136 lact137 lact138 lact139 lact140 lact141 lact142 lact143 lact144. recode all (sysmis=-99). missing values all (). execute. *Identifiers. compute countrya = 37. compute survey = 2005. compute swave = 0. compute msamp = 0. compute hldid=0. *test that the identifier serial is unique for each case. sort cases by serial. compute test=0. if serial=lag(serial) test=1. freq test. *the cases are unique. compute persid=serial. compute id=1. compute parntid1=-9. compute parntid2=-9. compute partid=-9. *diary variables. freq weekend Month dyear DiaryDay. cro month by dyear. cro month by DiaryDay by weekend. *note a number of errors in these variables. *weekend apparently marks weekdays and weekend days. DiaryDay has values 1-7 *but no lables, 98% of weekday coded diaries coded as DiaryDay values 2-6; *95% of weekend diaries coded as DiaryDay vales 1,7. 162 cases of apparent *miscode as weekend and DiaryDay disagree. Look at these cases. compute test2=0. Do if weekend=1 and (DiaryDay=1 or DiaryDay=7). compute test2=2. Else if weekend=1. compute test2=1. Else if weekend=2 and (DiaryDay>1 and DiaryDay<7). compute test2=4. Else if weekend=2. compute test2=3. End if. val lab test2 1 week day 2 "miscoded week day?" 3 weekend day 4 "miscoded weekend day?". means aprim1 aprim8 aprim11 aprim12 aprim27 RESPAGE by test2. cro Gora RESPSEX RESPMAR by test2. *the people with the apparent miscoded days are older, and there are some *distinctions, but both the agreed weekdays and apparent mismatched weekdays *have less sleep, less DIY, less church, and more paid work; the agreed and *apparent weekend days have more church, more DIY, and more sleep, and less *paid work. The mismatched days have education time in between the confirmed *weekday and the confirmed weekend rate. temp. select if test2=2 or test2=4. freq respage aprim12. *only 4 cases of formal education on apparently miscoded days. two long 2+ hour spells. compute test=0. if aprim12>90 and (test2=2 or test2=4) test=1. freq test. cro test by DiaryDay. *these two cases visually examined, 1 a Friday, one a Saturday, both have odd schedules, *but as fewer cases in the mismatched day variables, the longer slots inflate the total *minutes, and these two cases could be on any day. Just assume the day of the week *variable is more reliable as more closely fits other known day association patterns. Compute day=DiaryDay. rename variables (Month=Montha). Recode Montha (1=3) (2=6) (3=9) (4=11) into month. cro Montha by month. *note there is an original variable called year. 98.7% of cases coded as 2005. The survey *only took place in 2005. 58 cases coded as -1, but these must be 2005. 1 case coded as 2000, *but this case is in the last period of fieldwork, and also must be 2005. 2 cases are coded *as 205 - must just be missing the second 0, and 2 cases are coded as 2205 - clearly typos. *year is simply set to 2005 and the original variable not used. compute year=2005. compute diary=1. *household variables. var lab DMHSIZE "Total number of people in the household". *some checks made, variables with duplicate information removed. *cro HAV4 by NumChild NumDepCh N1TO4. *cro HAV5 by NumChild NumDepCh N5TO10. *cro HAV11 by NumChild NumDepCh N11TO15. *cro N1TO4 N5TO10 N11TO15 by AGEYOUNG NumChild NumDepCh. *cro Ten1 by TENgrp. *cro car by Cars Numcar. compute test=0. compute test=NumAdult + NumChild. cro test by DMHSIZE. compute test=0. compute test=NumAdult + NumDepCh. cro test by DMHSIZE. cro NumDepCh by RELHRP. *dmhsize is the household size. NumDepCh marks older children *who are economically dependent on parents but may be adults. compute hhldsize=DMHSIZE. compute nchild=NumChild. *as the number of children variable only covers children aged *up to 15, if the diarist is aged 16 or 17, then there is at least *one additional child aged <18 in the household. Adjust nchild. if RESPAGE<18 nchild=nchild+1. freq hhldsize nchild. *check that in no case does nchild = or exceed the number of *people in the household. cro hhldsize by nchild. *nchild is always smaller than hhldsize. *complications coding agekidx and agekid2 as the categories do *not overlap MTUS categories, except in the case of value 1 *presence of under 5s). Age of the diarist is used to mark *children aged 16 & 17; and number of dependent children as well *as respondent's relation to head of the household is a child of HOH *where no children younger than 15 to mark category 4. This leaves *some fudging where the youngest child in reality is aged 11, 12, *16 or 17. compute agekidx=-7. Do if AGEYOUNG=1. compute agekidx=1. Else if AGEYOUNG=2. compute agekidx=2. Else if AGEYOUNG=3. compute agekidx=3. Else if RESPAGE<18. compute agekidx=3. Else if NumDepCh>0 or (RELHRP>2 and RELHRP<7). compute agekidx=4. End if. freq agekidx. cro agekidx by ageyoung numdepch. means respage by agekidx /cells=min max mean. compute agekid2=-9. cro RESPMAR by RESPWith. freq HHTypb. Do if hhldsize=1. compute hhtype=1. Else if hhldsize=2 and (RESPMAR=2 or RESPWith=1 or RESPWith=3). compute hhtype=2. Else if RESPMAR=2 or RESPWith=1 or RESPWith=3. compute hhtype=3. Else if HHTypb=2 or HHTypb=3. compute hhtype=3. Else. compute hhtype=4. End if. freq hhtype. cro hhtype by HHTypb hhldsize RESPMAR RESPWith. *address three errors of people coded as married and living with spouse in hhsize=1. Do if hhldsize=1 and RESPMAR=2. compute hhldsize=2. compute hhtype=2. End if. cro hhtype by HHTypb hhldsize RESPMAR RESPWith. freq sumgross. temp. select if sumgross=-99 or sumgross>38. freq RESPAGE relhrp month. temp. select if sumgross=97. freq RESPAGE relhrp. *income data are rubbish for this survey. Users should see notes in the readme file. *look at weighted distribution for positive income provided by heads of household. weight by Net_wgt. *look at distribution with the reference person only. temp. select if (sumgross>0 and sumgross<40) and RELHRP=0. freq sumgross. *look at distribution with the reference person and partner of ref person. temp. select if (sumgross>0 and sumgross<40) and RELHRP<3. freq sumgross. weight off. cro RELHRP by RESPSEX. *slightly more men than women are reference persons; significantly more women than *men are the spouse or co-habitting partner of the reference person. *Looking at the income distribution of reference persons who gave a valid answer, *23% fall in category 13 or under, and 24.1% are in category 29 or higher. *looking at the income distribution of reference persons, married partners and *spouses, 25.8% are in category 12 or less, 72.2% are in category 27 or higher. *more likely that people who are not the reference person or spouse of the *reference person are not the main contributor of income to the household. *more likely that the spouses of the reference person contribute a part but *not the whole income to the household, and their income also represents a base *which the household income is above. Adjust the spouse level lower as more women *with lower incomes in this group. compute income=-9. Do if (sumgross>0 and sumgross<14) and RELHRP=0. compute income=1. Else if (sumgross>13 and sumgross<29) and RELHRP=0. compute income=2. Else if (sumgross>28 and sumgross<40) and RELHRP=0. compute income=3. Else if RELHRP=0. compute income=-8. Else if (sumgross>0 and sumgross<12) and RELHRP<3. compute income=1. Else if (sumgross>11 and sumgross<26) and RELHRP<3. compute income=2. Else if (sumgross>25 and sumgross<40) and RELHRP<3. compute income=3. Else if RELHRP<3. compute income=-8. End if. freq income. weight by Net_wgt. temp. select if income>0. freq income. weight off. Recode Ten1 (1 thru 3=1) (4=2) (5=3) (else=-8) into ownhome. cro ten1 by ownhome. compute incorig=-9. compute urban=-9. compute computer=-9. Recode car (1=0) (2=3) (3,4=4) into vehicle. cro car by vehicle. *UK extra variables. freq Gora FullEd. Recode Gora (1,2,3=1) (4,5=2) (6=3) (7,8=4) (9=5) (10=6) (11=7) into region. var lab region countrya and English region. val lab region -8 missing 1 North of England 2 English Midlands 3 East of England 4 London and South East 5 South & West of England 6 Wales 7 Scotland 8 Northern Ireland. freq region. cro Gora by region. recode FullEd (10 thru 15=15) (99=15) (21 thru 55=21) (97=0) (998 thru high=-8) (else=copy) into aglftsch. var lab aglftsch age left formal education. val lab aglftsch -8 missing 0 still in school 15 15 or less 21 21 or older. freq aglftsch. cro aglftsch by FullEd. rename variables (ethnic=ethnic2). recode ethnic2 (1,2=1) (3 thru 6=4) (7 thru 10=3) (11 thru 13=2) (14 thru 15=4) (else=-8) into ethnic. var lab ethnic ethnicity. val lab ethnic -9 not possible to create -8 missing 1 white 2 black 3 "Indian/Pakistani/Bangladeshi" 4 other and mixed race. freq ethnic. cro ethnic by ethnic2. *individual variables. freq RESPSEX. *sex already has the right codes and no missing cases. rename variables (RESPSEX=sex). freq RESPAGE. recode RESPAGE (80 thru high=80) (else=copy) into age. freq age. temp. select if age<18. cro hhtype by relhrp. compute test=0. if age<18 and relhrp=7 test=1. freq test. *the supposed relation to hhref person is parent of *ref person errors, these are children with a parent. Do if age>17 and agekidx=1. compute famstat=1. Else if age>17 and (agekidx>1 and agekidx<4). compute famstat=2. Else if age>17 and age<40. compute famstat=0. Else if age>39. compute famstat=3. Else if relhrp=3 or relhrp=4 or relhrp=7 or relhrp=15. compute famstat=4. Else. compute famstat=5. End if. freq famstat. cro famstat by agekidx relhrp. cro RESPMAR by RESPWith. Do if respmar=2 or RESPWith=1 or RESPWith=3. compute civstat=1. Else if respmar=1 or respmar>2. compute civstat=2. End if. cro civstat by respmar respwith relhrp. Do if respmar=2. compute cohab=0. Else if RESPWith=1 or RESPWith=3. compute cohab=1. Else if respmar=1 or respmar>2. compute cohab=-7. End if. cro cohab by respmar respwith relhrp civstat. compute cphome=0. if civstat=2 and (relhrp=3 or relhrp=4 or relhrp=7 or relhrp=15) cphome=1. freq cphome. cro cphome by civstat. Compute singpar=0. if (hhtypb=4 or hhtypb=5) and relhrp=0 singpar=1. freq singpar. cro singpar by relhrp hhtypb. recode relhrp (0=1) (1,2=2) (3,4,5=3) (6=6) (7,8,9=4) (10=7) (11,12,13=5) (14=8) (15,16,17=9) (18=10) into relrefp. freq relrefp. cro relhrp by relrefp. Do if nation1=6. compute citizen=0. Else if nation1>6. compute citizen=-8. Else. compute citizen=1. End if. freq citizen. cro citizen by nation1. cro FtPtWk by DVILO3a Parthrs. cro FtPtWk by YInAct by Wrking. cro JbAway by YInAct by Wrking. cro Wrking by JbAway. cro Wrking JbAway by Looked StartJ. cro DVILO3a by ecact. cro YInAct by Parthrs. temp. select if FtPtWk>2. cro ES2000 by TotUs1. temp. select if OwnBus=1 or RelBus=1. cro ES2000 by TotUs1. compute retired=0. if age>75 or YInAct=6 or (YInAct=2 and age>64) retired=1. freq retired. cro retired by YInAct. cro YInAct by Wrking JbAway Parthrs OwnBus RelBus FtPtWk. *or Parthrs=1 or Parthrs=2 included initially, but retired people *seem to have been asked this question about what they were rather *that what they are doing. Do if (Wrking=1 or JbAway=1 or OwnBus=1 or RelBus=1) and FtPtWk=1. compute empstat=1. compute emp=1. *one case of a self-employed person who usually works 12 hours *per week who did not answer a number of employment question, *include this person in part-time work with TotUs1=12. Else if ((Wrking=1 or JbAway=1 or OwnBus=1 or RelBus=1) and FtPtWk=2) or TotUs1=12. compute empstat=2. compute emp=1. Else if FtPtWk>2 and YInAct<0. compute empstat=-8. compute emp=-8. Else. compute empstat=4. compute emp=0. End if. cro emp by empstat. cro empstat by Wrking JbAway FtPtWk OwnBus RelBus. compute unemp=0. if DVILO3a=2 or startj=1 or looked=1 unemp=1. freq unemp. cro unemp by DVILO3a startj looked NSSECB. compute student=0. if YInAct=1 or FullEd=97 or NSSECB=15 student=1. freq student. cro student by YInAct FullEd NSSECB. compute empsp=-9. cro TotUs1 by empstat Parthrs. *some inconsistencies are fixed with hours of work. *14 cases of people who allegedly usually are working 35-60 *hours per week but coded as part-time - reset to full-time. if empstat=2 and TotUs1>34 empstat=1. *check cases of low reported hours amoung 29 FT diarists. compute test=0. if empstat=1 and (TotUs1>0 and TotUs1<30) test=1. temp. select if test=1. freq age NSSECB ES2000 ecact sex OwnBus RelBus. *amend these 29 cases to part-time. If test=1 empstat=2. recode TotUs1 (-99 thru 0=-8) (99 thru high=-8) (else=copy) into workhrs. if workhrs=-8 and empstat=4 workhrs=-7. formats workhrs (f4.0). freq workhrs. temp. select if workhrs=-8. cro empstat by Parthrs. temp. select if workhrs=-8 and parthrs=2. freq persid. *2005020600209 set to 5 hours. if workhrs=-8 and parthrs=2 workhrs=5. freq workhrs. temp. select if workhrs>0. means workhrs by empstat /cells= mean median. temp. select if workhrs>17.75 and workhrs<19. freq persid. * list of persids of people who actually reported 18 usual hours of work. * 10051501 40340501 50160101 60331401 60400101 * 90120101 110300301 120141701 120332701 120333001 * 210420501 220021301 220431301 2005020301408 2005020601410 * 2005020700311 2005020800519 2005020807722 2005021203419 2005021203430 * 2005021305404 2005021305418 2005021405616 2005021703128 2005021707913 * 2005021900912 2005060700828 2005060702004 2005060702011 2005060800820 * 2005061001019 2005061002204 2005061003421 2005061300523 2005061900513 * 2005062101514 2005062201606 2005062204021 2005062302416 2005062306020 * 2005062600826. *workhrs has odd values, round to make single digit hours. recode workhrs (1.4 thru 2 =2) (3.4 thru 4 =4) (4.4 thru 5 =5) (6 thru 6.3 =6) (7 thru 7.3 =7) (7.4 thru 8 =8) (9.4 thru 10.3=10) (10.4 thru 11 =11) (11.4 thru 12 =12) (12.4 thru 13 =13) (15.4 thru 16 =16) (16.4 thru 17 =17) (17.4 thru 18 =18) (18.4 thru 19 =19) (19.4 thru 20 =20) (21.4 thru 22 =22) (22.4 thru 23 =23) (23.4 thru 24 =24) (24.4 thru 25.3=25) (26 thru 26.3 =26) (27.4 thru 28 =28) (28.5 thru 29 =29) (29.4 thru 30 =30) (31.4 thru 32 =32) (32.4 thru 33 =33) (33.4 thru 34 =34) (34.4 thru 35 =35) (36 thru 36.3=36) (36.4 thru 37.3=37) (37.4 thru 38 =38) (38.4 thru 39 =39) (39.4 thru 40 =40) (40.4 thru 41.3=41) (41.4 thru 42.3=42) (42.4 thru 43 =43) (46.4 thru 47 =47) (47.4 thru 48 =48) (else=copy). freq workhrs. temp. select if workhrs<0. freq empstat. temp. select if workhrs>0 and empstat=4. freq age. *some working aged people with working hours whose full or part-time status unknown. if workhrs>0 and empstat=4 empstat=3. rename variables (sumgross=empinclm). freq empinclm. cro es2000 by nssecb. Do if NSSECB<3 or NSSECB=5. compute occup=1. Else if NSSECB<5. compute occup=7. Else if NSSECB<4. compute occup=7. Else if NSSECB=6 or NSSECB=7.1 or NSSECB=7.3 or NSSECB=7.4 or NSSECB=12.6. compute occup=9. Else if NSSECB=7.2 or NSSECB=8.1 or NSSECB=10 or NSSECB=12.1 or NSSECB=12.2 or NSSECB=12.7 or NSSECB=13.1. compute occup=11. Else if NSSECB=8.2 or NSSECB=9.2 or NSSECB=12.5 or NSSECB=13.5. compute occup=12. Else if NSSECB=11.1 or NSSECB=11.2 or NSSECB=12.3 or NSSECB=12.4 or NSSECB=13.2 or NSSECB=13.3 or NSSECB=13.4. compute occup=13. Else if NSSECB=9.1. compute occup=14. Else if empstat=-8. compute occup=-8. Else. compute occup=-7. End if. freq occup. cro NSSECB by occup. compute sector=-9. cro HighEd by Highed4. Do if Highed4=1 or HighEd=2. compute edcat=3. Else if HighEd=99. compute edcat=-8. Else if HighEd=8. compute edcat=1. Else. compute edcat=2. End if. freq edcat. cro edcat by highed highed4. rename variables (highed=educa). if Highed4=1 educa=1. freq educa. compute rushed=-9. recode qhealth1 (1=3) (2=2) (3=1) (4,5=0) (else=-8) into health. cro qhealth1 by health. compute carer=-9. compute disab=0. if YInAct=5 disab=1. cro disab by YInAct. *create time use variables. freq pact1. *7 cases of missing first time slot - these investigated. *these cases have missing followed by sleep then get up, otherwise *good diary. do repeat a=pact1 to pact30. do If serial=80300101. compute a=-10. End if. end repeat. do repeat a=pact1 to pact12. do If serial=80300201 or serial=120022701. compute a=-10. End if. end repeat. do repeat a=pact1 to pact14. do If serial=110061101. compute a=-10. End if. end repeat. do repeat a=pact120 to pact144. do If serial=110061101. compute a=-10. End if. end repeat. do repeat a=pact1 to pact10. do If serial=230581301. compute a=-10. End if. end repeat. do repeat a=pact1 to pact17. do If serial=240161601. compute a=-10. End if. end repeat. do repeat a=pact1 to pact3. do If serial=2005060902129. compute a=-10. End if. end repeat. do repeat a=pact3 to pact8. do If serial=100202201. compute a=-10. End if. end repeat. do repeat a=pact3 to pact17. do If serial=100320301. compute a=-10. End if. end repeat. do repeat a=pact3 to pact24. do If serial=240111001. compute a=-10. End if. end repeat. freq pact1 to pact20. freq pact144. do If serial=40172901 or serial=220312101 or serial=240040201 or serial=300021901. compute pact144=-10. End if. do repeat a=pact110 to pact144. do If serial=60281501. compute a=-10. End if. end repeat. do repeat a=pact126 to pact144. do If serial=70062701. compute a=-10. End if. end repeat. do repeat a=pact116 to pact144. do If serial=80063001. compute a=-10. End if. end repeat. do repeat a=pact141 to pact144. do If serial=180010701. compute a=-10. End if. end repeat. do repeat a=pact113 to pact144. do If serial=220261701. compute a=-10. End if. end repeat. do repeat a=pact116 to pact144. do If serial=220310901 or serial=290121501. compute a=-10. End if. end repeat. do repeat a=pact139 to pact144. do If serial=220312901. compute a=-10. End if. end repeat. do repeat a=pact122 to pact144. do If serial=230341801 or serial=2005061900511. compute a=-10. End if. end repeat. do repeat a=pact98 to pact144. do If serial=290121701. compute a=-10. End if. end repeat. do repeat a=pact128 to pact144. do If serial=2005060902103 or serial=2005062700512. compute a=-10. End if. end repeat. do repeat a=pact115 to pact144. do If serial=2005060902121. compute a=-10. End if. end repeat. do repeat a=pact110 to pact144. do If serial=2005061500426. compute a=-10. End if. end repeat. do repeat a=pact125 to pact144. do If serial=2005062700509. compute a=-10. End if. end repeat. freq pact144. compute miss=0. do repeat a=pact1 to pact144. if a=-1 or a=-10 miss=miss+10. End repeat. freq miss. *4781 diaries have no missing time in original code. *98.7% of diaries are missing 90 minutes or less. compute miss=0. do repeat a=pact1 to pact144. if a=-1 miss=miss+10. End repeat. freq miss. *after imputing missing sleep, 4803 diaries have no missing time. *99.1% of diaries are missing 90 minutes or less. freq sact19 sact91 sact105 lact19 lact91 lact105. *roughly 25% of location time missing. Location codes do *not contain travel information. compute test=0. do repeat a=pact1 to pact144 / b=sact1 to sact144. Do if a=-1 and b>-1. compute a=b. compute b=-1. compute test=1. End if. end repeat. freq test. *no cases of a secondary activity recorded where a main activity is not recorded. *next look into missing location time. compute misloc=0. do repeat a=lact1 to lact144. if a=-1 misloc=misloc+10. end repeat. freq misloc. *3505 (70.9%) of cases have no missing location time. *221 cases (4.5%) have no location recorded. *some activity codes cover time at home: 8 - maintain own house *23 spend time with friends / family at home *other activities not at home: 24 go out with friends / family *26 visits to cinema /gallery etc, 41-99 all travel codes. *use this location information to fill in some information. compute misloc=0. do repeat a=pact1 to pact144 /b=sact1 to sact144 /c=lact1 to lact144. Do if (a=8 or a=23 or b=8 or b=23) and c=-1. compute c=1. Else if (a=24 or a=26 or a>40 or b=24 or b=26 or b>40) and c=-1. compute c=2. End if. end repeat. execute. do repeat a=lact1 to lact144. if a=-1 misloc=misloc+10. end repeat. freq misloc. *3506 (71.0%) of cases now have no missing location time. *123 cases (2.5%) now have no location recorded. *next deal with missing travel in missing activity time. vector pact=pact1 to pact144 /sact=sact1 to sact144 /lact=lact1 to lact144. loop i=1 to 142. compute j=i+1. compute k=i+2. Do if ((pact(i)>-1 and pact(i)<41) and (sact(i)>-1 and sact(i)<41)) and pact(j)=-1 and ((pact(k)>-1 and pact(k)<41) and (sact(k)>-1 and sact(k)<41)) and (lact(i)~=lact(j) or lact(i)~=lact(k)) and (lact(i)~=-1 and lact(k)~=-1). compute pact(j)=98. Do if lact(j)=-1. compute lact(j)=2. End if. End if. end loop. loop i=1 to 141. compute j=i+1. compute k=i+2. compute l=i+3. Do if ((pact(i)>-1 and pact(i)<41) and (sact(i)>-1 and sact(i)<41)) and pact(j)=-1 and pact(k)=-1 and ((pact(l)>-1 and pact(l)<41) and (sact(l)>-1 and sact(l)<41)) and (lact(i)~=lact(j) or lact(i)~=lact(l)) and (lact(i)~=-1 and lact(l)~=-1). compute pact(j)=98. compute pact(k)=98. Do if lact(j)=-1. compute lact(j)=2. End if. Do if lact(k)=-1. compute lact(k)=2. End if. End if. end loop. loop i=1 to 140. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. Do if ((pact(i)>-1 and pact(i)<41) and (sact(i)>-1 and sact(i)<41)) and pact(j)=-1 and pact(k)=-1 and pact(l)=-1 and ((pact(m)>-1 and pact(m)<41) and (sact(m)>-1 and sact(m)<41)) and (lact(i)~=lact(j) or lact(i)~=lact(m)) and (lact(i)~=-1 and lact(m)~=-1). compute pact(j)=98. compute pact(k)=98. compute pact(l)=98. Do if lact(j)=-1. compute lact(j)=2. End if. Do if lact(k)=-1. compute lact(k)=2. End if. Do if lact(l)=-1. compute lact(l)=2. End if. End if. end loop. compute miss=0. do repeat a=pact1 to pact144. if a=-1 miss=miss+10. End repeat. freq miss. *no apparent missing travel. *fill in short gaps with no travel as staying in the same location. vector pact=pact1 to pact144 /sact=sact1 to sact144 /lact=lact1 to lact144. loop i=1 to 142. compute j=i+1. compute k=i+2. if pact(i)<41 and sact(i)<41 and pact(j)<41 and sact(j)<41 and pact(k)<41 and sact(k)<41 and lact(j)=-1 and lact(i)=lact(k) lact(j)=lact(i). End loop. loop i=1 to 141. compute j=i+1. compute k=i+2. compute l=i+3. Do if pact(i)<41 and sact(i)<41 and pact(j)<41 and sact(j)<41 and pact(k)<41 and sact(k)<41 and pact(l)<41 and sact(l)<41 and lact(j)=-1 and lact(k)=-1 and lact(i)=lact(l). compute lact(j)=lact(i). compute lact(k)=lact(i). End if. End loop. loop i=1 to 140. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. Do if pact(i)<41 and sact(i)<41 and pact(j)<41 and sact(j)<41 and pact(k)<41 and sact(k)<41 and pact(l)<41 and sact(l)<41 and pact(m)<41 and sact(m)<41 and lact(j)=-1 and lact(k)=-1 and lact(l)=-1 and lact(i)=lact(m). compute lact(j)=lact(i). compute lact(k)=lact(i). compute lact(l)=lact(i). End if. End loop. loop i=1 to 139. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. Do if pact(i)<41 and sact(i)<41 and pact(j)<41 and sact(j)<41 and pact(k)<41 and sact(k)<41 and pact(l)<41 and sact(l)<41 and pact(m)<41 and sact(m)<41 and pact(n)<41 and sact(n)<41 and lact(j)=-1 and lact(k)=-1 and lact(l)=-1 and lact(m)=-1 and lact(i)=lact(n). compute lact(j)=lact(i). compute lact(k)=lact(i). compute lact(l)=lact(i). compute lact(m)=lact(i). End if. End loop. loop i=1 to 138. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. Do if pact(i)<41 and sact(i)<41 and pact(j)<41 and sact(j)<41 and pact(k)<41 and sact(k)<41 and pact(l)<41 and sact(l)<41 and pact(m)<41 and sact(m)<41 and pact(n)<41 and sact(n)<41 and pact(o)<41 and sact(o)<41 and lact(j)=-1 and lact(k)=-1 and lact(l)=-1 and lact(m)=-1 and lact(n)=-1 and lact(i)=lact(o). compute lact(j)=lact(i). compute lact(k)=lact(i). compute lact(l)=lact(i). compute lact(m)=lact(i). compute lact(n)=lact(i). End if. End loop. loop i=1 to 137. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. compute p=i+7. Do if pact(i)<41 and sact(i)<41 and pact(j)<41 and sact(j)<41 and pact(k)<41 and sact(k)<41 and pact(l)<41 and sact(l)<41 and pact(m)<41 and sact(m)<41 and pact(n)<41 and sact(n)<41 and pact(o)<41 and sact(o)<41 and pact(p)<41 and sact(p)<41 and lact(j)=-1 and lact(k)=-1 and lact(l)=-1 and lact(m)=-1 and lact(n)=-1 and lact(o)=-1 and lact(i)=lact(p). compute lact(j)=lact(i). compute lact(k)=lact(i). compute lact(l)=lact(i). compute lact(m)=lact(i). compute lact(n)=lact(i). compute lact(o)=lact(i). End if. End loop. compute misloc=0. do repeat a=lact1 to lact144. if a=-1 misloc=misloc+10. end repeat. freq misloc. *3517 (71.2%) of cases now have no missing location time. *123 cases (2.5%) now have no location recorded. *fill in missing location where people are asleep from where they are when they wake. Do if (pact1=-10 or pact1=1) and lact1=-1 and (pact2>1 and pact2<41). compute lact1=lact2. End if. Do repeat a=lact1 to lact2. Do if (pact2=-10 or pact2=1) and lact2=-1 and (pact3>1 and pact3<41). if a=-1 a=lact3. End if. End repeat. Do repeat a=lact1 to lact3. Do if (pact3=-10 or pact3=1) and lact3=-1 and (pact4>1 and pact4<41). if a=-1 a=lact4. End if. End repeat. Do repeat a=lact1 to lact4. Do if (pact4=-10 or pact4=1) and lact4=-1 and (pact5>1 and pact5<41). if a=-1 a=lact5. End if. End repeat. Do repeat a=lact1 to lact5. Do if (pact5=-10 or pact5=1) and lact5=-1 and (pact6>1 and pact6<41). if a=-1 a=lact6. End if. End repeat. Do repeat a=lact1 to lact6. Do if (pact6=-10 or pact6=1) and lact6=-1 and (pact7>1 and pact7<41). if a=-1 a=lact7. End if. End repeat. Do repeat a=lact1 to lact7. Do if (pact7=-10 or pact7=1) and lact7=-1 and (pact8>1 and pact8<41). if a=-1 a=lact8. End if. End repeat. Do repeat a=lact1 to lact8. Do if (pact8=-10 or pact8=1) and lact8=-1 and (pact9>1 and pact9<41). if a=-1 a=lact9. End if. End repeat. Do repeat a=lact1 to lact9. Do if (pact9=-10 or pact9=1) and lact9=-1 and (pact10>1 and pact10<41). if a=-1 a=lact10. End if. End repeat. Do repeat a=lact1 to lact10. Do if (pact10=-10 or pact10=1) and lact10=-1 and (pact11>1 and pact11<41). if a=-1 a=lact11. End if. End repeat. Do repeat a=lact1 to lact11. Do if (pact11=-10 or pact11=1) and lact11=-1 and (pact12>1 and pact12<41). if a=-1 a=lact12. End if. End repeat. Do repeat a=lact1 to lact12. Do if (pact12=-10 or pact12=1) and lact12=-1 and (pact13>1 and pact13<41). if a=-1 a=lact13. End if. End repeat. Do repeat a=lact1 to lact13. Do if (pact13=-10 or pact13=1) and lact13=-1 and (pact14>1 and pact14<41). if a=-1 a=lact14. End if. End repeat. Do repeat a=lact1 to lact14. Do if (pact14=-10 or pact14=1) and lact14=-1 and (pact15>1 and pact15<41). if a=-1 a=lact15. End if. End repeat. Do repeat a=lact1 to lact15. Do if (pact15=-10 or pact15=1) and lact15=-1 and (pact16>1 and pact16<41). if a=-1 a=lact16. End if. End repeat. Do repeat a=lact1 to lact16. Do if (pact16=-10 or pact16=1) and lact16=-1 and (pact17>1 and pact17<41). if a=-1 a=lact17. End if. End repeat. Do repeat a=lact1 to lact17. Do if (pact17=-10 or pact17=1) and lact17=-1 and (pact18>1 and pact18<41). if a=-1 a=lact18. End if. End repeat. Do repeat a=lact1 to lact18. Do if (pact18=-10 or pact18=1) and lact18=-1 and (pact19>1 and pact19<41). if a=-1 a=lact19. End if. End repeat. Do repeat a=lact1 to lact19. Do if (pact19=-10 or pact19=1) and lact19=-1 and (pact20>1 and pact20<41). if a=-1 a=lact20. End if. End repeat. Do repeat a=lact1 to lact20. Do if (pact20=-10 or pact20=1) and lact20=-1 and (pact21>1 and pact21<41). if a=-1 a=lact21. End if. End repeat. Do repeat a=lact1 to lact21. Do if (pact21=-10 or pact21=1) and lact21=-1 and (pact22>1 and pact22<41). if a=-1 a=lact22. End if. End repeat. Do repeat a=lact1 to lact22. Do if (pact22=-10 or pact22=1) and lact22=-1 and (pact23>1 and pact23<41). if a=-1 a=lact23. End if. End repeat. Do repeat a=lact1 to lact23. Do if (pact23=-10 or pact23=1) and lact23=-1 and (pact24>1 and pact24<41). if a=-1 a=lact24. End if. End repeat. Do repeat a=lact1 to lact24. Do if (pact24=-10 or pact24=1) and lact24=-1 and (pact25>1 and pact25<41). if a=-1 a=lact25. End if. End repeat. Do repeat a=lact1 to lact25. Do if (pact25=-10 or pact25=1) and lact25=-1 and (pact26>1 and pact26<41). if a=-1 a=lact26. End if. End repeat. Do repeat a=lact1 to lact26. Do if (pact26=-10 or pact26=1) and lact26=-1 and (pact27>1 and pact27<41). if a=-1 a=lact27. End if. End repeat. Do repeat a=lact1 to lact27. Do if (pact27=-10 or pact27=1) and lact27=-1 and (pact28>1 and pact28<41). if a=-1 a=lact28. End if. End repeat. Do repeat a=lact1 to lact28. Do if (pact28=-10 or pact28=1) and lact28=-1 and (pact29>1 and pact29<41). if a=-1 a=lact29. End if. End repeat. Do repeat a=lact1 to lact29. Do if (pact29=-10 or pact29=1) and lact29=-1 and (pact30>1 and pact30<41). if a=-1 a=lact30. End if. End repeat. *likewise fill in location missing during sleep from where people are when they *go to sleep at the end of the diary day. Do repeat a=lact108 to lact144. Do if (pact107>1 and pact107<41) and (pact108=-10 or pact108=1) and lact108=-1. if a=-1 a=lact107. End if. End repeat. Do repeat a=lact109 to lact144. Do if (pact108>1 and pact108<41) and (pact109=-10 or pact109=1) and lact109=-1. if a=-1 a=lact108. End if. End repeat. Do repeat a=lact110 to lact144. Do if (pact109>1 and pact109<41) and (pact110=-10 or pact110=1) and lact110=-1. if a=-1 a=lact109. End if. End repeat. Do repeat a=lact111 to lact144. Do if (pact110>1 and pact110<41) and (pact111=-10 or pact111=1) and lact111=-1. if a=-1 a=lact110. End if. End repeat. Do repeat a=lact112 to lact144. Do if (pact111>1 and pact111<41) and (pact112=-10 or pact112=1) and lact112=-1. if a=-1 a=lact111. End if. End repeat. Do repeat a=lact113 to lact144. Do if (pact112>1 and pact112<41) and (pact113=-10 or pact113=1) and lact113=-1. if a=-1 a=lact112. End if. End repeat. Do repeat a=lact114 to lact144. Do if (pact113>1 and pact113<41) and (pact114=-10 or pact114=1) and lact114=-1. if a=-1 a=lact113. End if. End repeat. Do repeat a=lact115 to lact144. Do if (pact114>1 and pact114<41) and (pact115=-10 or pact115=1) and lact115=-1. if a=-1 a=lact114. End if. End repeat. Do repeat a=lact116 to lact144. Do if (pact115>1 and pact115<41) and (pact116=-10 or pact116=1) and lact116=-1. if a=-1 a=lact115. End if. End repeat. Do repeat a=lact117 to lact144. Do if (pact116>1 and pact116<41) and (pact117=-10 or pact117=1) and lact117=-1. if a=-1 a=lact116. End if. End repeat. Do repeat a=lact118 to lact144. Do if (pact117>1 and pact117<41) and (pact118=-10 or pact118=1) and lact118=-1. if a=-1 a=lact117. End if. End repeat. Do repeat a=lact119 to lact144. Do if (pact118>1 and pact118<41) and (pact119=-10 or pact119=1) and lact119=-1. if a=-1 a=lact118. End if. End repeat. Do repeat a=lact120 to lact144. Do if (pact119>1 and pact119<41) and (pact120=-10 or pact120=1) and lact120=-1. if a=-1 a=lact119. End if. End repeat. Do repeat a=lact121 to lact144. Do if (pact120>1 and pact120<41) and (pact121=-10 or pact121=1) and lact121=-1. if a=-1 a=lact120. End if. End repeat. Do repeat a=lact122 to lact144. Do if (pact121>1 and pact121<41) and (pact122=-10 or pact122=1) and lact122=-1. if a=-1 a=lact121. End if. End repeat. Do repeat a=lact123 to lact144. Do if (pact122>1 and pact122<41) and (pact123=-10 or pact123=1) and lact123=-1. if a=-1 a=lact122. End if. End repeat. Do repeat a=lact124 to lact144. Do if (pact123>1 and pact123<41) and (pact124=-10 or pact124=1) and lact124=-1. if a=-1 a=lact123. End if. End repeat. Do repeat a=lact125 to lact144. Do if (pact124>1 and pact124<41) and (pact125=-10 or pact125=1) and lact125=-1. if a=-1 a=lact124. End if. End repeat. Do repeat a=lact126 to lact144. Do if (pact125>1 and pact125<41) and (pact126=-10 or pact126=1) and lact126=-1. if a=-1 a=lact125. End if. End repeat. Do repeat a=lact127 to lact144. Do if (pact126>1 and pact126<41) and (pact127=-10 or pact127=1) and lact127=-1. if a=-1 a=lact126. End if. End repeat. Do repeat a=lact128 to lact144. Do if (pact127>1 and pact127<41) and (pact128=-10 or pact128=1) and lact128=-1. if a=-1 a=lact127. End if. End repeat. Do repeat a=lact129 to lact144. Do if (pact128>1 and pact128<41) and (pact129=-10 or pact129=1) and lact129=-1. if a=-1 a=lact128. End if. End repeat. Do repeat a=lact130 to lact144. Do if (pact129>1 and pact129<41) and (pact130=-10 or pact130=1) and lact130=-1. if a=-1 a=lact129. End if. End repeat. Do repeat a=lact131 to lact144. Do if (pact130>1 and pact130<41) and (pact131=-10 or pact131=1) and lact131=-1. if a=-1 a=lact130. End if. End repeat. Do repeat a=lact132 to lact144. Do if (pact131>1 and pact131<41) and (pact132=-10 or pact132=1) and lact132=-1. if a=-1 a=lact131. End if. End repeat. Do repeat a=lact133 to lact144. Do if (pact132>1 and pact132<41) and (pact133=-10 or pact133=1) and lact133=-1. if a=-1 a=lact132. End if. End repeat. Do repeat a=lact134 to lact144. Do if (pact133>1 and pact133<41) and (pact134=-10 or pact134=1) and lact134=-1. if a=-1 a=lact133. End if. End repeat. Do repeat a=lact135 to lact144. Do if (pact134>1 and pact134<41) and (pact135=-10 or pact135=1) and lact135=-1. if a=-1 a=lact134. End if. End repeat. Do repeat a=lact136 to lact144. Do if (pact135>1 and pact135<41) and (pact136=-10 or pact136=1) and lact136=-1. if a=-1 a=lact135. End if. End repeat. Do repeat a=lact137 to lact144. Do if (pact136>1 and pact136<41) and (pact137=-10 or pact137=1) and lact137=-1. if a=-1 a=lact136. End if. End repeat. Do repeat a=lact138 to lact144. Do if (pact137>1 and pact137<41) and (pact138=-10 or pact138=1) and lact138=-1. if a=-1 a=lact137. End if. End repeat. Do repeat a=lact139 to lact144. Do if (pact138>1 and pact138<41) and (pact139=-10 or pact139=1) and lact139=-1. if a=-1 a=lact138. End if. End repeat. Do repeat a=lact140 to lact144. Do if (pact139>1 and pact139<41) and (pact140=-10 or pact140=1) and lact140=-1. if a=-1 a=lact139. End if. End repeat. Do repeat a=lact141 to lact144. Do if (pact140>1 and pact140<41) and (pact141=-10 or pact141=1) and lact141=-1. if a=-1 a=lact140. End if. End repeat. Do repeat a=lact142 to lact144. Do if (pact141>1 and pact141<41) and (pact142=-10 or pact142=1) and lact142=-1. if a=-1 a=lact141. End if. End repeat. Do repeat a=lact143 to lact144. Do if (pact142>1 and pact142<41) and (pact143=-10 or pact143=1) and lact143=-1. if a=-1 a=lact142. End if. End repeat. compute misloc=0. do repeat a=lact1 to lact144. if a=-1 misloc=misloc+10. end repeat. freq misloc lact1 lact144. *this produces a few minor adjustments at the beginning of the diary day *but no adjustment at the end of the diary day. *mark instances of time away from home but no activity recorded. Do repeat a=pact1 to pact144 / b=lact1 to lact144. if a=-1 and b=2 a=-8. end repeat. compute miss=0. do repeat a=pact1 to pact144. if a=-1 miss=miss+10. End repeat. freq miss. *after imputing time away from home, 4820 diaries have no missing time. *99.3% of diaries are missing 90 minutes or less. *mark instances of likely multitasking as diarists prepare to leave home *or return home. vector pact=pact1 to pact144 / sact=sact1 to sact144 / lact=lact1 to lact144. Loop i=1 to 143. compute j=i+1. if (pact(i)>40 or sact(i)>40) and pact(j)=-1 and lact(j)=1 pact(j)=-9. if pact(i)=-1 and lact(i)=1 and (pact(j)>40 or sact(j)>40) pact(i)=-9. end loop. execute. vector pact=pact1 to pact144 / sact=sact1 to sact144 / lact=lact1 to lact144. Loop i=1 to 143. compute j=i+1. if pact(i)=-1 and pact(j)=-9 and lact(i)=1 pact(i)=-9. if pact(j)=-1 and lact(j)=1 and pact(i)=-9 pact(j)=-9. end loop. compute miss=0. do repeat a=pact1 to pact144. if a=-1 miss=miss+10. End repeat. freq miss. *after imputing time away from home, 4824 diaries have no missing time. *99.3% of diaries are missing 90 minutes or less. *investigate if the computer use recoded to secondary activity flag *consistent with all instances of the primary and secondary codes. compute test=0. compute testa=0. compute testb=0. compute testc=0. vector pact=pact1 to pact144 / sact=sact1 to sact144 / Compfg=Compfg1 to Compfg144. Loop i=1 to 144. If compfg(i)=1 and pact(i)~=29 and sact(i)~=29 test=test+1. If compfg(i)=1 and pact(i)=29 and sact(i)~=29 testa=testa+1. If compfg(i)=1 and pact(i)~=29 and sact(i)=29 testb=testb+1. If compfg(i)=1 and pact(i)=29 and sact(i)=29 testc=testc+1. End loop. freq test testa testb testc. *no cases of compflag and main and secondary act computing. *1 case 2ndry act=comp and comflag marked. *3 cases main act comp and compflag marked. *2.8% compflag marked and no comp as activity. compute testa=0. compute testb=0. vector pact=pact1 to pact144 / sact=sact1 to sact144 / Compfg=Compfg1 to Compfg144. Loop i=1 to 144. If compfg(i)=1 and pact(i)=-1 and sact(i)=-1 testa=testa+1. If compfg(i)=1 and pact(i)~=29 and sact(i)=-1 testb=testb+1. end loop. freq testa testb. *when no recorded secondary activity but there is a computing flag, set *the secondary activity to computing. do repeat a=sact1 to sact144 / b=Compfg1 to Compfg144. if a=-1 and b=1 a=29. end repeat. *finally look at missing first and last location. freq lact1 lact144. *just over 1/4th of cases missing location at the beginning or end. cro pact1 by lact1. cro pact144 by lact144. *the vast majority of these missing cases occur during sleep. cro lact1 by lact144. *most cases involve missing at the beginning and end of the diary day. *compute a marker for starting and ending the diary day asleep. compute test=0. if (pact1=-10 or pact1=1) and (pact144=-10 or pact144=1) and lact1=-1 and lact144=-1 test=1. freq test. *assume people at home if start and end the diary day asleep but missing *most location time. Do repeat a=pact1 to pact30 / b=lact1 to lact30. if a=-10 or a=1 or a=3 and b=-1 and test=1 b=1. End repeat. Do repeat a=pact109 to pact144 / b=lact109 to lact144. if a=-10 or a=1 or a=3 and b=-1 and test=1 b=1. End repeat. cro lact1 by lact144. *if people have an identified location and then a missing location, but *this change is not associated with travel, code location as continuing. vector pact=pact1 to pact144 / lact=lact1 to lact144. loop i=1 to 143. compute j=i+1. if lact(i)>-1 and lact(j)=-1 and pact(i)<41 and pact(j)<41 lact(j)=lact(i). end loop. execute. *if someone doing something in an unknown location that is likely to not *be at home then travels, then home, code the previous activity as away *from home. If someone at home then travels then doing an activity likely *to not be at home, code as location away from home. vector pact=pact1 to pact144 / lact=lact1 to lact144. *10 minutes travel involved. loop i=1 to 142. compute j=i+1. compute k=i+2. if lact(i)=1 and pact(j)>40 and ((pact(k)>10 and pact(k)<15) or pact(k)=19 or pact(k)=27) and lact(k)=-1 lact(k)=2. end loop. *20 minutes travel involved. loop i=1 to 141. compute j=i+1. compute k=i+2. compute l=i+3. if lact(i)=1 and pact(j)>40 and pact(k)>40 and ((pact(l)>10 and pact(l)<15) or pact(l)=19 or pact(l)=27) and lact(l)=-1 lact(l)=2. end loop. *30 minutes travel involved. loop i=1 to 140. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and ((pact(m)>10 and pact(m)<15) or pact(m)=19 or pact(m)=27) and lact(m)=-1 lact(m)=2. end loop. *40 minutes travel involved. loop i=1 to 139. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and pact(m)>40 and ((pact(n)>10 and pact(n)<15) or pact(n)=19 or pact(n)=27) and lact(n)=-1 lact(n)=2. end loop. *50 minutes travel involved. loop i=1 to 138. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and pact(m)>40 and pact(n)>40 and ((pact(o)>10 and pact(o)<15) or pact(o)=19 or pact(o)=27) and lact(o)=-1 lact(o)=2. end loop. *1 hour travel involved. loop i=1 to 137. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. compute p=i+7. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and pact(m)>40 and pact(n)>40 and pact(o)>40 and ((pact(p)>10 and pact(p)<15) or pact(p)=19 or pact(p)=27) and lact(p)=-1 lact(p)=2. end loop. *1 hour 10 minutes travel involved. loop i=1 to 136. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. compute p=i+7. compute q=i+8. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and pact(m)>40 and pact(n)>40 and pact(o)>40 and pact(p)>40 and ((pact(q)>10 and pact(q)<15) or pact(q)=19 or pact(q)=27) and lact(q)=-1 lact(q)=2. end loop. *1 hour 20 minutes travel involved. loop i=1 to 135. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. compute p=i+7. compute q=i+8. compute r=i+9. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and pact(m)>40 and pact(n)>40 and pact(o)>40 and pact(p)>40 and pact(q)>40 and ((pact(r)>10 and pact(r)<15) or pact(r)=19 or pact(r)=27) and lact(r)=-1 lact(r)=2. end loop. *1 hour 30 minutes travel involved. loop i=1 to 134. compute j=i+1. compute k=i+2. compute l=i+3. compute m=i+4. compute n=i+5. compute o=i+6. compute p=i+7. compute q=i+8. compute r=i+9. compute s=i+10. if lact(i)=1 and pact(j)>40 and pact(k)>40 and pact(l)>40 and pact(m)>40 and pact(n)>40 and pact(o)>40 and pact(p)>40 and pact(q)>40 and pact(r)>40 and ((pact(s)>10 and pact(s)<15) or pact(s)=19 or pact(s)=27) and lact(s)=-1 lact(s)=2. end loop. loop i=1 to 143. compute j=i+1. if lact(i)>-1 and lact(j)=-1 and pact(i)<41 and pact(j)<41 lact(j)=lact(i). end loop. compute misloc=0. do repeat a=lact1 to lact144. if a=-1 misloc=misloc+10. end repeat. freq misloc lact1 lact144. *most beginning and end of the diary day locations now known; *79.7% have no missing location time now. *create bad diary variable. compute miss=0. compute carflag=0. compute eatdrk=0. compute trav=0. compute rst=0. compute pcare=0. do repeat a=pact1 to pact144 / b=sact1 to sact144 / c=lact1 to lact144. If a=-1 miss=miss+10. if a=9 or (a>14 and a<19) or b=9 or (b>14 and b<19) carflag=1. if a=4 or b=4 or a=5 or b=5 eatdrk=1. if a=22 or a>30 or b>30 or b=22 trav=1. if a=-10 or a=1 or a=2 or b=1 or b=2 rst=1. if a=-9 or a=3 or b=3 pcare=1. end repeat. freq miss carflag eatdrk trav rst pcare. desc miss. *743 diaries are missing travel/exercise; 1 diary has no rest; 347 *diaries are missing personal care, 41 diaries are missing eating *or drinking. 99.3% are complete or missing modest amounts of time, *but 0.7% are missing significant amounts of time. compute misbasic=0. If eatdrk=0 misbasic=misbasic+1. If trav=0 misbasic=misbasic+1. If rst=0 misbasic=misbasic+1. If pcare=0 misbasic=misbasic+1. freq misbasic. *97.9% of diaries not missing basic information; *105 diaries missing basic information. cro carflag by misbasic. *40 cases carers missing 2 activities, no carers missing *more than 2 basic activities. temp. select if misbasic>1 and carflag=1. freq eatdrk trav rst pcare miss. *all carers missing 2 activities recorded travel, curiously, *none recorded sleep or rest. 38 recorded no eating, 2 *recorded no personal care. 3 of these diaries missing *too much activity time to count as good diaries. compute numep=1. vector pact=pact1 to pact144 / sact=sact1 to sact144 / lact=lact1 to lact144. Loop i=1 to 143. compute j=i+1. if pact(i)~=pact(j) or sact(i)~=sact(j) or lact(i)~=lact(j) numep=numep+1. End loop. freq numep. *15 low episode diaries. temp. select if misbasic>1 and carflag=1. freq numep miss. temp. select if carflag=1. freq numep miss. *only 1 diarist who performed care and missing 2 basic activities *missing too much time for analysis. 13 other carers missing more *than 90 minutes. All but 1 diaries from people who performed *care have 7 or more episodes. compute baddiary=0. if miss>90 or numep<7 or misbasic>1 baddiary=1. if misbasic>1 and carflag=1 and numep>6 and miss<91 baddiary=0. freq baddiary. *107 - 2.2% bad diaries. recode miss (0 thru 90=0) (91 thru hi=1). recode numep (0 thru 6=1) (7 thru hi=0) into nep. recode misbasic (0,1=0) (2,3,4=1). if misbasic=1 and carflag=1 and nep=0 and miss=0 misbasic=0. freq miss nep misbasic. cro miss by nep by misbasic. *4834 (97.8%) of diaries of quality; * 1 diary bad on all three criteria * 7 bad on 2 criteria * 99 bad on 1 criteria (33 missing 91+ minutes, * 8 have 6 or fewer episodes; 58 missing 2+ basic acts). freq sex age day. *As no sex or age missing, only the diary quality variables *determine bad case in this survey. Do If baddiary=0 and sex>-8 and age>-8 and day>-8. compute badcase=0. Else if baddiary=0 and (sex=-8 or age=-8) and day>-8. compute badcase=1. Else if baddiary=0 and sex>-8 and age>-8 and day=-8. compute badcase=2. Else if sex>-8 and age>-8 and day>-8 and nep=0 and miss=1 and misbasic=0. compute badcase=3. Else if sex>-8 and age>-8 and day>-8 and nep=1 and miss=0 and misbasic=0. compute badcase=4. Else if sex>-8 and age>-8 and day>-8 and nep=0 and miss=0 and misbasic=1. compute badcase=5. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and miss=0 and misbasic=0. compute badcase=6. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and miss=1 and misbasic=0. compute badcase=7. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and miss=0 and misbasic=0. compute badcase=8. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and miss=0 and misbasic=1. compute badcase=9. Else if sex>-8 and age>-8 and day=-8 and nep=0 and miss=1 and misbasic=0. compute badcase=10. Else if sex>-8 and age>-8 and day=-8 and nep=1 and miss=0 and misbasic=0. compute badcase=11. Else if sex>-8 and age>-8 and day=-8 and nep=0 and miss=0 and misbasic=1. compute badcase=12. Else if sex>-8 and age>-8 and day>-8 and nep=1 and miss=1 and misbasic=0. compute badcase=13. Else if sex>-8 and age>-8 and day>-8 and nep=0 and miss=1 and misbasic=1. compute badcase=14. Else if sex>-8 and age>-8 and day>-8 and nep=1 and miss=0 and misbasic=1. compute badcase=15. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and miss=1 and misbasic=0. compute badcase=16. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and miss=0 and misbasic=0. compute badcase=17. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and miss=0 and misbasic=1. compute badcase=18. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and miss=1 and misbasic=0. compute badcase=19. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and miss=1 and misbasic=1. compute badcase=20. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and miss=0 and misbasic=1. compute badcase=21. Else if sex>-8 and age>-8 and day=-8 and nep=1 and miss=1 and misbasic=0. compute badcase=22. Else if sex>-8 and age>-8 and day=-8 and nep=0 and miss=1 and misbasic=1. compute badcase=23. Else if sex>-8 and age>-8 and day=-8 and nep=1 and miss=0 and misbasic=1. compute badcase=24. Else if sex>-8 and age>-8 and day>-8 and nep=1 and miss=1 and misbasic=1. compute badcase=25. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and miss=1 and misbasic=0. compute badcase=26. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and miss=1 and misbasic=1. compute badcase=27. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and miss=0 and misbasic=1. compute badcase=28. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and miss=1 and misbasic=1. compute badcase=29. Else if sex>-8 and age>-8 and day=-8 and nep=1 and miss=1 and misbasic=1. compute badcase=30. Else. compute badcase=31. End if. val lab 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. *check that all cases have a code. freq badcase. *double check that all correctly coded. cro badcase by sex day nep miss misbasic. *************************** *set up harmonised columns* ***************************. vector main(144) /av(144) /sec(144) /eloc(144) /ict(144) /mtrav(144) /pact=pact1 to pact144 /sact=sact1 to sact144 /lact=lact1 to lact144 /Compfg=Compfg1 to Compfg144. Loop i=1 to 144. compute main(i)=69. compute av(i)=41. compute sec(i)=69. compute eloc(i)=-8. compute ict(i)=0. compute mtrav(i)=-8. if compfg(i)=1 or pact(i)=29 or sact(i)=29 ict(i)=1. End loop. freq ict1 ict38 ict72 ict103. temp. select if ict75=1. cro pact75 by sact75. vector eloc=eloc1 to eloc144 /pact=pact1 to pact144 /sact=sact1 to sact144 /lact=lact1 to lact144. Loop i=1 to 144. Do if lact(i)=1. compute eloc(i)=1. Else if lact(i)=-1. compute eloc(i)=-8. Else if pact(i)>40 or sact(i)>40. compute eloc(i)=8. Else if lact(i)=2 and (pact(i)=11 or sact(i)=11). compute eloc(i)=3. Else if lact(i)=2 and (pact(i)=12 or sact(i)=12). compute eloc(i)=4. Else if lact(i)=2 and pact(i)=19. compute eloc(i)=5. Else if lact(i)=2 and (pact(i)=4 or sact(i)=4). compute eloc(i)=6. Else if lact(i)=2. compute eloc(i)=9. End if. End loop. freq eloc1 eloc56 eloc94. cro eloc75 by lact75. temp. select if eloc75=3. freq pact75 sact75. temp. select if eloc75=5. freq pact75 sact75. vector mtrav=mtrav1 to mtrav144 /pact=pact1 to pact144 /sact=sact1 to sact144. Loop i=1 to 144. Do if pact(i)<40 and sact(i)<40. compute mtrav(i)=-7. End if. Do if (pact(i)>40 and pact(i)<50) or (sact(i)>40 and sact(i)<50). compute mtrav(i)=1. Else if (pact(i)>70 and pact(i)<90) or (sact(i)>70 and sact(i)<90). compute mtrav(i)=2. Else if (pact(i)>50 and pact(i)<60) or (sact(i)>50 and sact(i)<60). compute mtrav(i)=3. Else if (pact(i)>60 and pact(i)<70) or (sact(i)>60 and sact(i)<70). compute mtrav(i)=4. Else if pact(i)>90 or sact(i)>90. compute mtrav(i)=5. End if. End loop. freq mtrav90. cro mtrav75 by lact75 pact75 sact75. compute animal=0. var lab animal minutes interacting with an animal. vector pact=pact1 to pact144 /sact=sact1 to sact144. Loop i=1 to 144. Do if pact(i)=9 or sact(i)=9. compute animal=animal+10. End if. End loop. desc animal. *make AV activity codes. vector av=av1 to av144 /pact=pact1 to pact144 /lact=lact1 to lact144. Loop i=1 to 144. Do if pact(i)=-10 or pact(i)=1. compute av(i)=16. Else if pact(i)=2. compute av(i)=36. Else if pact(i)=3 or pact(i)=-9. compute av(i)=13. Else if pact(i)=4 and lact(i)=2. compute av(i)=28. Else if pact(i)=4 and lact(i)=2. compute av(i)=28. Else if pact(i)=4. compute av(i)=15. Else if pact(i)=5. compute av(i)=6. Else if pact(i)=6 or pact(i)=7. compute av(i)=7. Else if pact(i)=8 or pact(i)=9 or pact(i)=17 or pact(i)=18. compute av(i)=8. Else if pact(i)=11 and lact(i)=1. compute av(i)=2. Else if pact(i)=11. compute av(i)=1. Else if (pact(i)=12 or pact(i)=13) and lact(i)=1. compute av(i)=33. Else if pact(i)=12 or pact(i)=13. compute av(i)=4. Else if pact(i)=14. compute av(i)=23. Else if pact(i)=15 or pact(i)=16. compute av(i)=11. Else if pact(i)=19. compute av(i)=10. Else if pact(i)=20. compute av(i)=31. Else if pact(i)=21. compute av(i)=35. Else if pact(i)=22 or pact(i)=62 or pact(i)=65. compute av(i)=19. Else if pact(i)=23. compute av(i)=38. Else if pact(i)=24. compute av(i)=29. Else if pact(i)=25. compute av(i)=37. Else if pact(i)=26. compute av(i)=24. Else if pact(i)=27. compute av(i)=22. Else if pact(i)>27 and pact(i)<40. compute av(i)=40. Else if pact(i)=41 or pact(i)=44 or pact(i)=51 or pact(i)=54 or pact(i)=61 or pact(i)=64 or pact(i)=71 or pact(i)=74 or pact(i)=81 or pact(i)=84 or pact(i)=91 or pact(i)=94. compute av(i)=12. Else if pact(i)=43 or pact(i)=53 or pact(i)=63 or pact(i)=73 or pact(i)=83 or pact(i)=93. compute av(i)=5. Else if pact(i)=42 or pact(i)=45 or pact(i)=72 or pact(i)=75 or pact(i)=82 or pact(i)=85 or pact(i)=92 or pact(i)=95 or pact(i)=99. compute av(i)=17. Else if pact(i)=52 or pact(i)=55. compute av(i)=21. Else if pact(i)=-1 or pact(i)=-8. compute av(i)=41. Else. compute residual=pact(i). End if. End loop. freq residual. *as residual has no values, no need to reset the variable to test the creation of main. *check all AV variables have codes that match to the right pact codes. temp. select if av75=1. freq pact75 lact75. temp. select if av75=2. freq pact75 lact75. temp. select if av75=4. freq pact75 lact75. temp. select if av75=5. freq pact75. temp. select if av75=6. freq pact75. temp. select if av75=7. freq pact75. temp. select if av75=8. freq pact75. temp. select if av75=10. freq pact75. temp. select if av75=11. freq pact75. temp. select if av75=12. freq pact75. temp. select if av75=13. freq pact75. temp. select if av75=15. freq pact75 lact75. temp. select if av15=16. freq pact15. temp. select if av75=17. freq pact75. temp. select if av75=19. freq pact75. temp. select if av75=21. freq pact75. temp. select if av75=22. freq pact75. temp. select if av75=23. freq pact75. temp. select if av75=24. freq pact75. temp. select if av75=28. freq pact75 lact75. temp. select if av75=29. freq pact75. temp. select if av75=31. freq pact75. temp. select if av75=33. freq pact75 lact75. temp. select if av75=35. freq pact75. temp. select if av75=36. freq pact75. temp. select if av75=37. freq pact75. temp. select if av75=38. freq pact75. temp. select if av75=40. freq pact75. temp. select if av75=41. freq pact75. *make new activity codes. vector main=main1 to main144 /pact=pact1 to pact144 /lact=lact1 to lact144 /mtrav=mtrav1 to mtrav144 /ict=ict1 to ict144. Loop i=1 to 144. Do if pact(i)=-9. compute main(i)=1. Else if pact(i)=1. compute main(i)=2. Else if pact(i)=-10. compute main(i)=3. Else if pact(i)=3. compute main(i)=4. Else if pact(i)=4 and lact(i)=2. compute main(i)=39. Else if pact(i)=4 and (lact(i)=1 or lact(i)=-1). compute main(i)=6. Else if pact(i)=11 and lact(i)~=1. compute main(i)=7. Else if pact(i)=11 and lact(i)=1. compute main(i)=8. Else if pact(i)=12 and lact(i)~=1. compute main(i)=15. Else if (pact(i)=12 or pact(i)=13) and lact(i)=1. compute main(i)=16. Else if pact(i)=13 and lact(i)~=1. compute main(i)=17. Else if pact(i)=5. compute main(i)=18. Else if pact(i)=6. compute main(i)=20. Else if pact(i)=7. compute main(i)=21. Else if pact(i)=8. compute main(i)=22. Else if pact(i)=19. compute main(i)=24. Else if pact(i)=9 and mtrav(i)~=3. compute main(i)=27. Else if pact(i)=9 and mtrav(i)=3. compute main(i)=47. Else if pact(i)=15 or pact(i)=16. compute main(i)=28. Else if pact(i)=17 or pact(i)=18. compute main(i)=32. Else if pact(i)=14. compute main(i)=33. Else if pact(i)=27. compute main(i)=34. Else if pact(i)=26. compute main(i)=37. Else if pact(i)=-8. compute main(i)=41. Else if pact(i)=22. compute main(i)=42. Else if pact(i)=52 or pact(i)=55. compute main(i)=43. Else if pact(i)=62 or pact(i)=65. compute main(i)=44. Else if pact(i)=23 or pact(i)=24. compute main(i)=48. Else if pact(i)=25. compute main(i)=49. Else if pact(i)=30 and ict(i)=0. compute main(i)=51. Else if pact(i)=28. compute main(i)=54. Else if pact(i)=2. compute main(i)=55. Else if pact(i)=21. compute main(i)=56. Else if pact(i)=20. compute main(i)=59. Else if pact(i)=29 or (pact(i)=30 and ict(i)=1). compute main(i)=61. Else if pact(i)=43 or pact(i)=53 or pact(i)=63 or pact(i)=73 or pact(i)=83 or pact(i)=93. compute main(i)=63. Else if pact(i)=41 or pact(i)=51 or pact(i)=61 or pact(i)=71 or pact(i)=81 or pact(i)=91. compute main(i)=66. Else if pact(i)=44 or pact(i)=54 or pact(i)=64 or pact(i)=74 or pact(i)=84 or pact(i)=94. compute main(i)=67. Else if pact(i)=42 or pact(i)=45 or pact(i)=72 or pact(i)=75 or pact(i)=82 or pact(i)=85 or pact(i)=92 or pact(i)=95 or pact(i)=99. compute main(i)=68. Else if pact(i)=-1. compute main(i)=69. Else. compute residual=pact(i). End if. End loop. freq residual. *test that main codes map as desired to the original codes. temp. select if main90=1. freq pact90. temp. select if main15=2. freq pact15. temp. select if main15=3. freq pact15. temp. select if main25=4. freq pact25. temp. select if main25=6. freq pact25 lact25. temp. select if main45=7. freq pact45 lact45. temp. select if main45=8. freq pact45 lact45. temp. select if main45=15. freq pact45 lact45. temp. select if main85=16. freq pact85 lact85. temp. select if main45=17. freq pact45 lact45. temp. select if main85=18. freq pact85. temp. select if main35=20. freq pact35. temp. select if main35=21. freq pact35. temp. select if main45=22. freq pact45. temp. select if main45=24. freq pact45. temp. select if main45=27. freq pact45 mtrav45. temp. select if main45=28. freq pact45. temp. select if main45=32. freq pact45. temp. select if main45=33. freq pact45. temp. select if main45=34. freq pact45. temp. select if main90=37. freq pact90. temp. select if main90=39. freq pact90 lact90. temp. select if main90=41. freq pact90. temp. select if main55=42. freq pact55. temp. select if main55=43. freq pact55. temp. select if main55=44. freq pact55. compute test=0. do repeat a=main1 to main144. if a=47 test=test+1. end repeat. freq test. *attempt to code walk dog did not work. temp. select if main90=48. freq pact90. temp. select if main90=49. freq pact90. temp. select if main65=51. freq pact65. temp. select if main65=54. freq pact65. temp. select if main65=55. freq pact65. temp. select if main65=56. freq pact65. temp. select if main65=59. freq pact65. temp. select if main90=61. freq pact90 ict90. temp. select if main65=63. freq pact65. temp. select if main69=66. freq pact69. temp. select if main35=67. freq pact35. temp. select if main75=68. freq pact75. temp. select if main90=69. freq pact90. *make secondary activity variables. vector sec=sec1 to sec144 /sact=sact1 to sact144 /lact=lact1 to lact144 /mtrav=mtrav1 to mtrav144 /ict=ict1 to ict144 /main=main1 to main144. Loop i=1 to 144. Do if sact(i)=-9. compute sec(i)=1. Else if sact(i)=1. compute sec(i)=2. Else if sact(i)=-10. compute sec(i)=3. Else if sact(i)=3. compute sec(i)=4. Else if sact(i)=4 and lact(i)=2. compute sec(i)=39. Else if sact(i)=4 and (lact(i)=1 or lact(i)=-1). compute sec(i)=6. Else if sact(i)=11 and lact(i)~=1. compute sec(i)=7. Else if sact(i)=11 and lact(i)=1. compute sec(i)=8. Else if sact(i)=12 and lact(i)~=1. compute sec(i)=15. Else if (sact(i)=12 or sact(i)=13) and lact(i)=1. compute sec(i)=16. Else if sact(i)=13 and lact(i)~=1. compute sec(i)=17. Else if sact(i)=5. compute sec(i)=18. Else if sact(i)=6. compute sec(i)=20. Else if sact(i)=7. compute sec(i)=21. Else if sact(i)=8. compute sec(i)=22. Else if sact(i)=19. compute sec(i)=24. Else if sact(i)=9 and mtrav(i)~=3. compute sec(i)=27. Else if sact(i)=9 and mtrav(i)=3. compute sec(i)=47. Else if sact(i)=15 or sact(i)=16. compute sec(i)=28. Else if sact(i)=17 or sact(i)=18. compute sec(i)=32. Else if sact(i)=14. compute sec(i)=33. Else if sact(i)=27. compute sec(i)=34. Else if sact(i)=26. compute sec(i)=37. Else if sact(i)=-8. compute sec(i)=41. Else if sact(i)=22. compute sec(i)=42. Else if sact(i)=52 or sact(i)=55. compute sec(i)=43. Else if sact(i)=62 or sact(i)=65. compute sec(i)=44. Else if sact(i)=23 or sact(i)=24. compute sec(i)=48. Else if sact(i)=25. compute sec(i)=49. Else if sact(i)=30 and ict(i)=0. compute sec(i)=51. Else if sact(i)=28. compute sec(i)=54. Else if sact(i)=2. compute sec(i)=55. Else if sact(i)=21. compute sec(i)=56. Else if sact(i)=20. compute sec(i)=59. Else if sact(i)=29 or ((sact(i)=30 and ict(i)=1) and main(i)~=61). compute sec(i)=61. Else if sact(i)=43 or sact(i)=53 or sact(i)=63 or sact(i)=73 or sact(i)=83 or sact(i)=93. compute sec(i)=63. Else if sact(i)=41 or sact(i)=51 or sact(i)=61 or sact(i)=71 or sact(i)=81 or sact(i)=91. compute sec(i)=66. Else if sact(i)=44 or sact(i)=54 or sact(i)=64 or sact(i)=74 or sact(i)=84 or sact(i)=94. compute sec(i)=67. Else if sact(i)=42 or sact(i)=45 or sact(i)=72 or sact(i)=75 or sact(i)=82 or sact(i)=85 or sact(i)=92 or sact(i)=95 or sact(i)=99. compute sec(i)=68. Else if sact(i)=-1. compute sec(i)=69. Else. compute residual=sact(i). End if. End loop. freq residual. *note that walk the dog, which does not surface in main activity, appears *in secondary activity. temp. select if sec75=47. freq sact75 lact75. *examine the original weight. sort cases hldid persid id. desc Net_wgt. *all cases have a weight, standard deviation 0. compute ocombwt=Net_wgt. weight by ocombwt. freq day. cro day by sex /cell=col. *the original weight does not balance the distribution of days of the week. weight off. freq emp. means age by emp. cro emp by badcase. *only 1 very old person who produced a bad diary is missing *employment status. Emp=1 and Emp<1 used to account for the *one missing employment status case, which will be dropped *anyway when bad cases are accounted. Also note that as the *number of employed older women is high, the top-end of the *female diarists is split by employment status. As there *are few older men or people aged <18, these groups are *not split by employment status. *COMPUTATION OF THE PROPOSED WEIGHT. *account for age group, sex and employment status. if age<18 and sex=1 agesexgp=0. if age>17 and age<26 and sex=1 and emp=1 agesexgp=1. if age>17 and age<26 and sex=1 and emp<1 agesexgp=2. if age>25 and age<40 and sex=1 and emp=1 agesexgp=3. if age>25 and age<40 and sex=1 and emp<1 agesexgp=4. if age>39 and age<60 and sex=1 and emp=1 agesexgp=5. if age>39 and age<60 and sex=1 and emp<1 agesexgp=6. if age>59 and age<71 and sex=1 and emp=1 agesexgp=7. if age>59 and age<71 and sex=1 and emp<1 agesexgp=8. if age>70 and sex=1 agesexgp=9. if age<18 and sex=2 agesexgp=10. if age>17 and age<26 and sex=2 and emp=1 agesexgp=11. if age>17 and age<26 and sex=2 and emp<1 agesexgp=12. if age>25 and age<40 and sex=2 and emp=1 agesexgp=13. if age>25 and age<40 and sex=2 and emp<1 agesexgp=14. if age>39 and age<60 and sex=2 and emp=1 agesexgp=15. if age>39 and age<60 and sex=2 and emp<1 agesexgp=16. if age>59 and age<71 and sex=2 and emp=1 agesexgp=17. if age>59 and age<71 and sex=2 and emp<1 agesexgp=18. if age>70 and sex=2 and emp=1 agesexgp=19. if age>70 and sex=2 and emp<1 agesexgp=20. cro agesexgp by sex emp. *allow for 0-weighting of the bad diary cases. if badcase>0 agesexgp=99. freq agesexgp badcase. compute wt2=ocombwt. if agesexgp=99 wt2=0. sort cases by agesexgp day. aggregate out='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\group.sav' /break=agesexgp /grouptot=sum(wt2)/ groupn=nu. execute. aggregate out='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\day.sav' /break= agesexgp day /daytot=sum(wt2) /dayn=nu. execute. match files file=* table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\group.sav' /by agesexgp. execute. match files file=* table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\day.sav' /by agesexgp day. execute. compute exptot=(grouptot/7). compute propwt=0. if daytot>0 propwt=(exptot/daytot)/(dayn/daytot). weight off. desc propwt ocombwt. *inflate the propwt to the number of diaries from the survey. *multiply the product of the number of diaries divided by the *current sum of propwt. compute propwt=propwt*(4941/4825.61). AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=countrya /wtsum1 = SUM(ocombwt) /wtsum = SUM(propwt). freq wtsum wtsum1. desc propwt ocombwt. weight by propwt. cro day by sex /cel=col. freq agesexgp day. weight off. *************************** *construct the MTUS files * ***************************. val lab incorig -9 could not be created. *label of -99 = missing manually added on variable view screen for empinclm. freq aglftsch region ethnic animal empinclm incorig. sort cases by hldid persid id. *make supplementary file for the UK. AGGREGATE /OUTFILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\MTUS-UK2005extravar.sav' /BREAK=survey hldid persid id /sexd 'sex - duplicate in supplement file' = MAX(sex) /aged 'age - duplicate in supplement file' = MAX(age) /incolab 'original household income labelled' = MAX(incorig) /educalab 'original education labelled' = MAX(educa) /empinlab 'income from employment labelled' = MAX(empinclm) /aglftsch 'age left formal schooling' = MAX(aglftsch) /ethnic 'ethnicity' = MAX(ethnic) /region 'countrya / English region' = MAX(region) /animal 'average minutes spent with animals per diary from respondent' = MEAN(animal). *create AV variables for W53 and W58 versions. As the time *slots cover 10 minute intervals, add 10 minutes each time *each AV code appears. vector avx(41). Loop i=1 to 41. compute avx(i)=0. End loop. do repeat a=av1 to av144. If a=1 avx1= avx1+10. If a=2 avx2= avx2+10. If a=3 avx3= avx3+10. If a=4 avx4= avx4+10. If a=5 avx5= avx5+10. If a=6 avx6= avx6+10. If a=7 avx7= avx7+10. If a=8 avx8= avx8+10. If a=9 avx9= avx9+10. If a=10 avx10=avx10+10. If a=11 avx11=avx11+10. If a=12 avx12=avx12+10. If a=13 avx13=avx13+10. If a=14 avx14=avx14+10. If a=15 avx15=avx15+10. If a=16 avx16=avx16+10. If a=17 avx17=avx17+10. If a=18 avx18=avx18+10. If a=19 avx19=avx19+10. If a=20 avx20=avx20+10. If a=21 avx21=avx21+10. If a=22 avx22=avx22+10. If a=23 avx23=avx23+10. If a=24 avx24=avx24+10. If a=25 avx25=avx25+10. If a=26 avx26=avx26+10. If a=27 avx27=avx27+10. If a=28 avx28=avx28+10. If a=29 avx29=avx29+10. If a=30 avx30=avx30+10. If a=31 avx31=avx31+10. If a=32 avx32=avx32+10. If a=33 avx33=avx33+10. If a=34 avx34=avx34+10. If a=35 avx35=avx35+10. If a=36 avx36=avx36+10. If a=37 avx37=avx37+10. If a=38 avx38=avx38+10. If a=39 avx39=avx39+10. If a=40 avx40=avx40+10. If a=41 avx41=avx41+10. end repeat. compute tottime=sum(avx1 to avx41). freq tottime. *sums to 1440, so all well. *create variables for version 5.8. compute sppart=-9. vector mainx(69). Loop i=1 to 69. compute mainx(i)=0. End loop. do repeat a=main1 to main144. if a=1 mainx1 =mainx1 +10. if a=2 mainx2 =mainx2 +10. if a=3 mainx3 =mainx3 +10. if a=4 mainx4 =mainx4 +10. if a=5 mainx5 =mainx5 +10. if a=6 mainx6 =mainx6 +10. if a=7 mainx7 =mainx7 +10. if a=8 mainx8 =mainx8 +10. if a=9 mainx9 =mainx9 +10. if a=10 mainx10=mainx10+10. if a=11 mainx11=mainx11+10. if a=12 mainx12=mainx12+10. if a=13 mainx13=mainx13+10. if a=14 mainx14=mainx14+10. if a=15 mainx15=mainx15+10. if a=16 mainx16=mainx16+10. if a=17 mainx17=mainx17+10. if a=18 mainx18=mainx18+10. if a=19 mainx19=mainx19+10. if a=20 mainx20=mainx20+10. if a=21 mainx21=mainx21+10. if a=22 mainx22=mainx22+10. if a=23 mainx23=mainx23+10. if a=24 mainx24=mainx24+10. if a=25 mainx25=mainx25+10. if a=26 mainx26=mainx26+10. if a=27 mainx27=mainx27+10. if a=28 mainx28=mainx28+10. if a=29 mainx29=mainx29+10. if a=30 mainx30=mainx30+10. if a=31 mainx31=mainx31+10. if a=32 mainx32=mainx32+10. if a=33 mainx33=mainx33+10. if a=34 mainx34=mainx34+10. if a=35 mainx35=mainx35+10. if a=36 mainx36=mainx36+10. if a=37 mainx37=mainx37+10. if a=38 mainx38=mainx38+10. if a=39 mainx39=mainx39+10. if a=40 mainx40=mainx40+10. if a=41 mainx41=mainx41+10. if a=42 mainx42=mainx42+10. if a=43 mainx43=mainx43+10. if a=44 mainx44=mainx44+10. if a=45 mainx45=mainx45+10. if a=46 mainx46=mainx46+10. if a=47 mainx47=mainx47+10. if a=48 mainx48=mainx48+10. if a=49 mainx49=mainx49+10. if a=50 mainx50=mainx50+10. if a=51 mainx51=mainx51+10. if a=52 mainx52=mainx52+10. if a=53 mainx53=mainx53+10. if a=54 mainx54=mainx54+10. if a=55 mainx55=mainx55+10. if a=56 mainx56=mainx56+10. if a=57 mainx57=mainx57+10. if a=58 mainx58=mainx58+10. if a=59 mainx59=mainx59+10. if a=60 mainx60=mainx60+10. if a=61 mainx61=mainx61+10. if a=62 mainx62=mainx62+10. if a=63 mainx63=mainx63+10. if a=64 mainx64=mainx64+10. if a=65 mainx65=mainx65+10. if a=66 mainx66=mainx66+10. if a=67 mainx67=mainx67+10. if a=68 mainx68=mainx68+10. if a=69 mainx69=mainx69+10. end repeat. freq sppart. compute tot2=sum (mainx1 to mainx69). freq tot2. *happy news, these all total 1440 as well. sort cases by survey hldid persid id. save outfile ='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w53.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab avx1 avx2 avx3 avx4 avx5 avx6 avx7 avx8 avx9 avx10 avx11 avx12 avx13 avx14 avx15 avx16 avx17 avx18 avx19 avx20 avx21 avx22 avx23 avx24 avx25 avx26 avx27 avx28 avx29 avx30 avx31 avx32 avx33 avx34 avx35 avx36 avx37 avx38 avx39 avx40 avx41 ocombwt propwt. save outfile ='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w58.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab mainx1 mainx2 mainx3 mainx4 mainx5 mainx6 mainx7 mainx8 mainx9 mainx10 mainx11 mainx12 mainx13 mainx14 mainx15 mainx16 mainx17 mainx18 mainx19 mainx20 mainx21 mainx22 mainx23 mainx24 mainx25 mainx26 mainx27 mainx28 mainx29 mainx30 mainx31 mainx32 mainx33 mainx34 mainx35 mainx36 mainx37 mainx38 mainx39 mainx40 mainx41 mainx42 mainx43 mainx44 mainx45 mainx46 mainx47 mainx48 mainx49 mainx50 mainx51 mainx52 mainx53 mainx54 mainx55 mainx56 mainx57 mainx58 mainx59 mainx60 mainx61 mainx62 mainx63 mainx64 mainx65 mainx66 mainx67 mainx68 mainx69 avx1 avx2 avx3 avx4 avx5 avx6 avx7 avx8 avx9 avx10 avx11 avx12 avx13 avx14 avx15 avx16 avx17 avx18 avx19 avx20 avx21 avx22 avx23 avx24 avx25 avx26 avx27 avx28 avx29 avx30 avx31 avx32 avx33 avx34 avx35 avx36 avx37 avx38 avx39 avx40 avx41 sppart ocombwt propwt. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005.sav' /keep=countrya survey swave msamp hldid persid id day month year diary badcase sex age propwt 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 main70 main71 main72 main73 main74 main75 main76 main77 main78 main79 main80 main81 main82 main83 main84 main85 main86 main87 main88 main89 main90 main91 main92 main93 main94 main95 main96 main97 main98 main99 main100 main101 main102 main103 main104 main105 main106 main107 main108 main109 main110 main111 main112 main113 main114 main115 main116 main117 main118 main119 main120 main121 main122 main123 main124 main125 main126 main127 main128 main129 main130 main131 main132 main133 main134 main135 main136 main137 main138 main139 main140 main141 main142 main143 main144 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 av42 av43 av44 av45 av46 av47 av48 av49 av50 av51 av52 av53 av54 av55 av56 av57 av58 av59 av60 av61 av62 av63 av64 av65 av66 av67 av68 av69 av70 av71 av72 av73 av74 av75 av76 av77 av78 av79 av80 av81 av82 av83 av84 av85 av86 av87 av88 av89 av90 av91 av92 av93 av94 av95 av96 av97 av98 av99 av100 av101 av102 av103 av104 av105 av106 av107 av108 av109 av110 av111 av112 av113 av114 av115 av116 av117 av118 av119 av120 av121 av122 av123 av124 av125 av126 av127 av128 av129 av130 av131 av132 av133 av134 av135 av136 av137 av138 av139 av140 av141 av142 av143 av144 sec1 sec2 sec3 sec4 sec5 sec6 sec7 sec8 sec9 sec10 sec11 sec12 sec13 sec14 sec15 sec16 sec17 sec18 sec19 sec20 sec21 sec22 sec23 sec24 sec25 sec26 sec27 sec28 sec29 sec30 sec31 sec32 sec33 sec34 sec35 sec36 sec37 sec38 sec39 sec40 sec41 sec42 sec43 sec44 sec45 sec46 sec47 sec48 sec49 sec50 sec51 sec52 sec53 sec54 sec55 sec56 sec57 sec58 sec59 sec60 sec61 sec62 sec63 sec64 sec65 sec66 sec67 sec68 sec69 sec70 sec71 sec72 sec73 sec74 sec75 sec76 sec77 sec78 sec79 sec80 sec81 sec82 sec83 sec84 sec85 sec86 sec87 sec88 sec89 sec90 sec91 sec92 sec93 sec94 sec95 sec96 sec97 sec98 sec99 sec100 sec101 sec102 sec103 sec104 sec105 sec106 sec107 sec108 sec109 sec110 sec111 sec112 sec113 sec114 sec115 sec116 sec117 sec118 sec119 sec120 sec121 sec122 sec123 sec124 sec125 sec126 sec127 sec128 sec129 sec130 sec131 sec132 sec133 sec134 sec135 sec136 sec137 sec138 sec139 sec140 sec141 sec142 sec143 sec144 eloc1 eloc2 eloc3 eloc4 eloc5 eloc6 eloc7 eloc8 eloc9 eloc10 eloc11 eloc12 eloc13 eloc14 eloc15 eloc16 eloc17 eloc18 eloc19 eloc20 eloc21 eloc22 eloc23 eloc24 eloc25 eloc26 eloc27 eloc28 eloc29 eloc30 eloc31 eloc32 eloc33 eloc34 eloc35 eloc36 eloc37 eloc38 eloc39 eloc40 eloc41 eloc42 eloc43 eloc44 eloc45 eloc46 eloc47 eloc48 eloc49 eloc50 eloc51 eloc52 eloc53 eloc54 eloc55 eloc56 eloc57 eloc58 eloc59 eloc60 eloc61 eloc62 eloc63 eloc64 eloc65 eloc66 eloc67 eloc68 eloc69 eloc70 eloc71 eloc72 eloc73 eloc74 eloc75 eloc76 eloc77 eloc78 eloc79 eloc80 eloc81 eloc82 eloc83 eloc84 eloc85 eloc86 eloc87 eloc88 eloc89 eloc90 eloc91 eloc92 eloc93 eloc94 eloc95 eloc96 eloc97 eloc98 eloc99 eloc100 eloc101 eloc102 eloc103 eloc104 eloc105 eloc106 eloc107 eloc108 eloc109 eloc110 eloc111 eloc112 eloc113 eloc114 eloc115 eloc116 eloc117 eloc118 eloc119 eloc120 eloc121 eloc122 eloc123 eloc124 eloc125 eloc126 eloc127 eloc128 eloc129 eloc130 eloc131 eloc132 eloc133 eloc134 eloc135 eloc136 eloc137 eloc138 eloc139 eloc140 eloc141 eloc142 eloc143 eloc144 ict1 ict2 ict3 ict4 ict5 ict6 ict7 ict8 ict9 ict10 ict11 ict12 ict13 ict14 ict15 ict16 ict17 ict18 ict19 ict20 ict21 ict22 ict23 ict24 ict25 ict26 ict27 ict28 ict29 ict30 ict31 ict32 ict33 ict34 ict35 ict36 ict37 ict38 ict39 ict40 ict41 ict42 ict43 ict44 ict45 ict46 ict47 ict48 ict49 ict50 ict51 ict52 ict53 ict54 ict55 ict56 ict57 ict58 ict59 ict60 ict61 ict62 ict63 ict64 ict65 ict66 ict67 ict68 ict69 ict70 ict71 ict72 ict73 ict74 ict75 ict76 ict77 ict78 ict79 ict80 ict81 ict82 ict83 ict84 ict85 ict86 ict87 ict88 ict89 ict90 ict91 ict92 ict93 ict94 ict95 ict96 ict97 ict98 ict99 ict100 ict101 ict102 ict103 ict104 ict105 ict106 ict107 ict108 ict109 ict110 ict111 ict112 ict113 ict114 ict115 ict116 ict117 ict118 ict119 ict120 ict121 ict122 ict123 ict124 ict125 ict126 ict127 ict128 ict129 ict130 ict131 ict132 ict133 ict134 ict135 ict136 ict137 ict138 ict139 ict140 ict141 ict142 ict143 ict144 mtrav1 mtrav2 mtrav3 mtrav4 mtrav5 mtrav6 mtrav7 mtrav8 mtrav9 mtrav10 mtrav11 mtrav12 mtrav13 mtrav14 mtrav15 mtrav16 mtrav17 mtrav18 mtrav19 mtrav20 mtrav21 mtrav22 mtrav23 mtrav24 mtrav25 mtrav26 mtrav27 mtrav28 mtrav29 mtrav30 mtrav31 mtrav32 mtrav33 mtrav34 mtrav35 mtrav36 mtrav37 mtrav38 mtrav39 mtrav40 mtrav41 mtrav42 mtrav43 mtrav44 mtrav45 mtrav46 mtrav47 mtrav48 mtrav49 mtrav50 mtrav51 mtrav52 mtrav53 mtrav54 mtrav55 mtrav56 mtrav57 mtrav58 mtrav59 mtrav60 mtrav61 mtrav62 mtrav63 mtrav64 mtrav65 mtrav66 mtrav67 mtrav68 mtrav69 mtrav70 mtrav71 mtrav72 mtrav73 mtrav74 mtrav75 mtrav76 mtrav77 mtrav78 mtrav79 mtrav80 mtrav81 mtrav82 mtrav83 mtrav84 mtrav85 mtrav86 mtrav87 mtrav88 mtrav89 mtrav90 mtrav91 mtrav92 mtrav93 mtrav94 mtrav95 mtrav96 mtrav97 mtrav98 mtrav99 mtrav100 mtrav101 mtrav102 mtrav103 mtrav104 mtrav105 mtrav106 mtrav107 mtrav108 mtrav109 mtrav110 mtrav111 mtrav112 mtrav113 mtrav114 mtrav115 mtrav116 mtrav117 mtrav118 mtrav119 mtrav120 mtrav121 mtrav122 mtrav123 mtrav124 mtrav125 mtrav126 mtrav127 mtrav128 mtrav129 mtrav130 mtrav131 mtrav132 mtrav133 mtrav134 mtrav135 mtrav136 mtrav137 mtrav138 mtrav139 mtrav140 mtrav141 mtrav142 mtrav143 mtrav144. *final tidy extra UK variables. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\MTUS-UK2005extravar.sav'. var lab hldid 'Household identifier'. val lab hldid 0 '1 person sampled per household'. var lab persid 'Person/diarist identifier'. var lab id 'Diary identifier'. val lab sexd 1 Man 2 Woman -8 missing. val lab aged 80 80 or older -7 not asked -8 missing. freq survey hldid sexd aged incolab educalab empinlab aglftsch ethnic region. desc persid id animal. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\MTUS-UK2005extravar.sav'. SAVE TRANSLATE OUTFILE='C:\Users\Kimberly Fisher\Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\MTUS-UK2005extravar.csv' /TYPE=CSV /MAP /REPLACE /FIELDNAMES /CELLS=VALUES. SAVE TRANSLATE OUTFILE='C:\Users\Kimberly Fisher\Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\MTUS-UK2005extravar.dta' /TYPE=STATA /VERSION=8 /EDITION=INTERCOOLED /MAP /REPLACE. *final tidy of version 5.3. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w53.sav'. rename variables (avx1 avx2 avx3 avx4 avx5 avx6 avx7 avx8 avx9 avx10 avx11 avx12 avx13 avx14 avx15 avx16 avx17 avx18 avx19 avx20 avx21 avx22 avx23 avx24 avx25 avx26 avx27 avx28 avx29 avx30 avx31 avx32 avx33 avx34 avx35 avx36 avx37 avx38 avx39 avx40 avx41 = 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). apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\MTUS database\schema&etc\MTUShafschema.sav'. *recode time use variables that could not be created to -9. recode av3 av9 av14 av18 av20 av25 av26 av27 av30 av32 av34 av39 (0=-9). desc hldid persid id incorig age workhrs empinclm 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 ocombwt propwt. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=countrya /wtsum = SUM(propwt). freq wtsum. freq countrya survey swave msamp hldid parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs occup sector educa edcat rushed health carer disab. cro empsp by civstat. means age hhldsize nchild by famstat /cells min max. means age hhldsize by nchild retired /cells min max median. cro famstat by nchild civstat hhtype agekidx cphome. cro agekidx by nchild. cro empstat by emp unemp retired student disab. cro empsp by civstat relrefp partid. cro civstat by hhtype relrefp partid cohab cphome. *note no relrefp=2 should appear if civstat=2. cro hhtype by hhldsize. cro parntid1 by parntid2. weight by propwt. freq day. cro day by sex /cells= count column. weight off. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w53.sav' /drop wtsum. *final tidy of version 5.8. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w58.sav'. rename variables (mainx1 mainx2 mainx3 mainx4 mainx5 mainx6 mainx7 mainx8 mainx9 mainx10 mainx11 mainx12 mainx13 mainx14 mainx15 mainx16 mainx17 mainx18 mainx19 mainx20 mainx21 mainx22 mainx23 mainx24 mainx25 mainx26 mainx27 mainx28 mainx29 mainx30 mainx31 mainx32 mainx33 mainx34 mainx35 mainx36 mainx37 mainx38 mainx39 mainx40 mainx41 mainx42 mainx43 mainx44 mainx45 mainx46 mainx47 mainx48 mainx49 mainx50 mainx51 mainx52 mainx53 mainx54 mainx55 mainx56 mainx57 mainx58 mainx59 mainx60 mainx61 mainx62 mainx63 mainx64 mainx65 mainx66 mainx67 mainx68 mainx69 avx1 avx2 avx3 avx4 avx5 avx6 avx7 avx8 avx9 avx10 avx11 avx12 avx13 avx14 avx15 avx16 avx17 avx18 avx19 avx20 avx21 avx22 avx23 avx24 avx25 avx26 avx27 avx28 avx29 avx30 avx31 avx32 avx33 avx34 avx35 avx36 avx37 avx38 avx39 avx40 avx41 = 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). apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\MTUS database\schema&etc\MTUSW58schema.sav'. *recode time use variables that could not be created to -9. recode av3 av9 av14 av18 av20 av25 av26 av27 av30 av32 av34 av39 main5 main9 main10 main11 main12 main13 main14 main19 main23 main25 main26 main29 main30 main31 main35 main36 main38 main40 main45 main46 main50 main52 main53 main57 main58 main60 main62 main64 main65 (0=-9). desc main1 to main69 sppart. *check all variables have variable and value labels. Quality of other variables *already checked in the review of the W53 version. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w58kid.sav'. select if age>17. freq age badcase. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w58.sav'. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w58kid.sav'. select if age<18. freq age badcase. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w58kid.sav'. *create version 6.0 sequence files. At the moment each row in the file represents *1 diary, need to be convert to a file where each row represents one episode. GET FILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005.sav'. compute maxep=1. vector main=main1 to main144/ sec=sec1 to sec144 / eloc=eloc1 to eloc144. loop i=1 to 143. compute j=i+1. if main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j) maxep=maxep+1. end loop. freq maxep. *1 diary includes 66 episodes. vector m(66) /old(66) /s(66) /e(66) /tech(66) /trav(66) /time(66) /clock(66) /start(66) /end(66). *set all new variables with a default value of 0. do repeat a=m1 to m66 / b=old1 to old66 / c=s1 to s66 / d=e1 to e66 /e=tech1 to tech66 /f=trav1 to trav66 /g=time1 to time66 /h=clock1 to clock66 /i=start1 to start66 /j=end1 to end66. compute a=0. compute b=0. compute c=0. compute d=0. compute e=0. compute f=0. compute g=0. compute h=0. compute i=0. compute j=0. end repeat. *fill in first time slot values. compute m1=main1. compute old1=av1. compute s1=sec1. compute e1=eloc1. compute tech1=ict1. compute trav1=mtrav1. compute time1=10. compute clock1=4. compute start1=0. freq m1 old1 s1 e1 tech1 trav1 time1 clock1 start1 end1. *to not completely overload SPSS, do the filling in in two batches. 98.3% of *diaries have 35 or fewer episodes. Do up to 35 episodes for these diaries, *then up to 66 episodes for the remaining 1.7%. Do if maxep<36. vector main=main1 to main144 /av=av1 to av144 / sec=sec1 to sec144 /eloc=eloc1 to eloc144 / ict=ict1 to ict144 /mtrav=mtrav1 to mtrav144. Loop i=1 to 143. compute j=i+1. Do if m2=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time1=time1+10. Else if m2=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m2=main(j). compute old2=av(j). compute s2=sec(j). compute e2=eloc(j). compute tech2=ict(j). compute trav2=mtrav(j). compute start2=j*10-10. compute time2=10. compute end1=j*10-10. Else if m3=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time2=time2+10. Else if m3=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m3=main(j). compute old3=av(j). compute s3=sec(j). compute e3=eloc(j). compute tech3=ict(j). compute trav3=mtrav(j). compute start3=j*10-10. compute time3=10. compute end2=j*10-10. Else if m4=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time3=time3+10. Else if m4=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m4=main(j). compute old4=av(j). compute s4=sec(j). compute e4=eloc(j). compute tech4=ict(j). compute trav4=mtrav(j). compute start4=j*10-10. compute time4=10. compute end3=j*10-10. Else if m5=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time4=time4+10. Else if m5=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m5=main(j). compute old5=av(j). compute s5=sec(j). compute e5=eloc(j). compute tech5=ict(j). compute trav5=mtrav(j). compute start5=j*10-10. compute time5=10. compute end4=j*10-10. Else if m6=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time5=time5+10. Else if m6=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m6=main(j). compute old6=av(j). compute s6=sec(j). compute e6=eloc(j). compute tech6=ict(j). compute trav6=mtrav(j). compute start6=j*10-10. compute time6=10. compute end5=j*10-10. Else if m7=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time6=time6+10. Else if m7=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m7=main(j). compute old7=av(j). compute s7=sec(j). compute e7=eloc(j). compute tech7=ict(j). compute trav7=mtrav(j). compute start7=j*10-10. compute time7=10. compute end6=j*10-10. Else if m8=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time7=time7+10. Else if m8=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m8=main(j). compute old8=av(j). compute s8=sec(j). compute e8=eloc(j). compute tech8=ict(j). compute trav8=mtrav(j). compute start8=j*10-10. compute time8=10. compute end7=j*10-10. Else if m9=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time8=time8+10. Else if m9=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m9=main(j). compute old9=av(j). compute s9=sec(j). compute e9=eloc(j). compute tech9=ict(j). compute trav9=mtrav(j). compute start9=j*10-10. compute time9=10. compute end8=j*10-10. Else if m10=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time9=time9+10. Else if m10=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m10=main(j). compute old10=av(j). compute s10=sec(j). compute e10=eloc(j). compute tech10=ict(j). compute trav10=mtrav(j). compute start10=j*10-10. compute time10=10. compute end9=j*10-10. Else if m11=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time10=time10+10. Else if m11=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m11=main(j). compute old11=av(j). compute s11=sec(j). compute e11=eloc(j). compute tech11=ict(j). compute trav11=mtrav(j). compute start11=j*10-10. compute time11=10. compute end10=j*10-10. Else if m12=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time11=time11+10. Else if m12=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m12=main(j). compute old12=av(j). compute s12=sec(j). compute e12=eloc(j). compute tech12=ict(j). compute trav12=mtrav(j). compute start12=j*10-10. compute time12=10. compute end11=j*10-10. Else if m13=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time12=time12+10. Else if m13=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m13=main(j). compute old13=av(j). compute s13=sec(j). compute e13=eloc(j). compute tech13=ict(j). compute trav13=mtrav(j). compute start13=j*10-10. compute time13=10. compute end12=j*10-10. Else if m14=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time13=time13+10. Else if m14=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m14=main(j). compute old14=av(j). compute s14=sec(j). compute e14=eloc(j). compute tech14=ict(j). compute trav14=mtrav(j). compute start14=j*10-10. compute time14=10. compute end13=j*10-10. Else if m15=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time14=time14+10. Else if m15=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m15=main(j). compute old15=av(j). compute s15=sec(j). compute e15=eloc(j). compute tech15=ict(j). compute trav15=mtrav(j). compute start15=j*10-10. compute time15=10. compute end14=j*10-10. Else if m16=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time15=time15+10. Else if m16=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m16=main(j). compute old16=av(j). compute s16=sec(j). compute e16=eloc(j). compute tech16=ict(j). compute trav16=mtrav(j). compute start16=j*10-10. compute time16=10. compute end15=j*10-10. Else if m17=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time16=time16+10. Else if m17=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m17=main(j). compute old17=av(j). compute s17=sec(j). compute e17=eloc(j). compute tech17=ict(j). compute trav17=mtrav(j). compute start17=j*10-10. compute time17=10. compute end16=j*10-10. Else if m18=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time17=time17+10. Else if m18=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m18=main(j). compute old18=av(j). compute s18=sec(j). compute e18=eloc(j). compute tech18=ict(j). compute trav18=mtrav(j). compute start18=j*10-10. compute time18=10. compute end17=j*10-10. Else if m19=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time18=time18+10. Else if m19=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m19=main(j). compute old19=av(j). compute s19=sec(j). compute e19=eloc(j). compute tech19=ict(j). compute trav19=mtrav(j). compute start19=j*10-10. compute time19=10. compute end18=j*10-10. Else if m20=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time19=time19+10. Else if m20=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m20=main(j). compute old20=av(j). compute s20=sec(j). compute e20=eloc(j). compute tech20=ict(j). compute trav20=mtrav(j). compute start20=j*10-10. compute time20=10. compute end19=j*10-10. Else if m21=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time20=time20+10. Else if m21=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m21=main(j). compute old21=av(j). compute s21=sec(j). compute e21=eloc(j). compute tech21=ict(j). compute trav21=mtrav(j). compute start21=j*10-10. compute time21=10. compute end20=j*10-10. Else if m22=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time21=time21+10. Else if m22=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m22=main(j). compute old22=av(j). compute s22=sec(j). compute e22=eloc(j). compute tech22=ict(j). compute trav22=mtrav(j). compute start22=j*10-10. compute time22=10. compute end21=j*10-10. Else if m23=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time22=time22+10. Else if m23=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m23=main(j). compute old23=av(j). compute s23=sec(j). compute e23=eloc(j). compute tech23=ict(j). compute trav23=mtrav(j). compute start23=j*10-10. compute time23=10. compute end22=j*10-10. Else if m24=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time23=time23+10. Else if m24=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m24=main(j). compute old24=av(j). compute s24=sec(j). compute e24=eloc(j). compute tech24=ict(j). compute trav24=mtrav(j). compute start24=j*10-10. compute time24=10. compute end23=j*10-10. Else if m25=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time24=time24+10. Else if m25=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m25=main(j). compute old25=av(j). compute s25=sec(j). compute e25=eloc(j). compute tech25=ict(j). compute trav25=mtrav(j). compute start25=j*10-10. compute time25=10. compute end24=j*10-10. Else if m26=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time25=time25+10. Else if m26=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m26=main(j). compute old26=av(j). compute s26=sec(j). compute e26=eloc(j). compute tech26=ict(j). compute trav26=mtrav(j). compute start26=j*10-10. compute time26=10. compute end25=j*10-10. Else if m27=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time26=time26+10. Else if m27=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m27=main(j). compute old27=av(j). compute s27=sec(j). compute e27=eloc(j). compute tech27=ict(j). compute trav27=mtrav(j). compute start27=j*10-10. compute time27=10. compute end26=j*10-10. Else if m28=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time27=time27+10. Else if m28=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m28=main(j). compute old28=av(j). compute s28=sec(j). compute e28=eloc(j). compute tech28=ict(j). compute trav28=mtrav(j). compute start28=j*10-10. compute time28=10. compute end27=j*10-10. Else if m29=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time28=time28+10. Else if m29=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m29=main(j). compute old29=av(j). compute s29=sec(j). compute e29=eloc(j). compute tech29=ict(j). compute trav29=mtrav(j). compute start29=j*10-10. compute time29=10. compute end28=j*10-10. Else if m30=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time29=time29+10. Else if m30=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m30=main(j). compute old30=av(j). compute s30=sec(j). compute e30=eloc(j). compute tech30=ict(j). compute trav30=mtrav(j). compute start30=j*10-10. compute time30=10. compute end29=j*10-10. Else if m31=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time30=time30+10. Else if m31=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m31=main(j). compute old31=av(j). compute s31=sec(j). compute e31=eloc(j). compute tech31=ict(j). compute trav31=mtrav(j). compute start31=j*10-10. compute time31=10. compute end30=j*10-10. Else if m32=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time31=time31+10. Else if m32=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m32=main(j). compute old32=av(j). compute s32=sec(j). compute e32=eloc(j). compute tech32=ict(j). compute trav32=mtrav(j). compute start32=j*10-10. compute time32=10. compute end31=j*10-10. Else if m33=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time32=time32+10. Else if m33=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m33=main(j). compute old33=av(j). compute s33=sec(j). compute e33=eloc(j). compute tech33=ict(j). compute trav33=mtrav(j). compute start33=j*10-10. compute time33=10. compute end32=j*10-10. Else if m34=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time33=time33+10. Else if m34=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m34=main(j). compute old34=av(j). compute s34=sec(j). compute e34=eloc(j). compute tech34=ict(j). compute trav34=mtrav(j). compute start34=j*10-10. compute time34=10. compute end33=j*10-10. Else if m35=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time34=time34+10. Else if m35=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m35=main(j). compute old35=av(j). compute s35=sec(j). compute e35=eloc(j). compute tech35=ict(j). compute trav35=mtrav(j). compute start35=j*10-10. compute time35=10. compute end34=j*10-10. Else if m35>0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time35=time35+10. End if. end loop. if maxep=1 end1=1440. if maxep=2 end2=1440. if maxep=3 end3=1440. if maxep=4 end4=1440. if maxep=5 end5=1440. if maxep=6 end6=1440. if maxep=7 end7=1440. if maxep=8 end8=1440. if maxep=9 end9=1440. if maxep=10 end10=1440. if maxep=11 end11=1440. if maxep=12 end12=1440. if maxep=13 end13=1440. if maxep=14 end14=1440. if maxep=15 end15=1440. if maxep=16 end16=1440. if maxep=17 end17=1440. if maxep=18 end18=1440. if maxep=19 end19=1440. if maxep=20 end20=1440. if maxep=21 end21=1440. if maxep=22 end22=1440. if maxep=23 end23=1440. if maxep=24 end24=1440. if maxep=25 end25=1440. if maxep=26 end26=1440. if maxep=27 end27=1440. if maxep=28 end28=1440. if maxep=29 end29=1440. if maxep=30 end30=1440. if maxep=31 end31=1440. if maxep=32 end32=1440. if maxep=33 end33=1440. if maxep=34 end34=1440. if maxep=35 end35=1440. End if. freq start1 start35 start36 m1 m35 m36 old1 old35 old36 s1 s35 s36 e1 e35 e36 tech1 tech35 tech36 trav1 trav35 trav36. desc time1 time34 time35 time36. freq end1 end2 end3 end4 end5 end6 end7 end8 end9 end10 end11 end12 end35 end36. *if all working right, the number of cases with maxep values should equal *the number of end cases at 1440 *# episodes #cases * 2 1 * 3 1 * 5 3 * 6 10 * 7 14 * 8 37 * 9 59 * 10 91 * 11 124 * 12 173 * 35 25. *repeat the exercise for the <1.7% of cases with more than 35 episodes. Do if maxep>35. vector main=main1 to main144 /av=av1 to av144 / sec=sec1 to sec144 /eloc=eloc1 to eloc144 / ict=ict1 to ict144 /mtrav=mtrav1 to mtrav144. Loop i=1 to 143. compute j=i+1. Do if m2=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time1=time1+10. Else if m2=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m2=main(j). compute old2=av(j). compute s2=sec(j). compute e2=eloc(j). compute tech2=ict(j). compute trav2=mtrav(j). compute start2=j*10-10. compute time2=10. compute end1=j*10-10. Else if m3=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time2=time2+10. Else if m3=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m3=main(j). compute old3=av(j). compute s3=sec(j). compute e3=eloc(j). compute tech3=ict(j). compute trav3=mtrav(j). compute start3=j*10-10. compute time3=10. compute end2=j*10-10. Else if m4=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time3=time3+10. Else if m4=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m4=main(j). compute old4=av(j). compute s4=sec(j). compute e4=eloc(j). compute tech4=ict(j). compute trav4=mtrav(j). compute start4=j*10-10. compute time4=10. compute end3=j*10-10. Else if m5=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time4=time4+10. Else if m5=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m5=main(j). compute old5=av(j). compute s5=sec(j). compute e5=eloc(j). compute tech5=ict(j). compute trav5=mtrav(j). compute start5=j*10-10. compute time5=10. compute end4=j*10-10. Else if m6=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time5=time5+10. Else if m6=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m6=main(j). compute old6=av(j). compute s6=sec(j). compute e6=eloc(j). compute tech6=ict(j). compute trav6=mtrav(j). compute start6=j*10-10. compute time6=10. compute end5=j*10-10. Else if m7=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time6=time6+10. Else if m7=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m7=main(j). compute old7=av(j). compute s7=sec(j). compute e7=eloc(j). compute tech7=ict(j). compute trav7=mtrav(j). compute start7=j*10-10. compute time7=10. compute end6=j*10-10. Else if m8=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time7=time7+10. Else if m8=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m8=main(j). compute old8=av(j). compute s8=sec(j). compute e8=eloc(j). compute tech8=ict(j). compute trav8=mtrav(j). compute start8=j*10-10. compute time8=10. compute end7=j*10-10. Else if m9=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time8=time8+10. Else if m9=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m9=main(j). compute old9=av(j). compute s9=sec(j). compute e9=eloc(j). compute tech9=ict(j). compute trav9=mtrav(j). compute start9=j*10-10. compute time9=10. compute end8=j*10-10. Else if m10=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time9=time9+10. Else if m10=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m10=main(j). compute old10=av(j). compute s10=sec(j). compute e10=eloc(j). compute tech10=ict(j). compute trav10=mtrav(j). compute start10=j*10-10. compute time10=10. compute end9=j*10-10. Else if m11=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time10=time10+10. Else if m11=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m11=main(j). compute old11=av(j). compute s11=sec(j). compute e11=eloc(j). compute tech11=ict(j). compute trav11=mtrav(j). compute start11=j*10-10. compute time11=10. compute end10=j*10-10. Else if m12=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time11=time11+10. Else if m12=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m12=main(j). compute old12=av(j). compute s12=sec(j). compute e12=eloc(j). compute tech12=ict(j). compute trav12=mtrav(j). compute start12=j*10-10. compute time12=10. compute end11=j*10-10. Else if m13=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time12=time12+10. Else if m13=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m13=main(j). compute old13=av(j). compute s13=sec(j). compute e13=eloc(j). compute tech13=ict(j). compute trav13=mtrav(j). compute start13=j*10-10. compute time13=10. compute end12=j*10-10. Else if m14=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time13=time13+10. Else if m14=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m14=main(j). compute old14=av(j). compute s14=sec(j). compute e14=eloc(j). compute tech14=ict(j). compute trav14=mtrav(j). compute start14=j*10-10. compute time14=10. compute end13=j*10-10. Else if m15=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time14=time14+10. Else if m15=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m15=main(j). compute old15=av(j). compute s15=sec(j). compute e15=eloc(j). compute tech15=ict(j). compute trav15=mtrav(j). compute start15=j*10-10. compute time15=10. compute end14=j*10-10. Else if m16=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time15=time15+10. Else if m16=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m16=main(j). compute old16=av(j). compute s16=sec(j). compute e16=eloc(j). compute tech16=ict(j). compute trav16=mtrav(j). compute start16=j*10-10. compute time16=10. compute end15=j*10-10. Else if m17=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time16=time16+10. Else if m17=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m17=main(j). compute old17=av(j). compute s17=sec(j). compute e17=eloc(j). compute tech17=ict(j). compute trav17=mtrav(j). compute start17=j*10-10. compute time17=10. compute end16=j*10-10. Else if m18=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time17=time17+10. Else if m18=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m18=main(j). compute old18=av(j). compute s18=sec(j). compute e18=eloc(j). compute tech18=ict(j). compute trav18=mtrav(j). compute start18=j*10-10. compute time18=10. compute end17=j*10-10. Else if m19=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time18=time18+10. Else if m19=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m19=main(j). compute old19=av(j). compute s19=sec(j). compute e19=eloc(j). compute tech19=ict(j). compute trav19=mtrav(j). compute start19=j*10-10. compute time19=10. compute end18=j*10-10. Else if m20=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time19=time19+10. Else if m20=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m20=main(j). compute old20=av(j). compute s20=sec(j). compute e20=eloc(j). compute tech20=ict(j). compute trav20=mtrav(j). compute start20=j*10-10. compute time20=10. compute end19=j*10-10. Else if m21=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time20=time20+10. Else if m21=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m21=main(j). compute old21=av(j). compute s21=sec(j). compute e21=eloc(j). compute tech21=ict(j). compute trav21=mtrav(j). compute start21=j*10-10. compute time21=10. compute end20=j*10-10. Else if m22=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time21=time21+10. Else if m22=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m22=main(j). compute old22=av(j). compute s22=sec(j). compute e22=eloc(j). compute tech22=ict(j). compute trav22=mtrav(j). compute start22=j*10-10. compute time22=10. compute end21=j*10-10. Else if m23=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time22=time22+10. Else if m23=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m23=main(j). compute old23=av(j). compute s23=sec(j). compute e23=eloc(j). compute tech23=ict(j). compute trav23=mtrav(j). compute start23=j*10-10. compute time23=10. compute end22=j*10-10. Else if m24=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time23=time23+10. Else if m24=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m24=main(j). compute old24=av(j). compute s24=sec(j). compute e24=eloc(j). compute tech24=ict(j). compute trav24=mtrav(j). compute start24=j*10-10. compute time24=10. compute end23=j*10-10. Else if m25=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time24=time24+10. Else if m25=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m25=main(j). compute old25=av(j). compute s25=sec(j). compute e25=eloc(j). compute tech25=ict(j). compute trav25=mtrav(j). compute start25=j*10-10. compute time25=10. compute end24=j*10-10. Else if m26=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time25=time25+10. Else if m26=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m26=main(j). compute old26=av(j). compute s26=sec(j). compute e26=eloc(j). compute tech26=ict(j). compute trav26=mtrav(j). compute start26=j*10-10. compute time26=10. compute end25=j*10-10. Else if m27=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time26=time26+10. Else if m27=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m27=main(j). compute old27=av(j). compute s27=sec(j). compute e27=eloc(j). compute tech27=ict(j). compute trav27=mtrav(j). compute start27=j*10-10. compute time27=10. compute end26=j*10-10. Else if m28=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time27=time27+10. Else if m28=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m28=main(j). compute old28=av(j). compute s28=sec(j). compute e28=eloc(j). compute tech28=ict(j). compute trav28=mtrav(j). compute start28=j*10-10. compute time28=10. compute end27=j*10-10. Else if m29=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time28=time28+10. Else if m29=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m29=main(j). compute old29=av(j). compute s29=sec(j). compute e29=eloc(j). compute tech29=ict(j). compute trav29=mtrav(j). compute start29=j*10-10. compute time29=10. compute end28=j*10-10. Else if m30=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time29=time29+10. Else if m30=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m30=main(j). compute old30=av(j). compute s30=sec(j). compute e30=eloc(j). compute tech30=ict(j). compute trav30=mtrav(j). compute start30=j*10-10. compute time30=10. compute end29=j*10-10. Else if m31=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time30=time30+10. Else if m31=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m31=main(j). compute old31=av(j). compute s31=sec(j). compute e31=eloc(j). compute tech31=ict(j). compute trav31=mtrav(j). compute start31=j*10-10. compute time31=10. compute end30=j*10-10. Else if m32=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time31=time31+10. Else if m32=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m32=main(j). compute old32=av(j). compute s32=sec(j). compute e32=eloc(j). compute tech32=ict(j). compute trav32=mtrav(j). compute start32=j*10-10. compute time32=10. compute end31=j*10-10. Else if m33=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time32=time32+10. Else if m33=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m33=main(j). compute old33=av(j). compute s33=sec(j). compute e33=eloc(j). compute tech33=ict(j). compute trav33=mtrav(j). compute start33=j*10-10. compute time33=10. compute end32=j*10-10. Else if m34=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time33=time33+10. Else if m34=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m34=main(j). compute old34=av(j). compute s34=sec(j). compute e34=eloc(j). compute tech34=ict(j). compute trav34=mtrav(j). compute start34=j*10-10. compute time34=10. compute end33=j*10-10. Else if m35=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time34=time34+10. Else if m35=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m35=main(j). compute old35=av(j). compute s35=sec(j). compute e35=eloc(j). compute tech35=ict(j). compute trav35=mtrav(j). compute start35=j*10-10. compute time35=10. compute end34=j*10-10. Else if m36=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time35=time35+10. Else if m36=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m36=main(j). compute old36=av(j). compute s36=sec(j). compute e36=eloc(j). compute tech36=ict(j). compute trav36=mtrav(j). compute start36=j*10-10. compute time36=10. compute end35=j*10-10. Else if m37=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time36=time36+10. Else if m37=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m37=main(j). compute old37=av(j). compute s37=sec(j). compute e37=eloc(j). compute tech37=ict(j). compute trav37=mtrav(j). compute start37=j*10-10. compute time37=10. compute end36=j*10-10. Else if m38=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time37=time37+10. Else if m38=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m38=main(j). compute old38=av(j). compute s38=sec(j). compute e38=eloc(j). compute tech38=ict(j). compute trav38=mtrav(j). compute start38=j*10-10. compute time38=10. compute end37=j*10-10. Else if m39=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time38=time38+10. Else if m39=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m39=main(j). compute old39=av(j). compute s39=sec(j). compute e39=eloc(j). compute tech39=ict(j). compute trav39=mtrav(j). compute start39=j*10-10. compute time39=10. compute end38=j*10-10. Else if m40=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time39=time39+10. Else if m40=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m40=main(j). compute old40=av(j). compute s40=sec(j). compute e40=eloc(j). compute tech40=ict(j). compute trav40=mtrav(j). compute start40=j*10-10. compute time40=10. compute end39=j*10-10. Else if m41=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time40=time40+10. Else if m41=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m41=main(j). compute old41=av(j). compute s41=sec(j). compute e41=eloc(j). compute tech41=ict(j). compute trav41=mtrav(j). compute start41=j*10-10. compute time41=10. compute end40=j*10-10. Else if m42=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time41=time41+10. Else if m42=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m42=main(j). compute old42=av(j). compute s42=sec(j). compute e42=eloc(j). compute tech42=ict(j). compute trav42=mtrav(j). compute start42=j*10-10. compute time42=10. compute end41=j*10-10. Else if m43=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time42=time42+10. Else if m43=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m43=main(j). compute old43=av(j). compute s43=sec(j). compute e43=eloc(j). compute tech43=ict(j). compute trav43=mtrav(j). compute start43=j*10-10. compute time43=10. compute end42=j*10-10. Else if m44=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time43=time43+10. Else if m44=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m44=main(j). compute old44=av(j). compute s44=sec(j). compute e44=eloc(j). compute tech44=ict(j). compute trav44=mtrav(j). compute start44=j*10-10. compute time44=10. compute end43=j*10-10. Else if m45=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time44=time44+10. Else if m45=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m45=main(j). compute old45=av(j). compute s45=sec(j). compute e45=eloc(j). compute tech45=ict(j). compute trav45=mtrav(j). compute start45=j*10-10. compute time45=10. compute end44=j*10-10. Else if m46=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time45=time45+10. Else if m46=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m46=main(j). compute old46=av(j). compute s46=sec(j). compute e46=eloc(j). compute tech46=ict(j). compute trav46=mtrav(j). compute start46=j*10-10. compute time46=10. compute end45=j*10-10. Else if m47=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time46=time46+10. Else if m47=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m47=main(j). compute old47=av(j). compute s47=sec(j). compute e47=eloc(j). compute tech47=ict(j). compute trav47=mtrav(j). compute start47=j*10-10. compute time47=10. compute end46=j*10-10. Else if m48=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time47=time47+10. Else if m48=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m48=main(j). compute old48=av(j). compute s48=sec(j). compute e48=eloc(j). compute tech48=ict(j). compute trav48=mtrav(j). compute start48=j*10-10. compute time48=10. compute end47=j*10-10. Else if m49=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time48=time48+10. Else if m49=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m49=main(j). compute old49=av(j). compute s49=sec(j). compute e49=eloc(j). compute tech49=ict(j). compute trav49=mtrav(j). compute start49=j*10-10. compute time49=10. compute end48=j*10-10. Else if m50=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time49=time49+10. Else if m50=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m50=main(j). compute old50=av(j). compute s50=sec(j). compute e50=eloc(j). compute tech50=ict(j). compute trav50=mtrav(j). compute start50=j*10-10. compute time50=10. compute end49=j*10-10. Else if m51=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time50=time50+10. Else if m51=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m51=main(j). compute old51=av(j). compute s51=sec(j). compute e51=eloc(j). compute tech51=ict(j). compute trav51=mtrav(j). compute start51=j*10-10. compute time51=10. compute end50=j*10-10. Else if m52=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time51=time51+10. Else if m52=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m52=main(j). compute old52=av(j). compute s52=sec(j). compute e52=eloc(j). compute tech52=ict(j). compute trav52=mtrav(j). compute start52=j*10-10. compute time52=10. compute end51=j*10-10. Else if m53=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time52=time52+10. Else if m53=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m53=main(j). compute old53=av(j). compute s53=sec(j). compute e53=eloc(j). compute tech53=ict(j). compute trav53=mtrav(j). compute start53=j*10-10. compute time53=10. compute end52=j*10-10. Else if m54=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time53=time53+10. Else if m54=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m54=main(j). compute old54=av(j). compute s54=sec(j). compute e54=eloc(j). compute tech54=ict(j). compute trav54=mtrav(j). compute start54=j*10-10. compute time54=10. compute end53=j*10-10. Else if m55=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time54=time54+10. Else if m55=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m55=main(j). compute old55=av(j). compute s55=sec(j). compute e55=eloc(j). compute tech55=ict(j). compute trav55=mtrav(j). compute start55=j*10-10. compute time55=10. compute end54=j*10-10. Else if m56=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time55=time55+10. Else if m56=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m56=main(j). compute old56=av(j). compute s56=sec(j). compute e56=eloc(j). compute tech56=ict(j). compute trav56=mtrav(j). compute start56=j*10-10. compute time56=10. compute end55=j*10-10. Else if m57=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time56=time56+10. Else if m57=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m57=main(j). compute old57=av(j). compute s57=sec(j). compute e57=eloc(j). compute tech57=ict(j). compute trav57=mtrav(j). compute start57=j*10-10. compute time57=10. compute end56=j*10-10. Else if m58=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time57=time57+10. Else if m58=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m58=main(j). compute old58=av(j). compute s58=sec(j). compute e58=eloc(j). compute tech58=ict(j). compute trav58=mtrav(j). compute start58=j*10-10. compute time58=10. compute end57=j*10-10. Else if m59=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time58=time58+10. Else if m59=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m59=main(j). compute old59=av(j). compute s59=sec(j). compute e59=eloc(j). compute tech59=ict(j). compute trav59=mtrav(j). compute start59=j*10-10. compute time59=10. compute end58=j*10-10. Else if m60=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time59=time59+10. Else if m60=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m60=main(j). compute old60=av(j). compute s60=sec(j). compute e60=eloc(j). compute tech60=ict(j). compute trav60=mtrav(j). compute start60=j*10-10. compute time60=10. compute end59=j*10-10. Else if m61=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time60=time60+10. Else if m61=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m61=main(j). compute old61=av(j). compute s61=sec(j). compute e61=eloc(j). compute tech61=ict(j). compute trav61=mtrav(j). compute start61=j*10-10. compute time61=10. compute end60=j*10-10. Else if m62=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time61=time61+10. Else if m62=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m62=main(j). compute old62=av(j). compute s62=sec(j). compute e62=eloc(j). compute tech62=ict(j). compute trav62=mtrav(j). compute start62=j*10-10. compute time62=10. compute end61=j*10-10. Else if m63=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time62=time62+10. Else if m63=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m63=main(j). compute old63=av(j). compute s63=sec(j). compute e63=eloc(j). compute tech63=ict(j). compute trav63=mtrav(j). compute start63=j*10-10. compute time63=10. compute end62=j*10-10. Else if m64=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time63=time63+10. Else if m64=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m64=main(j). compute old64=av(j). compute s64=sec(j). compute e64=eloc(j). compute tech64=ict(j). compute trav64=mtrav(j). compute start64=j*10-10. compute time64=10. compute end63=j*10-10. Else if m65=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time64=time64+10. Else if m65=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m65=main(j). compute old65=av(j). compute s65=sec(j). compute e65=eloc(j). compute tech65=ict(j). compute trav65=mtrav(j). compute start65=j*10-10. compute time65=10. compute end64=j*10-10. Else if m66=0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time65=time65+10. Else if m66=0 and (main(i)~=main(j) or sec(i)~=sec(j) or eloc(i)~=eloc(j)). compute m66=main(j). compute old66=av(j). compute s66=sec(j). compute e66=eloc(j). compute tech66=ict(j). compute trav66=mtrav(j). compute start66=j*10-10. compute time66=10. compute end65=j*10-10. Else if m66>0 and main(i)=main(j) and sec(i)=sec(j) and eloc(i)=eloc(j). compute time66=time66+10. End if. end loop. if maxep=1 end1=1440. if maxep=2 end2=1440. if maxep=3 end3=1440. if maxep=4 end4=1440. if maxep=5 end5=1440. if maxep=6 end6=1440. if maxep=7 end7=1440. if maxep=8 end8=1440. if maxep=9 end9=1440. if maxep=10 end10=1440. if maxep=11 end11=1440. if maxep=12 end12=1440. if maxep=13 end13=1440. if maxep=14 end14=1440. if maxep=15 end15=1440. if maxep=16 end16=1440. if maxep=17 end17=1440. if maxep=18 end18=1440. if maxep=19 end19=1440. if maxep=20 end20=1440. if maxep=21 end21=1440. if maxep=22 end22=1440. if maxep=23 end23=1440. if maxep=24 end24=1440. if maxep=25 end25=1440. if maxep=26 end26=1440. if maxep=27 end27=1440. if maxep=28 end28=1440. if maxep=29 end29=1440. if maxep=30 end30=1440. if maxep=31 end31=1440. if maxep=32 end32=1440. if maxep=33 end33=1440. if maxep=34 end34=1440. if maxep=35 end35=1440. if maxep=36 end36=1440. if maxep=37 end37=1440. if maxep=38 end38=1440. if maxep=39 end39=1440. if maxep=40 end40=1440. if maxep=41 end41=1440. if maxep=42 end42=1440. if maxep=43 end43=1440. if maxep=44 end44=1440. if maxep=45 end45=1440. if maxep=46 end46=1440. if maxep=47 end47=1440. if maxep=48 end48=1440. if maxep=49 end49=1440. if maxep=50 end50=1440. if maxep=51 end51=1440. if maxep=52 end52=1440. if maxep=53 end53=1440. if maxep=54 end54=1440. if maxep=55 end55=1440. if maxep=56 end56=1440. if maxep=57 end57=1440. if maxep=58 end58=1440. if maxep=59 end59=1440. if maxep=60 end60=1440. if maxep=61 end61=1440. if maxep=62 end62=1440. if maxep=63 end63=1440. if maxep=64 end64=1440. if maxep=65 end65=1440. if maxep=66 end66=1440. End if. freq start66 m66 old66 s66 e66 tech66 trav66. desc time2 time40 time66. freq end2 end40 end66. *1 2 episode diary; 12 40 episode diaries, 1 66 episode diary. *test that the time variables have calculated correctly. compute test=0. do repeat a=start1 to start66 / b=end1 to end66 / c=testt1 to testt66. compute c=b-a. end repeat. execute. do repeat a=time1 to time66 /b=testt1 to testt66. if a~=b test=1. end repeat. compute tot1=sum(time1 to time66). compute tot2=sum(testt1 to testt66). freq test tot1 tot2. *if all ok, for all cases, test=0 and tot1 & tot2=1440. *compute last variable - clock time start of episodes. formats clock1 to clock66 (f6.2). Do repeat a=start1 to start66 / b= clock1 to clock66. Do if a<60. compute b=4+a/100. Else if a>59 and a<120. compute b=5+(a-60)/100. Else if a>119 and a<180. compute b=6+(a-120)/100. Else if a>179 and a<240. compute b=7+(a-180)/100. Else if a>239 and a<300. compute b=8+(a-240)/100. Else if a>299 and a<360. compute b=9+(a-300)/100. Else if a>359 and a<420. compute b=10+(a-360)/100. Else if a>419 and a<480. compute b=11+(a-420)/100. Else if a>479 and a<540. compute b=12+(a-480)/100. Else if a>539 and a<600. compute b=13+(a-540)/100. Else if a>599 and a<660. compute b=14+(a-600)/100. Else if a>659 and a<720. compute b=15+(a-660)/100. Else if a>719 and a<780. compute b=16+(a-720)/100. Else if a>779 and a<840. compute b=17+(a-780)/100. Else if a>839 and a<900. compute b=18+(a-840)/100. Else if a>899 and a<960. compute b=19+(a-900)/100. Else if a>959 and a<1020. compute b=20+(a-960)/100. Else if a>1019 and a<1080. compute b=21+(a-1020)/100. Else if a>1079 and a<1140. compute b=22+(a-1080)/100. Else if a>1139 and a<1200. compute b=23+(a-1140)/100. Else if a>1119 and a<1260. compute b=(a-1200)/100. Else if a>1259 and a<1320. compute b=1+(a-1260)/100. Else if a>1319 and a<1380. compute b=2+(a-1320)/100. Else if a>1379. compute b=3+(a-1380)/100. End if. End repeat. freq clock1 clock15 clock50 clock66. cro clock10 by start10. *calendar day not available in the original data. sort cases by hldid(a) persid(a) id(a). vector m=m1 to m66 /old=old1 to old66 /s=s1 to s66 /e=e1 to e66 /tech=tech1 to tech66 /trav=trav1 to trav66 /time=time1 to time66 /clock=clock1 to clock66 /start=start1 to start66 /end=end1 to end66. loop i=1 to 66. compute countrya=countrya. compute survey=survey. compute swave=swave. compute msamp=msamp. compute hldid=hldid. compute persid=persid. compute id=id. compute day=day. compute cday=-9. compute month=month. compute year=year. compute diary=diary. compute badcase=badcase. compute sex=sex. compute age=age. compute time=time(i). compute clockst=clock(i). compute start=start(i). compute end=end(i). compute epnum=i. compute main=m(i). compute sec=s(i). compute av=old(i). compute inout=-9. compute eloc=e(i). compute ict=tech(i). compute mtrav=trav(i). compute alone=-9. compute child=-9. compute sppart=-9. compute oad=-9. xsave outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w6.sav' /keep = countrya survey swave msamp hldid persid id day cday month year diary badcase sex age time clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad. end loop. execute. *tidy final world 6 files. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w6.sav'. apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\MTUS database\schema&etc\MTUSW60schema.sav'. *at the moment there are 66 episode rows for all diaries. *Reduce to one row per real episode. freq main. select if main>0. freq main. *check labels and distrubutions. freq countrya survey swave msamp hldid day cday month year diary badcase sex age clockst epnum main sec av inout eloc ict mtrav alone child sppart oad. desc persid id age time start end epnum. *separate out diaries of children and young people. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w6kid.sav'. select if age>17. freq age. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w6.sav'. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w6kid.sav'. select if age<18. freq age. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\2005\uk2005w6kid.sav'.