***************************************************************** *syntax to create the MTUS World 5.3, 5.8 and 6.0 files for the * *UK 1987 SCELI survey time diary element; note that this survey,* *used in combination with the UK 1983-84 ESRC-funded survey, * *makes a most-season mid-1980s UK data collection * *originally converted to MTUS by Jonathan Gershuny and Sally * *Jones, University of Bath, late 1980s, converted to W552 by * *Anne Gauthier and Tingting Lu December 2004, substantially * *amended and upgraded by Dr. Kimberly Fisher, Centre for Time * *Use Research, University of Oxford, 10 June 2012 * *Note that the original data file contains household row cases * *where person-level information is not easily mapped to the * *diaries. The original file also contains a number of data entry* *errors, which have been addressed in this version. Users may * *get different results using this version compared with older * *versions of this same dataset. * *****************************************************************. *create household-level variables. get file='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\HCSVARS.SAV'. compute countrya=37. compute survey=1987. compute swave=0. rename variables (qno=hldid). compute year=1987. execute. missing values all (). *note that this is a household level file from which both household and person level variables need to be extracted. *error correction - 12-year-old in this household is main respondent's daughter, not daughter-in-law. if hldid=30972 r9b=14. *additional age corrections. if hldid=10371 r11b=14. if hldid=30716 r11b=14. execute. freq r7 r9 r9a r9b r9c r9d r9e r9f r9g r9h r9i r18a r18b r19 r19a2 r19b2 r19c2 r20 fem44 r61aa. *test if r7 is the sum of the household member characteristics. compute test=1. if r9<99 test=test+1. if r9a<99 test=test+1. if r9b<99 test=test+1. if r9c<99 test=test+1. if r9d<99 test=test+1. if r9e<99 test=test+1. if r9f<99 test=test+1. if r9g<99 test=test+1. if r9h<99 test=test+1. if r9i<99 test=test+1. cro test by r7. compute testa=0. if test~=r7 testa=1. freq testa. *only two such cases - manually investigate. *in this case the last/7th household member is entered in the last *column set rather than the 7th person household set. Do if hldid=20641. compute r7=7. compute r9e=14. compute r10e=2. compute r11e=1. compute r12e=76. compute r10i=9. recode r9i r11i r12i (else=99). end if. execute. *case 20957 - seems to have shifted person, consider whether 9 (value or r7) or 8 hh members. *fix errors arising with diary match. Do if hldid=50332. compute R9=2. compute R10=2. compute R11=24. compute R12=13. compute R9i=99. compute R10i=9. compute R11i=99. compute R12i=99. End if. if hldid=40165 R11a=18. Do if hldid=50126. compute sexr=2. compute sexp=1. compute ager=24. compute agep=35. compute R9=1. compute R10=1. compute R11=35. compute R12=2. compute R9a=13. compute R10a=1. compute R11a=10. compute R12a=12. compute R9b=13. compute R10b=1. compute R11b=5. compute R12b=12. compute R9i=99. compute R10i=9. compute R11i=99. compute R12i=99. End if. if hldid=40998 r11b=14. Do if hldid=50504. compute R11c=19. compute R12c=2. compute R11b=11. compute R12b=12. End if. if hldid=10030 r11b=18. execute. rename variables (r7=hhldsize). compute nchild=0. vector kidage(10). freq ager. *no main respondents aged <20. Do if r11>0 and r11<18. compute nchild=nchild+1. compute kidage1=r11. Else if r9=9 or r9=10. compute kidage1=ager. Else if r9=13 or r9=14. compute kidage1=r11. End if. Do if r11a>0 and r11a<18. compute nchild=nchild+1. compute kidage2=r11a. Else if r9a=9 or r9a=10. compute kidage2=ager. Else if r9a=13 or r9a=14. compute kidage2=r11a. End if. Do if r11b>0 and r11b<18. compute nchild=nchild+1. compute kidage3=r11b. Else if r9b=9 or r9b=10. compute kidage3=ager. Else if r9b=13 or r9b=14. compute kidage3=r11b. End if. Do if r11c>0 and r11c<18. compute nchild=nchild+1. compute kidage4=r11c. Else if r9c=9 or r9c=10. compute kidage4=ager. Else if r9c=13 or r9c=14. compute kidage4=r11c. End if. Do if r11d>0 and r11d<18. compute nchild=nchild+1. compute kidage5=r11d. Else if r9d=9 or r9d=10. compute kidage5=ager. Else if r9d=13 or r9d=14. compute kidage5=r11d. End if. Do if r11e>0 and r11e<18. compute nchild=nchild+1. compute kidage6=r11e. Else if r9e=9 or r9e=10. compute kidage6=ager. Else if r9e=13 or r9e=14. compute kidage6=r11e. End if. Do if r11f>0 and r11f<18. compute nchild=nchild+1. compute kidage7=r11f. Else if r9f=9 or r9f=10. compute kidage7=ager. Else if r9f=13 or r9f=14. compute kidage7=r11f. End if. Do if r11g>0 and r11g<18. compute nchild=nchild+1. compute kidage8=r11g. Else if r9g=9 or r9g=10. compute kidage8=ager. Else if r9g=13 or r9g=14. compute kidage8=r11g. End if. Do if r11h>0 and r11h<18. compute nchild=nchild+1. compute kidage9=r11h. Else if r9h=9 or r9h=10. compute kidage9=ager. Else if r9h=13 or r9h=14. compute kidage9=r11h. End if. Do if r11i>0 and r11i<18. compute nchild=nchild+1. compute kidage10=r11i. Else if r9i=9 or r9i=10. compute kidage10=ager. Else if r9i=13 or r9i=14. compute kidage10=r11i. End if. freq nchild. recode kidage1 to kidage10 (sysmis=99). compute agekid2=min(kidage1 to kidage10). freq agekid2. recode agekid2 (99=-7). execute. recode agekid2 (-7=-7) (1 thru 4=1) (5 thru 12=2) (13 thru 17=3) (18 thru hi=4) into agekidx. means agekid2 by agekidx /cells min max. freq agekid2 agekidx. missing values sexp (). cro sexr by sexp. compute test=0. if sexr=2 and sexp=2 test=1. freq test. compute ocoup=0. var lab ocoup 'other couples apart from main resp & partner'. if (r9=5 or r9a=5 or r9b=5 or r9c=5 or r9d=5 or r9e=5 or r9f=5 or r9g=5 or r9h=5 or r9i=5) and (r9=8 or r9a=8 or r9b=8 or r9c=8 or r9d=8 or r9e=8 or r9f=8 or r9g=8 or r9h=8 or r9i=8) ocoup=1. if ((r9=6 or r9a=6 or r9b=6 or r9c=6 or r9d=6 or r9e=6 or r9f=6 or r9g=6 or r9h=6 or r9i=6) and (r9=7 or r9a=7 or r9b=7 or r9c=7 or r9d=7 or r9e=7 or r9f=7 or r9g=7 or r9h=7 or r9i=7)) ocoup=ocoup+20. if ((r9=9 or r9a=9 or r9b=9 or r9c=9 or r9d=9 or r9e=9 or r9f=9 or r9g=9 or r9h=9 or r9i=9) and (r9=10 or r9a=10 or r9b=10 or r9c=10 or r9d=10 or r9e=10 or r9f=10 or r9g=10 or r9h=10 or r9i=10)) ocoup=ocoup+300. if ((r9=11 or r9a=11 or r9b=11 or r9c=11 or r9d=11 or r9e=11 or r9f=11 or r9g=11 or r9h=11 or r9i=11) and (r9=12 or r9a=12 or r9b=12 or r9c=12 or r9d=12 or r9e=12 or r9f=12 or r9g=12 or r9h=12 or r9i=12)) ocoup=ocoup+4000. if ((r9=13 or r9a=13 or r9b=13 or r9c=13 or r9d=13 or r9e=13 or r9f=13 or r9g=13 or r9h=13 or r9i=13) and (r9=16 or r9a=16 or r9b=16 or r9c=16 or r9d=16 or r9e=16 or r9f=16 or r9g=16 or r9h=16 or r9i=16)) ocoup=ocoup+50000. if ((r9=14 or r9a=14 or r9b=14 or r9c=14 or r9d=14 or r9e=14 or r9f=14 or r9g=14 or r9h=14 or r9i=14) and (r9=15 or r9a=15 or r9b=15 or r9c=15 or r9d=15 or r9e=15 or r9f=15 or r9g=15 or r9h=15 or r9i=15)) ocoup=ocoup+600000. val lab ocoup 1 'brother & sister-in-law' 20 'sister and brother-in-law' 21 'brother & sister with spouses' 300 'with parents' 301 'with parents & brother & sister-in-law' 320 'with parents & sister & brother-in-law' 4000 'with parents in-law' 50000 'with son & daughter-in-law' 600000 'with daughter & son-in-law'. freq ocoup. cro ocoup by sexp hhldsize. compute hhtype=-8. Do if hhldsize=1. compute hhtype=1. Else if hhldsize=2 and sexp<9. compute hhtype=2. Else if hhldsize>1 and (sexp<9 or ocoup>0). compute hhtype=3. Else if hhldsize>1. compute hhtype=4. End if. freq hhtype. cro hhtype by sexp ocoup hhldsize. recode r84h (2=0) (1=1) (else=-8) into computer. cro computer by r84h. freq computer. freq r84d r84e p144b. cro r84d by r84e by p144b. recode r84d (2=0) (1=3) (else=-8) into vehicle. if r84e=1 vehicle=4. freq vehicle. cro vehicle by r84d r84e. freq r16a r16b r58. cro r16b by r58. recode r16b (1=1) (2 thru 4=2) (else=3) into ownhome. freq ownhome. cro r16b by ownhome. freq r131 r133 r80 r1282 r1283 r1284 r1285 r1286 r1287 r1288 r1289 r12810 r12811. *note there is missing data for some household members, but as person numbers *have to be adusted at the level of the extraction of person-level data, these *cases will be addressed and noted in the documentation at the individual level *extraction. recode r131 r1282 r1283 r1284 r1285 r1286 r1287 r1288 r1289 r12810 r12811 (3000 thru high=0). execute. compute incorig=r131 + r1282 + r1283 + r1284 + r1285 + r1286 + r1287 + r1288 + r1289 + r12810 + r12811. freq incorig. temp. select if incorig>0. freq incorig. recode incorig (0=-8) (1 thru 180=1) (180.1 thru 604.9=2) (605 thru hi=3) into income. freq income. recode hldid (10000 thru 19999=7) (20000 thru 29999=2) (30000 thru 39999=7) (40000 thru 49999=1) (50000 thru 59999=1) (60000 thru hi=5) into region. *10000 range Aberdeen *20000 range Coventry *30000 range Kirkcaldy *40000 range Northampton *50000 range Rochdale *60000 range Swindon. var lab region country 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. means hldid by region. freq date1 date2. compute month= date2 - trunc(date2/100)*100. freq month. compute startday=trunc(date2/100). freq startday. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87h.sav' /keep countrya survey swave hldid year hhtype hhldsize nchild agekidx agekid2 incorig income ownhome computer vehicle region. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\adddate.sav' /keep countrya hldid startday month year. get file='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\RESTRICTED-kpostcode.sav'. compute countrya=37. compute survey=1987. rename variables (qno=hldid). recode urind (-8=-8) (1,2,5,6=1) (else=2) into urban. if country='Scotland' and urind=6 urban=2. compute urbana=1. if post1='7777' urbana=-8. *post code sectors checked on Rightmove visual map in 2012 - should be some general *correspondence. urban postcode sectors: CV2 CV3 CV4 CV5 CV6 CV1 CV12 CV13 NN1 SN1 SN2. *the place coded as SNQ is either SN1 or SN2, which ir urban. *the following postal code sectors are rural: KY3 KY9, NN6 NN12, SN6 SN8. if post1='KY3' or post1='KY9' or post1='NN12' or post1='NN6' or post1='SN6' or post1='SN8' urbana=2. cro urbana by urban. *not perfect but reasonable correspondence, which indicates basic reliability. freq urban. cro urban by country. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\urban.sav' /keep countrya survey hldid urban. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87h.sav'. *extract person-level information. get file='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\HCSVARS.SAV'. missing values all (). execute. *fix errors arising with diary match. Do if qno=50332. compute R9=2. compute R10=2. compute R11=24. compute R12=13. compute R9i=99. compute R10i=9. compute R11i=99. compute R12i=99. End if. if qno=40165 R11a=18. Do if qno=50126. compute sexr=2. compute sexp=1. compute ager=24. compute agep=35. compute R9=1. compute R10=1. compute R11=35. compute R12=2. compute R9a=13. compute R10a=1. compute R11a=10. compute R12a=12. compute R9b=13. compute R10b=1. compute R11b=5. compute R12b=12. compute R9i=99. compute R10i=9. compute R11i=99. compute R12i=99. End if. if qno=40998 r11b=14. Do if qno=50504. compute R11c=19. compute R12c=2. compute R11b=11. compute R12b=12. End if. if qno=10030 r11b=18. if qno=10371 r11b=14. if qno=30716 r11b=14. execute. save outfile='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\HCSVARS-amended.SAV'. get file='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\HCSVARS-amended.SAV' /KEEP qno sexr sexp ager agep date2 r3 r4 r5 r6 r1281 r1291 r7 r9 r9a r9b r9c r9d r9e r9f r9g r9h r9i r10 r10a r10b r10c r10d r10e r10f r10g r10h r10i r11 r11a r11b r11c r11d r11e r11f r11g r11h r11i r12 r12a r12b r12c r12d r12e r12f r12g r12h r12i r1282 r1283 r1284 r1285 r1286 r1287 r1288 r1289 r12810 r12811 r1292 r1293 r1294 r1295 r1296 r1297 r1298 r1299 r12910 r12911 r17b r39e r39g r39h r39j p39e p39g p39h p39j r89 p89 r93a r93b p93a p93b r97 r101b p101b r126 r127 r130g r132a r132b diary nodiary r147 rseg80 rseg70 r921 r913 r118 r119 p921 p913. rename variables (qno=hldid). compute countrya=37. compute survey=1987. compute swave=0. rename variables (r9 r9a r9b r9c r9d r9e r9f r9g r9h r9i=r9a1 r9a2 r9a3 r9a4 r9a5 r9a6 r9a7 r9a8 r9a9 r9a10). rename variables (r10 r10a r10b r10c r10d r10e r10f r10g r10h r10i= r10a1 r10a2 r10a3 r10a4 r10a5 r10a6 r10a7 r10a8 r10a9 r10a10). rename variables (r11 r11a r11b r11c r11d r11e r11f r11g r11h r11i= r11a1 r11a2 r11a3 r11a4 r11a5 r11a6 r11a7 r11a8 r11a9 r11a10). rename variables (r12 r12a r12b r12c r12d r12e r12f r12g r12h r12i= r12a1 r12a2 r12a3 r12a4 r12a5 r12a6 r12a7 r12a8 r12a9 r12a10). rename variables (r1282 r1283 r1284 r1285 r1286 r1287 r1288 r1289 r12810 r12811= r128a1 r128a2 r128a3 r128a4 r128a5 r128a6 r128a7 r128a8 r128a9 r128a10). rename variables (r1292 r1293 r1294 r1295 r1296 r1297 r1298 r1299 r12910 r12911= r129a1 r129a2 r129a3 r129a4 r129a5 r129a6 r129a7 r129a8 r129a9 r129a10). *error corrections - 12-year-old in this household is main respondent's daughter, not daughter-in-law. if hldid=30972 r9a3=14. *diarist lives with brother and sister-in-law, not 2 in-law siblings. if hldid=50820 r9a2=5. *diarist lives with her parents and brothers, not 2 brothers-in-law. if hldid=50627 r9a3=5. if hldid=50627 r9a4=5. *diarist lives with spouse, duaghters and grand-daughter, not daughter-in-law. if hldid=20815 r9a4=18. execute. *note that this is a household level file from which both household and person level variables need to be extracted. vector sex(11) age(11) relref(11) empsta(11) workhr(11) empinc(11) rushed(11) parnta(11) parntb(11) partid(11) cohab(11) empsp(11) health(11) unemp(11) singpa(11) cphome(11) studen(11) retire(11) disab(11) civsta(11). do repeat a=sex1 to rushed1. compute a=-8. End repeat. do repeat a=rushed2 to health11. compute a=-7. End repeat. do repeat a=unemp1 to disab11. compute a=0. End repeat. do repeat a=civsta2 to civsta11. compute a=2. End repeat. compute relref1=1. compute sex1=sexr. freq ager. compute age1=ager. means r1291 by r3 /cells mean min max. Do if r3=2 or r3=4 or (r3=1 and (r1291>29 and r1291<200)). compute empsta1=1. Else if r3=1 and r1291<30. compute empsta1=2. Else if r3=3 or r3=5. compute empsta1=2. Else if (r3>0 and (r1291>9 and r1291<200)) or r3<6. compute empsta1=3. Else. compute empsta1=4. End if. cro r3 by empsta1. cro r3 by r4 r5 r6 r101b. cro r4 by r5 r6. Do if r3=9. compute unemp1=1. Else. compute unemp1=0. End if. freq unemp1. cro unemp1 by r3. *note unemployment rate looks extremely high among main respondents. cro r132a by r3 r39e. means age1 by r132a /cells min max mean. Do if r3=11 or (r3>9 and age1>65) or r39e=1 or (r3>60 and r132a=1). compute retire1=1. Else. compute retire1=0. end if. freq retire1. Do if r3=12 or (age1>5 and age1<16) or r39g=1. compute studen1=1. Else. compute studen1=0. End if. freq studen1. cro studen1 by r3 r39g. cro r17b by sexp. Do if r17b=2. compute civsta1=1. compute cohab1=0. Else if sexp<9. compute civsta1=1. compute cohab1=1. Else. compute civsta1=2. compute cohab1=-7. End if. freq civsta1 cohab1. cro civsta1 cohab1 by sexp r17b. freq r1291. Do if empsta1=4 and r1291>100. compute workhr1=-7. Else if r1291>100. compute workhr1=-8. Else. compute workhr1=r1291. End if. freq workhr1. temp. select if workhr1<0. cro workhr1 by r1291. temp. select if workhr1>-1 and workhr1<15. cro r1291 by workhr1. freq r1281 r127. Do if empsta1=4 and (r1281=0 or r1281>3000). compute empinc1=-7. Else if r1281>3000. compute empinc1=-8. Else. compute empinc1=r1281. End if. freq empinc1. means empinc1 by r127 empsta1 /cells min max mean. temp. select if empinc1<5. cro empinc1 by r1281 empsta1. do if r3=10 or r119=1. compute disab1=1. else if r7=1 and (r130g=1 or r132b=1). compute disab1=1. Else. compute disab1=0. End if. freq disab1. cro disab1 by r3 r119 r130g r132b. *large proportion of main respondents report having a disability. freq r118 p39h r93a. cro r118 by p39h r93a. recode r118 (0 thru 3=0) (4 thru 5=1) (6 thru 8=2) (9 thru 10 =3) (88=-8) into health1. freq health1. cro health1 by r118. freq r913 r921. cro r913 by r921. Do if r913=0. compute rushed1=0. Else if r913<3. compute rushed1=2. Else if r913<7. compute rushed1=1. Else if r921=4 or r921=5. compute rushed1=2. Else if r921=1 or r921=2. compute rushed1=0. Else if r921=3. compute rushed1=1. Else. compute rushed1=-8. End if. freq rushed1. cro rushed1 by r921 r913. freq rseg80 rseg70. cro r9a1 by r10a1. recode r9a5 to r9a10 (sysmis=99). freq r9a1 to r9a10. recode r10a5 to r10a10 (sysmis=9). freq r10a1 to r10a10. recode r11a1 to r11a10 (0=99) (sysmis=99). freq r11a1 to r11a10. recode r12a5 to r12a10 (sysmis=99). recode r12a10 (70,72=76). freq r12a1 to r12a10. recode r128a1 to r128a10 (5000 thru high=9999). freq r128a1 to r128a10. recode r129a1 to r129a10 (150 thru high=999). freq r129a1 to r129a10. *get a sense of initial scale of problem of person details recorded in the wrong place. compute test=0. if r9a1=99 and r9a2<99 test=1. freq test. compute change=0. var lab change number of person number changes. *run several iterations to move along household members *to the next time slot and fill in gaps added in error. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10. loop i=1 to 9. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. freq change. vector r9a= r9a1 to r9a10 /r10a=r10a1 to r10a10 /r11a=r11a1 to r11a10 /r12a= r12a1 to r12a10 /r128a=r128a1 to r128a10 /r129a=r129a1 to r129a10 /. loop i=1 to 8. compute j=i+1. Do if r9a(i)=99 and r9a(j)<99. compute r9a(i)=r9a(j). compute r9a(j)=99. compute r10a(i)=r10a(j). compute r10a(j)=9. compute r11a(i)=r11a(j). compute r11a(j)=99. compute r12a(i)=r12a(j). compute r12a(j)=99. compute r128a(i)=r128a(j). compute r128a(j)=9999. compute r129a(i)=r129a(j). compute r129a(j)=999. compute change=change+1. End if. End loop. execute. *complete sex for all other people in the household. compute sex2=r10a1. compute sex3=r10a2. compute sex4=r10a3. compute sex5=r10a4. compute sex6=r10a5. compute sex7=r10a6. compute sex8=r10a7. compute sex9=r10a8. compute sex10=r10a9. compute sex11=r10a10. execute. recode sex2 to sex11 (9=-8). *complete age for all other people in the household. compute age2=r11a1. compute age3=r11a2. compute age4=r11a3. compute age5=r11a4. compute age6=r11a5. compute age7=r11a6. compute age8=r11a7. compute age9=r11a8. compute age10=r11a9. compute age11=r11a10. execute. recode age2 to age11 (99=-8). *complete economic activity status variables for all other hh members. Do if r12a1=2 or r12a1=4 or (r12a1=1 and (r129a1>29 and r129a1<200)). compute empsta2=1. Else if r12a1=1 and r129a1<30. compute empsta2=2. Else if r12a1=3 or r12a1=5. compute empsta2=2. Else if (r12a1>0 and (r129a1>9 and r129a1<200)) or r12a1<6. compute empsta2=3. Else. compute empsta2=4. End if. cro r12a1 by empsta2. Do if r12a2=2 or r12a2=4 or (r12a2=1 and (r129a2>29 and r129a2<200)). compute empsta3=1. Else if r12a2=1 and r129a2<30. compute empsta3=2. Else if r12a2=3 or r12a2=5. compute empsta3=2. Else if (r12a2>0 and (r129a2>9 and r129a2<200)) or r12a2<6. compute empsta3=3. Else if r12a2=99. compute empsta3=-8. Else. compute empsta3=4. End if. cro r12a2 by empsta3. Do if r12a3=2 or r12a3=4 or (r12a3=1 and (r129a3>29 and r129a3<200)). compute empsta4=1. Else if r12a3=1 and r129a3<30. compute empsta4=2. Else if r12a3=3 or r12a3=5. compute empsta4=2. Else if (r12a3>0 and (r129a3>9 and r129a3<200)) or r12a3<6. compute empsta4=3. Else if r12a3=99. compute empsta4=-8. Else. compute empsta4=4. End if. cro r12a3 by empsta4. Do if r12a4=2 or r12a4=4 or (r12a4=1 and (r129a4>29 and r129a4<200)). compute empsta5=1. Else if r12a4=1 and r129a4<30. compute empsta5=2. Else if r12a4=3 or r12a4=5. compute empsta5=2. Else if (r12a4>0 and (r129a4>9 and r129a4<200)) or r12a4<6. compute empsta5=3. Else if r12a4=99. compute empsta5=-8. Else. compute empsta5=4. End if. cro r12a4 by empsta5. Do if r12a5=2 or r12a5=4 or (r12a5=1 and (r129a5>29 and r129a5<200)). compute empsta6=1. Else if r12a5=1 and r129a5<30. compute empsta6=2. Else if r12a5=3 or r12a5=5. compute empsta6=2. Else if (r12a5>0 and (r129a5>9 and r129a5<200)) or r12a5<6. compute empsta6=3. Else if r12a5=99. compute empsta6=-8. Else. compute empsta6=4. End if. cro r12a5 by empsta6. Do if r12a6=2 or r12a6=4 or (r12a6=1 and (r129a6>29 and r129a6<200)). compute empsta7=1. Else if r12a6=1 and r129a6<30. compute empsta7=2. Else if r12a6=3 or r12a6=5. compute empsta7=2. Else if (r12a6>0 and (r129a6>9 and r129a6<200)) or r12a6<6. compute empsta7=3. Else if r12a6=99. compute empsta7=-8. Else. compute empsta7=4. End if. cro r12a6 by empsta7. Do if r12a7=2 or r12a7=4 or (r12a7=1 and (r129a7>29 and r129a7<200)). compute empsta8=1. Else if r12a7=1 and r129a7<30. compute empsta8=2. Else if r12a7=3 or r12a7=5. compute empsta8=2. Else if (r12a7>0 and (r129a7>9 and r129a7<200)) or r12a7<6. compute empsta8=3. Else if r12a7=99. compute empsta8=-8. Else. compute empsta8=4. End if. cro r12a7 by empsta8. Do if r12a8=2 or r12a8=4 or (r12a8=1 and (r129a8>29 and r129a8<200)). compute empsta9=1. Else if r12a8=1 and r129a8<30. compute empsta9=2. Else if r12a8=3 or r12a8=5. compute empsta9=2. Else if (r12a8>0 and (r129a8>9 and r129a8<200)) or r12a8<6. compute empsta9=3. Else if r12a8=99. compute empsta9=-8. Else. compute empsta9=4. End if. cro r12a8 by empsta9. Do if r12a9=2 or r12a9=4 or (r12a9=1 and (r129a9>29 and r129a9<200)). compute empsta10=1. Else if r12a9=1 and r129a9<30. compute empsta10=2. Else if r12a9=3 or r12a9=5. compute empsta10=2. Else if (r12a9>0 and (r129a9>9 and r129a9<200)) or r12a9<6. compute empsta10=3. Else if r12a9=99. compute empsta10=-8. Else. compute empsta10=4. End if. cro r12a9 by empsta10. Do if r12a10=2 or r12a10=4 or (r12a10=1 and (r129a10>29 and r129a10<200)). compute empsta11=1. Else if r12a10=1 and r129a10<30. compute empsta11=2. Else if r12a10=3 or r12a10=5. compute empsta11=2. Else if (r12a10>0 and (r129a10>9 and r129a10<200)) or r12a10<6. compute empsta11=3. Else if r12a10=99. compute empsta11=-8. Else. compute empsta11=4. End if. cro r12a10 by empsta11. *complete empinclm for all persons. Do if empsta2=4 and (r128a1=0 or r128a1>3000). compute empinc2=-7. Else if r128a1>3000. compute empinc2=-8. Else. compute empinc2=r128a1. End if. Do if empsta3=4 and (r128a2=0 or r128a2>3000). compute empinc3=-7. Else if r128a2>3000. compute empinc3=-8. Else. compute empinc3=r128a2. End if. Do if empsta4=4 and (r128a3=0 or r128a3>3000). compute empinc4=-7. Else if r128a3>3000. compute empinc4=-8. Else. compute empinc4=r128a3. End if. Do if empsta5=4 and (r128a4=0 or r128a4>3000). compute empinc5=-7. Else if r128a4>3000. compute empinc5=-8. Else. compute empinc5=r128a4. End if. Do if empsta6=4 and (r128a5=0 or r128a5>3000). compute empinc6=-7. Else if r128a5>3000. compute empinc6=-8. Else. compute empinc6=r128a5. End if. Do if empsta7=4 and (r128a6=0 or r128a6>3000). compute empinc7=-7. Else if r128a6>3000. compute empinc7=-8. Else. compute empinc7=r128a6. End if. Do if empsta8=4 and (r128a7=0 or r128a7>3000). compute empinc8=-7. Else if r128a7>3000. compute empinc8=-8. Else. compute empinc8=r128a7. End if. Do if empsta9=4 and (r128a8=0 or r128a8>3000). compute empinc9=-7. Else if r128a8>3000. compute empinc9=-8. Else. compute empinc9=r128a8. End if. Do if empsta10=4 and (r128a9=0 or r128a9>3000). compute empinc10=-7. Else if r128a9>3000. compute empinc10=-8. Else. compute empinc10=r128a9. End if. Do if empsta11=4 and (r128a10=0 or r128a10>3000). compute empinc11=-7. Else if r128a10>3000. compute empinc11=-8. Else. compute empinc11=r128a10. End if. execute. *complete hours of work per person. Do if empsta2=4 and r129a1>100. compute workhr2=-7. Else if r129a1>100. compute workhr2=-8. Else. compute workhr2=r129a1. End if. Do if empsta3=4 and r129a2>100. compute workhr3=-7. Else if r129a2>100. compute workhr3=-8. Else. compute workhr3=r129a2. End if. Do if empsta4=4 and r129a3>100. compute workhr4=-7. Else if r129a3>100. compute workhr4=-8. Else. compute workhr4=r129a3. End if. Do if empsta5=4 and r129a4>100. compute workhr5=-7. Else if r129a4>100. compute workhr5=-8. Else. compute workhr5=r129a4. End if. Do if empsta6=4 and r129a5>100. compute workhr6=-7. Else if r129a5>100. compute workhr6=-8. Else. compute workhr6=r129a5. End if. Do if empsta7=4 and r129a6>100. compute workhr7=-7. Else if r129a6>100. compute workhr7=-8. Else. compute workhr7=r129a6. End if. Do if empsta8=4 and r129a7>100. compute workhr8=-7. Else if r129a7>100. compute workhr8=-8. Else. compute workhr8=r129a7. End if. Do if empsta9=4 and r129a8>100. compute workhr9=-7. Else if r129a8>100. compute workhr9=-8. Else. compute workhr9=r129a8. End if. Do if empsta10=4 and r129a9>100. compute workhr10=-7. Else if r129a9>100. compute workhr10=-8. Else. compute workhr10=r129a9. End if. Do if empsta11=4 and r129a10>100. compute workhr11=-7. Else if r129a10>100. compute workhr11=-8. Else. compute workhr11=r129a10. End if. execute. *complete unemp retired student disab for remaining household members. Do if r12a1=9. compute unemp2=1. Else if r12a1=10. compute disab2=1. Else if r12a1=11 or ((empsta2=4 and age2>65) or (empsta2=-8 and age2>69)). compute retire2=1. Else if r12a1=12 or (age2>-1 and age2<16). compute studen2=1. Else if (age2>16 and age2<70) and empsta2=-8. compute unemp2=-8. compute disab2=-8. compute retire2=-8. compute studen2=-8. End if. cro r12a1 by unemp2 disab2 retire2 studen2. Do if r12a2=9. compute unemp3=1. Else if r12a2=10. compute disab3=1. Else if r12a2=11 or ((empsta3=4 and age3>65) or (empsta3=-8 and age3>69)). compute retire3=1. Else if r12a2=12 or (age3>-1 and age3<16). compute studen3=1. Else if (age3>16 and age3<70) and empsta3=-8. compute unemp3=-8. compute disab3=-8. compute retire3=-8. compute studen3=-8. End if. cro r12a2 by unemp3 disab3 retire3 studen3. Do if r12a3=9. compute unemp4=1. Else if r12a3=10. compute disab4=1. Else if r12a3=11 or ((empsta4=4 and age4>65) or (empsta4=-8 and age4>69)). compute retire4=1. Else if r12a3=12 or (age4>-1 and age4<16). compute studen4=1. Else if (age4>16 and age4<70) and empsta4=-8. compute unemp4=-8. compute disab4=-8. compute retire4=-8. compute studen4=-8. End if. cro r12a3 by unemp4 disab4 retire4 studen4. Do if r12a4=9. compute unemp5=1. Else if r12a4=10. compute disab5=1. Else if r12a4=11 or ((empsta5=4 and age5>65) or (empsta5=-8 and age5>69)). compute retire5=1. Else if r12a4=12 or (age5>-1 and age5<16). compute studen5=1. Else if (age5>16 and age5<70) and empsta5=-8. compute unemp5=-8. compute disab5=-8. compute retire5=-8. compute studen5=-8. End if. cro r12a4 by unemp5 disab5 retire5 studen5. Do if r12a5=9. compute unemp6=1. Else if r12a5=10. compute disab6=1. Else if r12a5=11 or ((empsta6=4 and age6>65) or (empsta6=-8 and age6>69)). compute retire6=1. Else if r12a5=12 or (age6>-1 and age6<16). compute studen6=1. Else if (age6>16 and age6<70) and empsta6=-8. compute unemp6=-8. compute disab6=-8. compute retire6=-8. compute studen6=-8. End if. cro r12a5 by unemp6 disab6 retire6 studen6. Do if r12a6=9. compute unemp7=1. Else if r12a6=10. compute disab7=1. Else if r12a6=11 or ((empsta7=4 and age7>65) or (empsta7=-8 and age7>69)). compute retire7=1. Else if r12a6=12 or (age7>-1 and age7<16). compute studen7=1. Else if (age7>16 and age7<70) and empsta7=-8. compute unemp7=-8. compute disab7=-8. compute retire7=-8. compute studen7=-8. End if. cro r12a6 by unemp7 disab7 retire7 studen7. Do if r12a7=9. compute unemp8=1. Else if r12a7=10. compute disab8=1. Else if r12a7=11 or ((empsta8=4 and age8>65) or (empsta8=-8 and age8>69)). compute retire8=1. Else if r12a7=12 or (age8>-1 and age8<16). compute studen8=1. Else if (age8>16 and age8<70) and empsta8=-8. compute unemp8=-8. compute disab8=-8. compute retire8=-8. compute studen8=-8. End if. cro r12a7 by unemp8 disab8 retire8 studen8. Do if r12a8=9. compute unemp9=1. Else if r12a8=10. compute disab9=1. Else if r12a8=11 or ((empsta9=4 and age9>65) or (empsta9=-8 and age9>69)). compute retire9=1. Else if r12a8=12 or (age9>-1 and age9<16). compute studen9=1. Else if (age9>16 and age9<70) and empsta9=-8. compute unemp9=-8. compute disab9=-8. compute retire9=-8. compute studen9=-8. End if. cro r12a8 by unemp9 disab9 retire9 studen9. Do if r12a9=9. compute unemp10=1. Else if r12a9=10. compute disab10=1. Else if r12a9=11 or ((empsta10=4 and age10>65) or (empsta10=-8 and age10>69)). compute retire10=1. Else if r12a9=12 or (age10>-1 and age10<16). compute studen10=1. Else if (age10>16 and age10<70) and empsta10=-8. compute unemp10=-8. compute disab10=-8. compute retire10=-8. compute studen10=-8. End if. cro r12a9 by unemp10 disab10 retire10 studen10. Do if r12a10=9. compute unemp11=1. Else if r12a10=10. compute disab11=1. Else if r12a10=11 or ((empsta11=4 and age11>65) or (empsta11=-8 and age11>69)). compute retire11=1. Else if r12a10=12 or (age11>-1 and age11<16). compute studen11=1. Else if (age11>16 and age11<70) and empsta11=-8. compute unemp11=-8. compute disab11=-8. compute retire11=-8. compute studen11=-8. End if. cro r12a10 by unemp11 disab11 retire11 studen11. *check whether anyone has more than 1 partner. compute test=0. do repeat a=r9a1 to r9a10. if a<5 test=test+1. end repeat. freq test. *one case with apparently 2 partners, but one male is age of the second child, there are *2 children in the household and the older male matches the partner characteristics. *this looks like a miscoded 3 - male cohabitting partner that should be 13 son. if test=2 r9a2=13. execute. *look for cases where diarist is a single parent. compute mainpar=0. compute opara=0. compute oparb=0. compute okida=0. compute okidb=0. compute okidc=0. compute ocoup=0. var lab mainpar '# or children of whom main resp is parent'. var lab opara own children who could be are parents. var lab oparb grandparents in household. var lab okida grandchildren in household. var lab okidb parents in household. var lab okidc other children in household. var lab ocoup other people in couples in hhold. do repeat a=r9a1 to r9a10. if a=13 or a=14 mainpar=mainpar+1. end repeat. freq mainpar. *identify cases where main respondent is a single parent. Do if mainpar>0 and civsta1=2. compute singpa1=1. Else. compute singpa1=0. End if. freq singpa1. do repeat a=r9a1 to r9a10 /b=r11a1 to r11a10. if a=17 or a=18 okida=1. if a>8 and a<13 okidb=1. if (b>0 and b<18) and a>20 okidc=1. if a>12 and a<17 opara=1. if a=19 or a=20 oparb=1. end repeat. *14 cases children and grandchildren in household. cro opara by okida. *2 cases parents and grandparents in household. cro oparb by okidb. *14 cases of other children in household. freq okidc. temp. select if (opara=1 and okida=1) or (oparb=1 and okidb=1) or okidc=1. freq hldid. *all cases where multiple couples may be in the household checked for appropriate household *grid and partner/parent identifications. 5 cases have no issues, household 60447 is *complex, but only main respondent completed a diary so no more deliniation possible. *Some errors fixed, and other complexities now addressed. Do if hldid=10149. compute parnta4=2. compute parnta5=2. compute parntb4=3. compute parntb5=3. compute cphome4=1. compute cphome5=1. compute partid2=3. compute empsp2=empsta3. compute civsta2=1. compute partid3=2. compute empsp3=empsta2. compute civsta3=1. End if. Do if hldid=20053 or hldid=30848 or hldid=41021. compute parnta4=2. compute cphome4=1. compute singpa2=1. End if. Do if hldid=20164 or hldid=30178 or hldid=30433 or hldid=40543 or hldid=50859 or hldid=60377 or hldid=60823. compute parnta4=3. compute cphome4=1. compute singpa3=1. End if. Do if hldid=20369. compute parnta4=2. compute parntb4=3. compute cphome4=1. End if. Do if hldid=20858. compute r9a2=9. compute partid2=3. compute empsp2=empsta3. compute civsta2=1. compute cohab2=0. compute partid3=2. compute empsp3=empsta2. compute civsta3=1. compute cohab3=0. compute parnta4=2. compute parntb4=3. compute cphome4=1. End if. Do if hldid=20928 or hldid=30542 or hldid=60250. compute parnta3=2. compute cphome3=1. compute singpa2=1. End if. Do if hldid=30133. compute partid2=3. compute empsp2=empsta3. compute civsta2=1. compute partid3=2. compute empsp3=empsta2. compute civsta3=1. compute parnta5=2. compute parnta6=2. compute parnta7=2. compute parnta8=2. compute parntb5=3. compute parntb6=3. compute parntb7=3. compute parntb8=3. compute cphome5=1. compute cphome6=1. compute cphome7=1. compute cphome8=1. compute parntb9=4. compute cphome9=1. End if. Do if hldid=60176. compute parnta3=2. compute cphome3=1. compute parnta4=2. compute cphome4=1. compute singpa2=1. End if. Do if hldid=40364. compute r9a2=14. End if. Do if hldid=40961. compute parnta3=2. compute cphome3=1. End if. Do if hldid=50681. compute partid2=3. compute empsp2=empsta3. compute civsta2=1. compute partid3=2. compute empsp3=empsta2. compute civsta3=1. compute partid4=5. compute empsp4=empsta5. compute civsta4=1. compute parnta4=2. compute parntb4=3. compute partid5=4. compute empsp5=empsta4. compute civsta5=1. compute parnta7=2. compute parntb7=3. compute cphome7=1. compute parnta8=2. compute parntb8=3. compute cphome8=1. compute parntb9=6. compute cphome9=1. compute parntb11=6. compute cphome9=1. compute parnta10=4. compute parntb10=5. compute cphome10=1. End if. Do if hldid=50743. compute parnta3=2. compute partid3=4. compute empsp3=empsta4. compute civsta3=1. compute cohab3=0. compute parnta4=2. compute partid4=3. compute empsp4=empsta3. compute civsta4=1. compute cohab4=0. compute parnta11=3. compute parntb11=4. compute cphome11=1. End if. Do if hldid=60701. compute partid2=3. compute empsp2=empsta3. compute civsta2=1. compute cohab2=0. compute partid3=2. compute empsp3=empsta2. compute civsta3=1. compute cohab3=0. End if. Do if hldid=61013. compute r9a4=13. End if. Do if hldid=20815. compute parnta5=3. compute singpa3=1. End if. execute. *complete variables for spouses/partners. Do if r9a1=1 or r9a1=2. compute cohab2=0. Else if r9a1=3 or r9a1=4. compute cohab2=1. End if. Do if r9a1>0 and r9a1<5. compute partid1=2. compute partid2=1. compute civsta2=1. compute relref2=2. compute empsp1=empsta2. compute empsp2=empsta1. if p101b=1 unemp2=1. Do if p913=0. compute rushed2=0. Else if p913<3. compute rushed2=2. Else if p913<7. compute rushed2=1. Else if p921=4 or p921=5. compute rushed2=2. Else if p921=1 or p921=2. compute rushed2=0. Else if p921=3. compute rushed2=1. Else. compute rushed2=-8. End if. End if. freq rushed2. cro rushed2 by p921 p913. Do if r9a2=1 or r9a2=2. compute cohab3=0. Else if r9a2=3 or r9a2=4. compute cohab3=1. End if. Do if r9a2>0 and r9a2<5. compute partid1=3. compute partid3=1. compute civsta3=1. compute relref3=2. compute empsp1=empsta3. compute empsp3=empsta1. if p101b=1 unemp3=1. Do if p913=0. compute rushed3=0. Else if p913<3. compute rushed3=2. Else if p913<7. compute rushed3=1. Else if p921=4 or p921=5. compute rushed3=2. Else if p921=1 or p921=2. compute rushed3=0. Else if p921=3. compute rushed3=1. Else. compute rushed3=-8. End if. End if. freq rushed3. cro rushed3 by p921 p913. Do if r9a3=1 or r9a3=2. compute cohab4=0. Else if r9a3=3 or r9a3=4. compute cohab4=1. End if. Do if r9a3>0 and r9a3<5. compute partid1=4. compute partid4=1. compute civsta4=1. compute relref4=2. compute empsp1=empsta4. compute empsp4=empsta1. if p101b=1 unemp4=1. Do if p913=0. compute rushed4=0. Else if p913<3. compute rushed4=2. Else if p913<7. compute rushed4=1. Else if p921=4 or p921=5. compute rushed4=2. Else if p921=1 or p921=2. compute rushed4=0. Else if p921=3. compute rushed4=1. Else. compute rushed4=-8. End if. End if. freq rushed4. Do if r9a4=1 or r9a4=2. compute cohab5=0. Else if r9a4=3 or r9a4=4. compute cohab5=1. End if. Do if r9a4>0 and r9a4<5. compute partid1=5. compute partid5=1. compute civsta5=1. compute relref5=2. compute empsp1=empsta5. compute empsp5=empsta1. if p101b=1 unemp5=1. Do if p913=0. compute rushed5=0. Else if p913<3. compute rushed5=2. Else if p913<7. compute rushed5=1. Else if p921=4 or p921=5. compute rushed5=2. Else if p921=1 or p921=2. compute rushed5=0. Else if p921=3. compute rushed5=1. Else. compute rushed5=-8. End if. End if. Do if r9a5=1 or r9a5=2. compute cohab6=0. Else if r9a5=3 or r9a5=4. compute cohab6=1. End if. Do if r9a5>0 and r9a5<5. compute partid1=6. compute partid6=1. compute civsta6=1. compute relref6=2. compute empsp1=empsta6. compute empsp6=empsta1. if p101b=1 unemp6=1. Do if p913=0. compute rushed6=0. Else if p913<3. compute rushed6=2. Else if p913<7. compute rushed6=1. Else if p921=4 or p921=5. compute rushed6=2. Else if p921=1 or p921=2. compute rushed6=0. Else if p921=3. compute rushed6=1. Else. compute rushed6=-8. End if. End if. freq cohab5 cohab6. *fill in variables for children or ref person. do if r9a1=13 or r9a1=14. compute relref2=3. if civsta2=2 cphome2=1. compute parnta2=1. if civsta1=1 parntb2=partid1. end if. do if r9a2=13 or r9a2=14. compute relref3=3. if civsta3=2 cphome3=1. compute parnta3=1. if civsta1=1 parntb3=partid1. end if. do if r9a3=13 or r9a3=14. compute relref4=3. if civsta4=2 cphome4=1. compute parnta4=1. if civsta1=1 parntb4=partid1. end if. do if r9a4=13 or r9a4=14. compute relref5=3. if civsta5=2 cphome5=1. compute parnta5=1. if civsta1=1 parntb5=partid1. end if. do if r9a5=13 or r9a5=14. compute relref6=3. if civsta6=2 cphome6=1. compute parnta6=1. if civsta1=1 parntb6=partid1. end if. do if r9a6=13 or r9a6=14. compute relref7=3. if civsta7=2 cphome7=1. compute parnta7=1. if civsta1=1 parntb7=partid1. end if. do if r9a7=13 or r9a7=14. compute relref8=3. if civsta8=2 cphome8=1. compute parnta8=1. if civsta1=1 parntb8=partid1. end if. do if r9a8=13 or r9a8=14. compute relref9=3. if civsta9=2 cphome9=1. compute parnta9=1. if civsta1=1 parntb9=partid1. end if. do if r9a9=13 or r9a9=14. compute relref10=3. if civsta10=2 cphome10=1. compute parnta10=1. if civsta1=1 parntb10=partid1. end if. do if r9a10=13 or r9a10=14. compute relref11=3. if civsta11=2 cphome11=1. compute parnta11=1. if civsta1=1 parntb11=partid1. end if. freq relref1 relref2 relref3 relref4 relref5 relref6 relref7 relref8 relref9 relref10 relref11. *fill in variables for parents of household reference person. *check which person numbers parents have to identify couples where ref person *if a child living with parents. freq r9a1 r9a2 r9a3 r9a4 r9a5 r9a6 r9a7 r9a8 r9a9 r9a10. *most parents are person 2 or person 3. 5 mothers are person4 and 1 father is person 5. do if r9a1=9 or r9a1=10. compute relref2=4. if civsta1=2 cphome1=1. compute parnta1=2. Do if r9a2=9 or r9a2=10. compute civsta2=1. compute partid2=3. compute empsp2=empsta3. compute relref3=4. compute civsta3=1. compute partid3=2. compute empsp3=empsta2. compute parntb1=3. Else if hldid=20498. compute civsta2=1. compute partid2=4. compute empsp2=empsta4. compute relref4=4. compute civsta4=1. compute partid4=2. compute empsp4=empsta2. compute parntb1=4. Else if hldid=50595. compute civsta2=1. compute partid2=5. compute empsp2=empsta5. compute relref5=4. compute civsta5=1. compute partid5=2. compute empsp5=empsta2. compute parntb1=5. Else. compute singpa2=1. End if. end if. do if hldid=50743. if civsta1=2 cphome1=1. compute relref3=4. compute civsta3=1. compute partid3=4. compute empsp3=empsta4. compute relref4=4. compute civsta4=1. compute partid4=3. compute empsp4=empsta3. compute parnta1=3. compute parntb1=4. Else if (r9a2=9 or r9a2=10) and (r9a1<9 or r9a1>10). compute relref3=4. if civsta1=2 cphome1=1. compute parnta1=3. compute singpa3=1. Else if (r9a3=9 or r9a3=10) and hldid~=20498 and hldid~=50743. compute relref4=4. if civsta1=2 cphome1=1. compute parnta1=4. compute singpa4=1. end if. freq relref2 relref3 relref4 relref5 partid2 partid3 partid4 partid5. *fill in variables for brothers and sisters. do if r9a1=5 or r9a1=6. compute relref2=5. if parnta1>0 and civsta2=2 cphome2=1. compute parnta2=parnta1. compute parntb2=parntb1. end if. do if r9a2=5 or r9a2=6. compute relref3=5. if parnta1>0 and civsta3=2 cphome3=1. compute parnta3=parnta1. compute parntb3=parntb1. end if. do if r9a3=5 or r9a3=6. compute relref4=5. if parnta1>0 and civsta4=2 cphome4=1. compute parnta4=parnta1. compute parntb4=parntb1. end if. do if r9a4=5 or r9a4=6. compute relref5=5. if parnta1>0 and civsta5=2 cphome5=1. compute parnta5=parnta1. compute parntb5=parntb1. end if. do if r9a5=5 or r9a5=6. compute relref6=5. if parnta1>0 and civsta6=2 cphome6=1. compute parnta6=parnta1. compute parntb6=parntb1. end if. do if r9a6=5 or r9a6=6. compute relref7=5. if parnta1>0 and civsta7=2 cphome7=1. compute parnta7=parnta1. compute parntb7=parntb1. end if. do if r9a7=5 or r9a7=6. compute relref8=5. if parnta1>0 and civsta8=2 cphome8=1. compute parnta8=parnta1. compute parntb8=parntb1. end if. do if r9a8=5 or r9a8=6. compute relref9=5. if parnta1>0 and civsta9=2 cphome9=1. compute parnta9=parnta1. compute parntb9=parntb1. end if. do if r9a9=5 or r9a9=6. compute relref10=5. if parnta1>0 and civsta10=2 cphome10=1. compute parnta10=parnta1. compute parntb10=parntb1. end if. do if r9a10=5 or r9a10=6. compute relref11=5. if parnta1>0 and civsta11=2 cphome11=1. compute parnta11=parnta1. compute parntb11=parntb1. end if. freq relref2 relref3 relref4 relref5 relref6 relref7 relref8 relref9 relref10 relref11. *code remaining variables for son-in-law/daughter-in-law. freq r9a1 r9a2 r9a3 r9a4 r9a5 r9a6 r9a7 r9a8 r9a9 r9a10. *one son-in-law (r9a3=15) & 1 daughter-in-law. do if hldid=20365. compute relref4=6. compute civstat3=1. compute civstat4=1. compute empsp3=empsta4. compute empsp4=empsta3. compute cphome3=0. compute cphome4=0. compute partid3=4. compute partid4=3. Else if hldid=20465. compute relref6=6. compute civstat3=1. compute civstat6=1. compute empsp3=empsta6. compute empsp6=empsta3. compute cphome3=0. compute cphome6=0. compute partid3=6. compute partid6=3. end if. freq relref4 relref6 empsp3 empsp4 partid3 partid6. *code remaining variables for father-in-law/mother-in-law. freq r9a1 r9a2 r9a3 r9a4 r9a5 r9a6 r9a7 r9a8 r9a9 r9a10. *5 mothers-in-law, 2 fathers-in-law. do if r9a1=11 or r9a1=12. compute relref2=7. Else if hldid=20532. compute relref3=7. compute relref4=7. compute civsta3=1. compute civsta4=1. compute partid3=4. compute partid4=3. compute empsp3=empsta4. compute empsp4=empsta3. compute parnta2=3. compute parntb2=4. else if hldid=40627. compute relref6=7. compute relref7=7. compute civsta6=1. compute civsta7=1. compute partid6=7. compute partid7=6. compute empsp6=empsta7. compute empsp7=empsta6. compute parnta2=6. compute parntb2=7. end if. freq relref2 relref3 relref4 relref6 relref7 partid6 partid7. *code remaining variables for brother-in-law/sister-in-law. freq r9a1 r9a2 r9a3 r9a4 r9a5 r9a6 r9a7 r9a8 r9a9 r9a10. do if hldid=11175. compute relref2=8. compute civsta2=1. compute civsta3=1. compute partid2=3. compute partid3=2. compute empsp2=empsta3. compute empsp3=empsta2. else if hldid=10149 or hldid=30133. compute relref3=8. compute civsta2=1. compute civsta3=1. compute partid2=3. compute partid3=2. compute empsp2=empsta3. compute empsp3=empsta2. else if r9a2=7. compute relref3=8. else if hldid=50820. compute relref4=8. compute civsta3=1. compute civsta4=1. compute partid3=4. compute partid4=3. compute empsp3=empsta4. compute empsp4=empsta3. else if hldid=30726 or hldid=20601. compute relref4=8. else if hldid=60891 or hldid=50681. compute relref5=8. compute civsta4=1. compute civsta5=1. compute partid4=5. compute partid5=4. compute empsp4=empsta5. compute empsp5=empsta4. else if r9a4=7. compute relref5=8. end if. freq relref2 relref3 relref4 relref5. *code remaining variables for other relatives. do if r9a1>16 and r9a1<23. compute relref2=9. end if. do if r9a2>16 and r9a2<23. compute relref3=9. end if. do if r9a3>16 and r9a3<23. compute relref4=9. end if. do if r9a4>16 and r9a4<23. compute relref5=9. end if. do if r9a5>16 and r9a5<23. compute relref6=9. end if. do if r9a6>16 and r9a6<23. compute relref7=9. end if. do if r9a7>16 and r9a7<23. compute relref8=9. end if. do if r9a8>16 and r9a8<23. compute relref9=9. end if. do if r9a9>16 and r9a9<23. compute relref10=9. end if. do if r9a10>16 and r9a10<23. compute relref11=9. end if. freq relref2 relref3 relref4 relref5 relref6 relref7 relref8 relref9 relref10 relref11. *code remaining variables for people who are not related to the reference person. do if r9a1>22 and r9a1<77. compute relref2=10. end if. do if r9a2>22 and r9a2<77. compute relref3=10. end if. do if r9a3>22 and r9a3<77. compute relref4=10. end if. do if r9a4>22 and r9a4<77. compute relref5=10. end if. do if r9a5>22 and r9a5<77. compute relref6=10. end if. do if r9a6>22 and r9a6<77. compute relref7=10. end if. do if r9a7>22 and r9a7<77. compute relref8=10. end if. do if r9a8>22 and r9a8<77. compute relref9=10. end if. do if r9a9>22 and r9a9<77. compute relref10=10. end if. do if r9a10>22 and r9a10<77. compute relref11=10. end if. freq relref2 relref3 relref4 relref5 relref6 relref7 relref8 relref9 relref10 relref11. *this diarist is a single father who has his children on weekends. if hldid=40672 singpa3=1. sort cases by hldid. vector sex=sex1 to sex11 /age=age1 to age11 /singpa=singpa1 to singpa11 /relref=relref1 to relref11 /empsta=empsta1 to empsta11 /workhr=workhr1 to workhr11 /empinc=empinc1 to empinc11 /rushed=rushed1 to rushed11 /parnta=parnta1 to parnta11 /parntb=parntb1 to parntb11 /partid=partid1 to partid11 /cohab=cohab1 to cohab11 /empsp=empsp1 to empsp11 /health=health1 to health11 /unemp=unemp1 to unemp11 /cphome=cphome1 to cphome11 /studen=studen1 to studen11 /retire=retire1 to retire11 /disab=disab1 to disab11 /civsta=civsta1 to civsta11. loop i=1 to 11. compute countrya=countrya. compute survey=survey. compute swave=swave. compute hldid=hldid. compute persid=i. compute sex=sex(i). compute age=age(i). compute singpar=singpa(i). compute relrefp=relref(i). compute empstat=empsta(i). compute workhrs=workhr(i). compute empinclm=empinc(i). compute rushed=rushed(i). compute parntid1=parnta(i). compute parntid2=parntb(i). compute partid=partid(i). compute cohab=cohab(i). compute empsp=empsp(i). compute health=health(i). compute unemp=unemp(i). compute cphome=cphome(i). compute student=studen(i). compute retired=retire(i). compute disab=disab(i). compute civstat=civsta(i). compute nodiary=nodiary. compute diary=diary. xsave outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87i.sav' /keep = countrya survey swave hldid persid sex age singpar relrefp empstat workhrs empinclm rushed parntid1 parntid2 partid cohab empsp health unemp cphome student retired disab civstat diary nodiary. end loop. execute. get file='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\kacqe.sav' /keep qno v40a v40b v40c v40d v40e v40f v40g v40h v40i v40j v40k v40l v40m v40n v40o v40p v40q v40r v40s v40t v40u v40v v40w v41 v42 v43 v46 v89a v89b v89c v89d v89e v89f v89g v89h v89i v89j v89k v89l v89m v89n v89o v89p v89q v89r v89s v89t v89u v89v v89w v90 v91 v92a v92b v92c v92d v93 v94 v95 v165 ethnic jhgclass jhggroup. rename variables (qno=hldid). compute countrya=37. compute survey=1987. freq v165. recode v165 (1 thru 4=1) (5,6=0) (else=-8) into citizen. freq citizen. rename variables (ethnic=eth). execute. recode eth (1=1) (2=3) (3=2) (76=4) (else=-8) into ethnic. val lab ethnic -9 not possible to create -8 missing -7 not asked 1 white 2 black 3 "Indian/Pakistani/Bangladeshi" 4 other and mixed race. cro ethnic by eth. compute educa=-8. cro v89a by v89b v89c v89d v89e v89f v89g v89h v89i v89j v89k v89l v89m v89n v89o v89p v89q v89r v89s v89t v89u v89v. Do if v89a=0. compute educa=1. Else if v89r=1. compute educa=21. Else if v89k=1. compute educa=20. Else if v89p=1. compute educa=19. Else if v89o=1. compute educa=18. Else if v89t=1. compute educa=17. Else if v89j=1. compute educa=16. Else if v89v=1. compute educa=15. End if. Do if educa=-8 and v89s=1. compute educa=14. Else if educa=-8 and v89n=1. compute educa=13. Else if educa=-8 and v89m=1. compute educa=12. Else if educa=-8 and v89l=1. compute educa=11. Else if educa=-8 and v89i=1. compute educa=10. Else if educa=-8 and v89h=1. compute educa=9. Else if educa=-8 and v89g=1. compute educa=8. Else if educa=-8 and v89f=1. compute educa=7. Else if educa=-8 and (v89u=1 or v89q=1). compute educa=6. Else if educa=-8 and v89e=1. compute educa=5. Else if educa=-8 and v89d=1. compute educa=4. Else if educa=-8 and v89c=1. compute educa=3. Else if educa=-8 and v89b=1. compute educa=2. end if. val lab educa -8 missing -7 not asked 0 child in school 1 no qualifications, adult 2 'CSE, not 1 England & Wales' 3 'O-Level, CSE, SCM' 4 'GCSE A-Level' 5 'SCE-O or lowers Scotland' 6 other non-significant qualification 7 'Scottish Higher' 8 certificate of 6th year of study 9 City & Guilds 10 ONC, OND, SNC, SND 11 Scottish Vec national certificate 12 Scottish BEC TEC cert CD 13 clerical or commercial qualification 14 apprenticeship 15 significant other qualification 16 HNC, HND, SHNC, SHND 17 professional qualification, no exam 18 teaching degree 19 nursing degree 20 university certificate or diploma 21 university degree. freq educa. Do if educa=-8 and v40r=1. compute educa=21. Else if educa=-8 and v40k=1. compute educa=20. Else if educa=-8 and v40o=1. compute educa=19. Else if educa=-8 and v40p=1. compute educa=18. Else if educa=-8 and v40t=1. compute educa=17. Else if educa=-8 and v40j=1. compute educa=16. Else if educa=-8 and v40v=1. compute educa=15. End if. execute. Do if educa=-8 and v40s=1. compute educa=14. Else if educa=-8 and v40n=1. compute educa=13. Else if educa=-8 and v40m=1. compute educa=12. Else if educa=-8 and v40l=1. compute educa=11. Else if educa=-8 and v40i=1. compute educa=10. Else if educa=-8 and v40h=1. compute educa=9. Else if educa=-8 and v40g=1. compute educa=8. Else if educa=-8 and v40f=1. compute educa=7. Else if educa=-8 and (v40u=1 or v40w=1). compute educa=6. Else if educa=-8 and v40e=1. compute educa=5. Else if educa=-8 and v40d=1. compute educa=4. Else if educa=-8 and v40c=1. compute educa=3. Else if educa=-8 and v40b=1. compute educa=2. Else if educa=-8 and v40a=1. compute educa=1. End if. freq educa. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\educ.sav' /keep countrya survey hldid ethnic citizen educa. *put household and person level variables together. match files table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\urban.sav' table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87h.sav' table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\educ.sav' file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87i.sav' /BY countrya survey hldid. freq sex. *remove cases that are not persons in the household but are merely row cases *generated by the process of extracting the individual level data from *the household level file. select if persid le hhldsize. freq sex. *the one person who sex remains unknown is not a diarist. recode empstat (1,2,3=1) (4=0) (-8=-8) into emp. cro emp by empstat. Do if nchild=0 and (age>17 and age<40). compute famstat=0. Else if nchild=0 and age>39. compute famstat=3. Else if agekidx=1 and age>17. compute famstat=1. Else if (agekidx=2 or agekidx=3) and age>17. compute famstat=2. Else if (age>-1 and age<18) and parntid1>-7. compute famstat=4. Else if (age>-1 and age<18) and parntid1=-7. compute famstat=5. End if. cro famstat by nchild agekidx parntid1. compute young=99. if agekidx=4 and (relrefp=3 or relrefp=5) young=age. aggregate outfile=* mode=addvariables /break hldid /ageyoung=MIN(young). temp. select if agekidx=4 and agekid2~=ageyoung. cro agekid2 by ageyoung. freq agekid2. if agekidx=4 and ageyoung1 or relrefp<1. compute educa=-7. compute ethnic=-7. if relrefp~=3 citizen=-7. if relrefp=3 and citizen=0 citizen=-7. End if. cro educa ethnic citizen by relrefp. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87dem.sav' /keep countrya survey swave msamp hldid persid parntid1 parntid2 partid year 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 rushed health disab disab region aglftsch ethnic diary nodiary. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87dem.sav'. compute agegp=1. if age<20 agegp=0. if age>24 and age<30 agegp=2. if age>29 and age<35 agegp=3. if age>34 and age<40 agegp=4. if age>39 and age<45 agegp=5. if age>44 and age<50 agegp=6. if age>49 and age<55 agegp=7. if age>54 and age<62 agegp=8. if age>61 agegp=9. val lab agegp 0 14-19 1 20-24 2 25-29 3 30-34 4 35-39 5 40-44 6 45-49 7 50-54 8 55-61 9 62 and older. crosstabs /tables=agegp by sex /format=avalue tables /cells=count row /count round cell. *work on diary data. begin making MTUS basics get file='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\KDIARYT.SAV'. compute countrya=37. compute survey=1987. compute swave=0. rename variables (hhid=hldid). sort cases by hldid persid realday startslt. means hldid by town /cells min max mean. *10000 range Aberdeen *20000 range Coventry *30000 range Kirkcaldy *40000 range Northampton *50000 range Rochdale *60000 range Swindon. *fix match errors, identified as impossible matches with the person to whom they match now. No *very young children kept diaries. Some clear cases of FT working spouse matched to diaries of *non-working partner. Do if hldid=11182 or hldid=11283 or hldid=40146 or hldid=40305 or hldid=40996 or hldid=60042 or hldid=60190. recode persid (1=2) (2=1). End if. Do if hldid=40554 or hldid=30006. recode persid (2=3) (3=2). End if. Do if hldid=40394. recode persid (2=4) (3=2) (4=3). End if. Do if hldid=40554. recode persid (1=2) (2=3) (3=1). End if. if hldid=60721 and persid=1 and whowith1=1 whowith1=-5. if hldid=60721 and persid=1 and whowith2=2 whowith2=-5. execute. *the original diary files contain a vast array of errors. 45 sets of diaries do not map to *other files. Additionally there are many entry errors with missing episodes or misentered *starting or stopping times. All these are fixed where possible. *first stage corrections - the easy non-matching diary cases. *conveniently each of the 6 regions has a different range of hldid codes, so we are easily able *to search for the diarist-level details within the correct survey area. *two households have 4 members, one diary shifted out of position in the personal detail columns, *but all 4 completed diaries; also 3 housholds of 3 members with a number out of position in *these cases the last person's person number is 1 higher than the total number of people living *in the household. *first stage corrections boost total background to diary matches to 1668, leaving 38 unmatched *diary sets. Do if hldid=10011 or hldid=11128 or hldid=10062 or hldid=30039 or hldid=40471. recode persid (4=3) (5=4). End if. execute. *one unallocated set of diaries in Northampton - 40707. Diaries from a p1 and p4. Diarist 1 spend time with partner, *adult household child, does no study, paid work or child care, does a lot of gardening, time with animals, shopping, *housework and vehicle maintenance. Diarist 4 spend time with parents & friends, does loads of paid work but no study, *loads of time dancing and socialising. Initially look at households with a couple and adult children, p1 & p4 not *match to diaries and do match basic characteristics suggested by these diaries. *hldid=40672 is two mid-30s brothers who live with retired mother. 2nd brother reported as *having completed diaries and working long hours; diary file contains diary from hhldid=40673 *from a person working long hours who spend time with mother and sibling at home. There is *no household 40673 in the grid reference, assume household id entry error for this diary set. recode hldid (40673=40672). *hldid=50068 is a 2 person household, an unemployed older single mother and her 18-year-old *student daughter. There is a diary from hldid 50068 supposedly from person 3. This diary is *from a person who performs a lot of domestic production and inexpensive indoor leisure but no *study and spends time with their child. Assume these diaries are the mother in this household *and that the person number is entered in error. if hldid=50068 persid=1. *hldid=20903 does not exist in other SCELI files, but this diarist does a lot of domestic work, *spends time with spouse, child, friendsa and work colleaues, and this number is 3 away from *hldid=20906 where the diary of a woman who works part time and lives with her spouse and child *is missing. Assume 20903 should be 20906. recode hldid (20903=20906). *hldid=20920 does not exist in other SCELI diary files. There are 4 diaries, 2 sets from working people *in a couple who spend time with each other and with adult household children, and 2 sets of adult *household children who spend time with a sibling and their parents. All work long hours. hldid= *20919 is a 4 person household with a couple and two adult children who all work full time and who all *completed diaries that are missing. Assuming this is another household id miscode. recode hldid (20920=20919). *hldid=50240 does not exist in other SCELI diary files, but diarist does more unpaid domestic production *than paid work, spends time with spouse, own children friends and and work colleagues; diary from a *woman who works part time and lives with spouse and child in hldid=50246 missing, assume miscoded hldid. recode hldid (50240=50246). *hldid=50250 does not exist in other SCELI diary files, but diarist does much paid work and some domestic *production, and spends time with work colleagues, spouse and own children. Diary from man living with *spouse and children working full time in hldid=50258 missing, assume a miscoded hldid. recode hldid (50250=50258). *end of most obvious errors. *40207 is a household where two of 4 sets of diaries are accounted, the demographic profiles match *and there is reasonable correspondence in the activities by time of day, and while the who else is *present do not completely align there are no clear contradictions. recode hldid (40707=40207). *households in Rochdale which meet profile suggested by diaries and have household numbers that *are a close match in one case and an anagram of the number of a household which fits the *right characteristics implied by the diaries. recode hldid (50528=50328) (50781=50817). *hldid 50736/persid=1 diaries do not map to demographics. These diaries are from a woman in a couple *who has access to a car, whose spouse leaves early on week days, who does not perform child care *and who interacts with her parents and siblings, looks after a pet and does sufficient leisure *shopping to imply that her household is not poor. I selected households that include a couple & a car, *where the diarist is a woman, not a child and person 1. This produces 13 potential cases. In 7 of *these cases (hldid=50006, 50622, 50647, 50701, 50761, 50980, and 51003) the household is recorded *as having refused to accept diaries. Some households recorded as having refused all did in fact *return diaries, but this group is small. There is one diarist of the remaining 6 (50207, *50213, 50290, 50549, 50734, 50820, 51003) whose household number is close - this person has an *18-year-old child living in the home and spends no time with this child, which is suspicious, *though also possible. One of these six households includes two retired people in the couple, and *two of these potential diarists report having disabilities, which may mean that these three possible *people are unlikely to be the diarist in question. We match these diaries to the person whose *household number is close to the household number of one of the other potential diarists. recode hldid (50736=50734). *one diarist in Rochdale is coded as household id=55555 and person id=8. This combination does not *exist and these diaries had no household or person identifier attached. The diaries were completed *by a woman in a couple who has children, a paid job, does both child and adult care, drives, and *has a pet. There are 25 potential matches. Four of these are in households recorded as having *refused to accept diaries (50065, 50346, 50613, 50990). Assume these are not this diarist. Three, *50258, 50489, 50704, are households where other people completed diaries. We checked these other *diaries, but their activity reports do not match with the unallocated diarist. The child activities *suggest the children of this diarist are older. We eliminte housholds with very young children *50223, 50325, 50340, 50385, 50400, 50411, 50444, 50571. Eliminate household 50602 where *parents live in household as diarist interacts with parents in their home (coded as other home and *there is travel to and from this other home to the diarist's own home). The mystery diarist appears *to work short hours at multiple jobs (by the codes chosen for the jobs). 7 of remaining 9 potential *diarists work full-time in 1 job: 50170, 50196, 50286, 50491, 50513, 50540, 50602. This leaves 2 *cases, 50200 lives with a disability and in a household with a computer. No obvious sign of disability, *and the mystery diarist is a carer of people living in other households. Also, this diarist does not *report using a computer. Assume the remaining case is match. Do if hldid=55555. compute hldid=50280. compute persid=2. End if. *this diary from Swindon is from a woman with young children in a couple in a household with a car. *loads of housework and care of very young child, including medical care, no sign of work, study, *pet or computer. Eliminating cases that returned diaries, households where all refused diaries, *where the youngest child is aged >5, where the diarist works more than minimal hours, and that *have no car, where the diarist in couple and the spouse works. This case coded as person 1. *4 possibilities, 60118, 60205, 60724, 60909. All have household type=3, household size=3, *husband works full-time, child aged 1 or 2, income band 3, own home, 1 vehicle, aged 26-31, *rushed=2. One of 4 works part-time and lives in a ousehold with a computer (60205) - assume *that this is not this missing household. Take most likely hldid, but then reset the variables *that differ across these cases to missing. recode hldid (60196=60909). *this diarist from Swindon female, in couple, with children but likely not very young children *as child care minimal and not intensive, pet care, household has car, no sign of work, study, *computer. Person number 1. Child interactions suggest kids not late teens or older. 12 possible *matches: 60032, 60272, 60357, 60412, 60468, 60528, 60559, 60622, 60640, 60828, 60942, 61013. *much diversity between these cases, though none are students, cohabitting, or retired. 61013 *has unemployed diarists with non-working spouse. 60942 disabled with non-working spouse. All *others have employed spouse, FT in all but 60528 where spouse hours of work unknown, though as *this is a high income household, most likely that spouse does indeed work FT as wife in this *household not working. 60528 and 61013 do not have a computer, all other households do have a *computer. 60942, 61013, and 60412 rent, while others own their home. Not impossible but hard *to rent with pets in the UK. The wife in 60828 works full time but did not work during the diary *week. As this case has a close household number, code to this number. recode hldid (60627=60828). *This woman in Swindon (person 1) is in a couple, has older household children, has a car and works. *5 possible matches - all aged 40-51, spouse working, married (not cohabitting) and all own home: *60204 60484 60745 60791 60985. The latter is disabled and in poor health. No indication this is the *latter diarist. We make an assignment, but then set a number of values to missing in the MTUS file. recode hldid (68888=60745). *Swindon male in couple, maintains car, older children, works and studies, person 1. 3 possible *candidates, one diabled and low income so less likely (60978), options 60562 or 60753. recode hldid (67777=60753). *note that Aberdeen has a whole group of diaries with no match whose hldids have not relationship *to the main survey. *Aberdeen household, woman (p1) with older children who works, spend holiday on boat while children stayed *with relatives and studied as well as went to school. one of children p3. Household has a car and a computer. *only one household not matching to diaries matches these characteristics. recode hldid (10180=11371). *household in Aberdeen, person 1, she is a mother, not in couple with car, has an older child who is *a young person (p2), works long hours. Person 2 lives with a parent. Only one household without diaries matches the characteristics. recode hldid (10686=11486). *Aberdeen single mother with a very young child when spends a lot of time with parents, no work, * no computing and no car. 3 candidate households, 10095 (single mother and 2 children); 10374 * single mother, 1 child, parent & others, 11074 single mother and one child. All rent accommodation, * aged 20-30. 10374 works FT. The other two are unemployed. 10095 has a disability. Go with latter, *close in number to false hldid. recode hldid (14741=11074). *Aberdeen, two single young people, both work long hours, one reports being with sibling at home, *both drive. Person numbers 1 & 2. Only one household which completed diaries that do not match to *the diary files matches these criteria. recode hldid (15499=10234). *Aberdeen family with couple and an older child - child likely young adult on account of study, paid *work, still lives with parents, night life. Family has a car, no sign of a computer, couple both *work, all exercise significantly, person 1 wife, person 2 husband, person 3 child, most likely male. *only 1 household that completed diaries for which there are no matches meets these criteria. recode hldid (16410=11335). *Aberdeen family, couple, no children, he works, she may not work. Person 1 is male and person 2 *female. This couple has pets. A few odd instances of the man driving to work with household child, *but no other entry suggests this household has children, so these entries treated as errors to *correct. Only one household that completed diaries that do not match to the demographic files *meets these criteria. if hldid=16618 and persid=1 and whowith1=2 whowith1=1. execute. recode hldid (16618=11439). *Aberdeen family, couple with very young child, she may not work or work very part-time, he *works long hours. Household has a car. No evidence of a computer. 3 households potentially *map, 11533 (both unemployed and household has a computer - he works a lot in these diaries *and no sign of computer); 10335 & 10176 - both these case are hhtype=3, age youngest child=4, *rent homes, do not use a computer, aged 28-32, she works short hours, he works full-time, *both couples are married (not cohabitting), not students and not retired. In one couple, the *wife is disabled and in poor health. Many 3 acts at the same time and yoga in the diaries. *We opt for non-disabled diarist wife. recode hldid (18790=10176). *Aberdeen family, couple, no children, she does a lot of housework and adult care, no sign of *paid work. She is person 2. Two possibilities, 10038 and 10389, the second works full-time, *assume this is not this diarist. Also, these same two households are the only possibilities *for a diary by a husband - his diaries report times with a wife which do not match the diaries *from the wife. In hldid=10038, he does not work - loads of paid work in diaries, put him in *other household. recode hldid (19696=10038). recode hldid (19695=10389). *this leaves just one case, 50296 and person 3. There is no person 3 in this household, but this *household (50296) consists of a full-time employed daughter living with her unemployed father. *Both father and daughter in household 50296 are not in couples. The diarists 1 & 2 in this *household in the diary file clearly are an unemployed couple who live with their children, and *the third set of diaries are from a young person living with her/his parents. The mother does *child care, and the young person does some activity suggesting unemployment. Person 1 is the *father, and the father engages in many activities associated with unemployment. One household *missing diaries fits these characteristics. recode hldid (50296=50338). execute. *note that later in this programme, the variables where there are diverse replies between *the possible candidates for the diarists are reset to missing. *now deal with the many blank cells in the file - this is necessary to mark some duplicate *entries later so that these can be removed. recode firstact second third fourth whowith1 whowith2 whowith3 location (sysmis=-5). *compute episode file variables. *initial aggregation summing time reveals many problem diaries, 4 with too little time, *over 50 with too much time. *this case has a miscode on the final end time. This person has a full day and ends up asleep *at home. Highly unlikely there is a missing 15 minute activity after which this person was *again asleep at home. if hldid=50897 and persid=1 and realday=2 and startslt=81 endslt=96. execute. *other diaries with too little time are missing episodes. Some cases of too much time *have extra episodes of no activity inserted into the diaries. Transform extra episodes *to fill the missing gaps. In this case a person who spends 15 minutes to get up or *get ready for bed apparently spends many hours at the end of the day getting ready *for bed but not sleeping. Transform the majority of this final episode to sleep using *a non-espiode of missing time inserted in another diary. if hldid=20723 and persid=1 and realday=2 and startslt=74 endslt=74. if hldid=20723 and persid=1 and realday=3 and startslt=27 endslt=61. Do if hldid=50699 and persid=3 and realday=4 and startslt=1 and endslt=96. compute hldid=20723. compute persid=1. compute realday=2. compute startslt=75. compute firstact=1601. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=1. compute whowith2=-5. compute whowith3=-5. compute location=1. compute actdesc='sleep'. compute dayno=6. compute startday=4. compute header=0. compute town=2. End if. Do if hldid=50068 and persid=1 and realday=1 and startslt=1 and endslt=14 and whowith3=-5. compute hldid=20723. compute persid=1. compute realday=3. compute startslt=62. compute endslt=65. compute firstact=1702. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=1. compute whowith2=-5. compute whowith3=-5. compute location=36. compute actdesc='Away Leis'. compute dayno=7. compute startday=4. compute header=0. compute town=2. End if. execute. Do if hldid=10066 and persid=1 and realday=1 and startslt=17 and endslt=17. compute hldid=20723. compute persid=1. compute realday=3. compute startslt=66. compute endslt=67. compute firstact=1704. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=1. compute whowith2=-5. compute whowith3=-5. compute location=1. compute actdesc='arrived home'. compute dayno=7. compute startday=4. compute header=0. compute town=2. End if. Do if hldid=10066 and persid=1 and realday=1 and startslt=18 and endslt=18. compute hldid=20723. compute persid=1. compute realday=3. compute startslt=68. compute endslt=72. compute firstact=9999. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=-5. compute whowith2=-5. compute whowith3=-5. compute location=1. compute actdesc='missing'. compute dayno=7. compute startday=4. compute header=0. compute town=2. End if. Do if hldid=60148 and persid=1 and realday=7 and startslt=12. compute hldid=20723. compute persid=1. compute realday=3. compute startslt=73. compute endslt=74. compute firstact=1302. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=1. compute whowith2=-5. compute whowith3=-5. compute location=1. compute actdesc='Pers care'. compute dayno=7. compute startday=4. compute header=0. compute town=2. End if. Do if hldid=11207 and persid=1 and realday=5 and startslt=17. compute hldid=20723. compute persid=1. compute realday=3. compute startslt=75. compute endslt=96. compute firstact=1601. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=1. compute whowith2=-5. compute whowith3=-5. compute location=1. compute actdesc='sleep'. compute dayno=7. compute startday=4. compute header=0. compute town=2. End if. Do if hldid=10066 and persid=1 and realday=1 and startslt=20 and endslt=24. compute hldid=30877. compute persid=2. compute realday=7. compute startslt=76. compute endslt=96. compute firstact=1601. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=1. compute whowith2=-5. compute whowith3=-5. compute location=1. compute actdesc='sleep'. compute dayno=7. compute startday=1. compute header=0. compute town=3. End if. Do if hldid=10066 and persid=1 and realday=1 and startslt=25 and endslt=37. compute hldid=50026. compute persid=1. compute realday=1. compute startslt=70. compute endslt=71. compute firstact=1702. compute second=-5. compute third=-5. compute fourth=-5. compute whowith1=17. compute whowith2=19. compute whowith3=-5. compute location=36. compute actdesc='Home Leis'. compute dayno=3. compute startday=6. compute header=0. compute town=5. End if. Do if hldid=10066 and persid=1 and realday=1 and startslt=48 and endslt=57. compute hldid=50026. compute persid=1. compute realday=1. compute startslt=72. compute endslt=73. compute firstact=1704. compute second=0. compute third=0. compute fourth=0. compute whowith1=0. compute whowith2=0. compute whowith3=0. compute location=1. compute actdesc='Dom Work'. compute dayno=3. compute startday=6. compute header=0. compute town=5. End if. Do if hldid=10066 and persid=1 and realday=1 and startslt=62 and endslt=62 and firstact=1301. compute hldid=50026. compute persid=1. compute realday=1. compute startslt=74. compute endslt=77. compute firstact=9999. compute second=0. compute third=0. compute fourth=0. compute whowith1=0. compute whowith2=0. compute whowith3=0. compute location=1. compute actdesc='missing'. compute dayno=3. compute startday=6. compute header=0. compute town=5. End if. sort cases by hldid persid realday startslt. *these cases have misindentified time codes. Fix these. if hldid=10066 and persid=1 and realday=1 and startslt=38 and firstact=1501 endslt=38. if hldid=10066 and persid=1 and realday=1 and endslt=39 and firstact=103 startslt=39. if hldid=10066 and persid=1 and realday=1 and startslt=49 and endslt=59 endslt=57. if hldid=60071 and persid=2 and realday=6 and startslt=1 endslt=16. if hldid=60448 and persid=1 and realday=6 and startslt=50 startslt=51. if hldid=60347 and persid=1 and realday=4 and startslt=45 endslt=52. if hldid=20835 and persid=2 and realday=3 and startslt=25 endslt=32. if hldid=40790 and persid=1 and realday=6 and startslt=45 endslt=50. if hldid=60347 and persid=1 and realday=1 and startslt=32 endslt=36. if hldid=20185 and persid=2 and realday=4 and startslt=67 endslt=70. if hldid=40061 and persid=1 and realday=7 and startslt=1 endslt=26. if hldid=40061 and persid=1 and realday=7 and endslt=27 startslt=27. if hldid=60123 and persid=1 and realday=7 and startslt=25 endslt=28. if hldid=60534 and persid=1 and realday=4 and startslt=1 endslt=32. if hldid=60534 and persid=1 and realday=4 and startslt=33 location=1. if hldid=60534 and persid=1 and realday=4 and startslt=34 location=1. if hldid=60534 and persid=1 and realday=4 and startslt=35 location=1. if hldid=60534 and persid=1 and realday=4 and startslt=45 location=1. *this case has both problematic end times and missing activities. if hldid=60534 and persid=2 and realday=2 and startslt=50 endslt=51. Do if hldid=10066 and persid=1 and realday=1 and startslt=60 and firstact=104. compute hldid=60534. compute persid=2. compute realday=5. compute startslt=54. compute endslt=55. compute firstact=1704. compute second=0. compute third=0. compute fourth=0. compute whowith1=1. compute whowith2=0. compute whowith3=0. compute location=1. compute actdesc='Dom Work'. compute dayno=1. compute startday=5. compute header=0. compute town=6. End if. Do if hldid=10066 and persid=1 and realday=1 and startslt=67 and endslt=75. compute hldid=60534. compute persid=2. compute realday=5. compute startslt=56. compute endslt=60. compute firstact=9999. compute second=0. compute third=0. compute fourth=0. compute whowith1=1. compute whowith2=0. compute whowith3=0. compute location=1. compute actdesc='missing'. compute dayno=1. compute startday=5. compute header=0. compute town=6. End if. if hldid=60534 and persid=2 and realday=5 and endslt=67 startslt=61. sort cases by hldid persid realday startslt. *return to fixing misassinged start or end times. if hldid=60136 and persid=3 and realday=7 and startslt=1 endslt=36. if hldid=60136 and persid=3 and realday=7 and startslt=47 endslt=47. if hldid=10157 and persid=1 and realday=1 and startslt=24 endslt=27. if hldid=60534 and persid=2 and realday=5 and startslt=31 endslt=35. if hldid=30877 and persid=3 and realday=7 and startslt=76 endslt=77. if hldid=40109 and persid=1 and realday=7 and startslt=17 endslt=24. if hldid=50699 and persid=3 and realday=3 and startslt=36 endslt=38. if hldid=50699 and persid=3 and realday=3 and startslt=36 and third=2902 endslt=38. if hldid=50699 and persid=3 and realday=3 and endslt=39 and whowith2=35 startslt=39. if hldid=30877 and persid=3 and realday=7 and startslt=74 endslt=75. if hldid=30877 and persid=3 and realday=7 and startslt=76 second=3101. if hldid=40109 and persid=1 and realday=7 and startslt=44 endslt=47. if hldid=10066 and persid=1 and realday=1 and startslt=78 and third=707 startslt=79. if hldid=10066 and persid=1 and realday=2 and startslt=27 and endslt=27 and firstact=813 second=1702. if hldid=10066 and persid=1 and realday=2 and startslt=28 and second=3702 endslt=28. if hldid=10066 and persid=1 and realday=2 and startslt=28 and second=3701 startslt=29. if hldid=10066 and persid=1 and realday=2 and startslt=32 and firstact=104 endslt=32. if hldid=10066 and persid=1 and realday=2 and startslt=32 and firstact=101 startslt=33. if hldid=10066 and persid=1 and realday=2 and startslt=35 and firstact=1501 endslt=35. if hldid=10066 and persid=1 and realday=2 and startslt=35 and firstact=103 startslt=36. if hldid=10066 and persid=1 and realday=2 and startslt=53 and endslt=53 second=817. if hldid=10066 and persid=1 and realday=2 and startslt=69 and endslt=69 and firstact=104 second=704. Do if hldid=10066 and persid=1 and realday=2 and startslt=79 and endslt=79 and third=604. compute third=3601. compute second=604. compute firstact=3101. End if. Do if hldid=10066 and persid=1 and realday=2 and startslt=80 and endslt=82. compute startslt=81. compute endslt=81. End if. if hldid=10066 and persid=1 and realday=2 and startslt=81 and endslt=82 startslt=82. if hldid=10066 and persid=1 and realday=3 and startslt=19 and endslt=19 second=1001. if hldid=10066 and persid=1 and realday=3 and startslt=33 and endslt=34 and firstact=2801 endslt=33. if hldid=10066 and persid=1 and realday=3 and startslt=33 and endslt=34 and firstact=103 startslt=34. if hldid=10066 and persid=1 and realday=3 and startslt=59 and firstact=805 second=208. if hldid=10066 and persid=1 and realday=5 and startslt=67 firstact=2702. if hldid=10066 and persid=1 and realday=5 and startslt=67 second=3802. if hldid=10066 and persid=1 and realday=6 and startslt=21 and firstact=208 second=1301. if hldid=10066 and persid=1 and realday=6 and startslt=25 second=817. if hldid=10066 and persid=1 and realday=1 and startslt=78 endslt=79. if hldid=10066 and persid=1 and realday=6 and startslt=26 and firstact=104 second=1001. Do if hldid=10066 and persid=1 and realday=6 and startslt=33 and firstact=813. compute second=817. compute third=3701. compute whowith2=27. End if. Do if hldid=10066 and persid=1 and realday=7 and startslt=37 and endslt=50. compute startslt=38. compute endslt=38. End if. if hldid=10066 and persid=1 and realday=7 and startslt=38 and endslt=50 startslt=39. Do if hldid=10066 and persid=1 and realday=7 and startslt=51 and endslt=56. compute startslt=52. compute endslt=52. End if. if hldid=10066 and persid=1 and realday=7 and startslt=52 and endslt=56 startslt=53. if hldid=10066 and persid=1 and realday=7 and startslt=57 and firstact=706 second=704. if hldid=10066 and persid=1 and realday=7 and startslt=75 and endslt=76 startslt=76. if hldid=10066 and persid=1 and realday=7 and startslt=77 and endslt=78 startslt=78. if hldid=10066 and persid=2 and realday=1 and startslt=16 and second=707 third=704. if hldid=10066 and persid=2 and realday=1 and startslt=41 and endslt=43 whowith2=33. Do if hldid=10066 and persid=2 and realday=1 and startslt=65 and endslt=79. compute startslt=66. compute endslt=66. End if. if hldid=10066 and persid=2 and realday=1 and startslt=66 and endslt=79 startslt=67. if hldid=10066 and persid=2 and realday=2 and startslt=53 and whowith2=21 second=3701. if hldid=10066 and persid=2 and realday=2 and startslt=69 and second=813 whowith1=1. if hldid=10066 and persid=2 and realday=2 and startslt=71 and firstact=707 second=704. if hldid=10066 and persid=2 and realday=3 and startslt=18 and third=807 whowith1=1. if hldid=10066 and persid=2 and realday=3 and startslt=54 and firstact=707 endslt=55. if hldid=10066 and persid=2 and realday=3 and startslt=54 and firstact=704 startslt=56. if hldid=10066 and persid=2 and realday=3 and startslt=62 and firstact=707 endslt=62. if hldid=10066 and persid=2 and realday=3 and startslt=62 and firstact=704 startslt=63. if hldid=10066 and persid=2 and realday=3 and startslt=65 and firstact=707 second=704. if hldid=10066 and persid=2 and realday=5 and startslt=17 and firstact=816 firstact=806. if hldid=10066 and persid=2 and realday=5 and startslt=41 and endslt=53 whowith1=21. Do if hldid=10066 and persid=2 and realday=5 and startslt=77 and endslt=80. compute startslt=78. compute endslt=78. End if. if hldid=10066 and persid=2 and realday=5 and startslt=78 and endslt=80 startslt=79. if hldid=10066 and persid=2 and realday=6 and startslt=42 and second>0 whowith1=0. if hldid=10066 and persid=2 and realday=6 and startslt=61 and firstact=707 endslt=61. if hldid=10066 and persid=2 and realday=6 and startslt=61 and firstact=704 startslt=62. if hldid=10066 and persid=2 and realday=6 and startslt=63 and whowith1=19 whowith2=20. if hldid=10066 and persid=2 and realday=6 and startslt=65 and firstact=1702 second=1704. if hldid=10066 and persid=2 and realday=6 and startslt=80 and firstact=3101 endslt=80. if hldid=10066 and persid=2 and realday=6 and startslt=80 and firstact=1602 startslt=81. Do if hldid=50699 and persid=3 and realday=3 and startslt=36 and whowith3=-5. compute startslt=39. compute endslt=39. End if. execute. *a large number of cases with duplicated row cases. remove these. compute drop=0. if hldid=lag(hldid) and persid=lag(persid) and realday=lag(realday) and startslt=lag(startslt) and endslt=lag(endslt) and firstact=lag(firstact) and second=lag(second) and third=lag(third) and fourth=lag(fourth) and whowith1=lag(whowith1) and whowith2=lag(whowith2) and whowith3=lag(whowith3) and location=lag(location) drop=1. if hldid=lag(hldid) and persid=lag(persid) and realday=lag(realday) and startslt=lag(startslt) and endslt=lag(endslt) and firstact=lag(firstact) and second=-5 and lag(second)=0 drop=1. if hldid=lag(hldid) and persid=lag(persid) and realday=lag(realday) and startslt=lag(startslt) and endslt=lag(endslt) and firstact=lag(firstact) and second=lag(second) and third=-5 and lag(third)=0 drop=1. if hldid=lag(hldid) and persid=lag(persid) and realday=lag(realday) and startslt=lag(startslt) and endslt=lag(endslt) and firstact=lag(firstact) and second=lag(second) and third=lag(third) and fourth=-5 and lag(fourth)=0 drop=1. if hldid=10066 and persid=1 and realday=1 and startslt=76 and endslt=77 drop=1. if hldid=10066 and persid=1 and realday=7 and startslt=32 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=7 and startslt=36 and firstact=101 drop=1. if hldid=10066 and persid=1 and realday=1 and startslt=79 and endslt=79 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=1 and endslt=16 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=18 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=20 and endslt=24 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=25 and endslt=25 and firstact=3801 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=26 and endslt=26 and firstact=1202 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=27 and endslt=27 and firstact=1702 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=43 and endslt=45 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=46 and endslt=51 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=53 and endslt=54 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=55 and endslt=55 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=56 and endslt=56 and whowith2=-5 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=46 and endslt=51 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=63 and endslt=63 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=64 and endslt=68 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=69 and endslt=69 and firstact=704 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=70 and endslt=70 and firstact=704 drop=1. if hldid=10066 and persid=1 and realday=2 and startslt=79 and endslt=79 and third=-5 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=17 and endslt=17 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=19 and endslt=26 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=27 and lag(startslt)=27 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=28 and endslt=32 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=35 and endslt=36 and second=105 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=45 and endslt=55 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=57 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=58 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=59 and firstact=208 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=62 and endslt=66 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=67 and endslt=78 drop=1. if hldid=10066 and persid=1 and realday=3 and startslt=79 and endslt=83 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=1 and endslt=15 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=25 and endslt=26 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=40 and endslt=42 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=43 and endslt=48 and location=6 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=49 and firstact=505 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=50 and endslt=55 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=56 and endslt=56 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=63 and endslt=65 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=66 and endslt=73 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=74 and endslt=74 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=82 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=83 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=5 and startslt=86 and firstact=1704 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=20 and endslt=21 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=22 and firstact=1301 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=23 and firstact=1301 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=24 and endslt=25 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=26 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=29 and firstact=502 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=30 and firstact=3702 and location=1 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=31 and location=1 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=33 and firstact=817 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=34 and firstact=1702 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=35 and whowith1=0 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=40 and endslt=55 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=56 and endslt=57 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=58 and whowith1=-5 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=35 and whowith1=-5 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=65 and whowith1=18 drop=1. if hldid=10066 and persid=1 and realday=6 and startslt=68 and second=-5 drop=1. if hldid=10066 and persid=1 and realday=7 and startslt=57 and firstact=704 drop=1. if hldid=10066 and persid=1 and realday=7 and startslt=76 and firstact=3601 drop=1. if hldid=10066 and persid=1 and realday=7 and startslt=78 and endslt=84 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=16 and second=704 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=20 and endslt=23 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=24 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=39 and firstact=1702 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=41 and endslt=44 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=45 and whowith1=-5 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=60 and endslt=62 drop=1. if hldid=10066 and persid=2 and realday=1 and startslt=80 and endslt=96 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=15 and second=704 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=16 and third=813 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=18 and firstact=808 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=20 and endslt=31 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=35 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=36 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=37 and endslt=52 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=53 and whowith2=-5 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=54 and endslt=54 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=55 and endslt=55 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=56 and endslt=57 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=68 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=69 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=71 and firstact=704 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=74 and endslt=75 drop=1. if hldid=10066 and persid=2 and realday=2 and startslt=76 and endslt=78 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=18 and third=808 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=19 and whowith1=-5 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=20 and endslt=33 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=34 and endslt=35 and second=1909 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=36 and endslt=36 and second=1301 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=37 and endslt=51 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=57 and endslt=58 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=59 and endslt=59 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=60 and endslt=60 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=64 and firstact=3602 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=65 and firstact=704 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=68 and endslt=69 drop=1. if hldid=10066 and persid=2 and realday=3 and startslt=84 and firstact=1302 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=19 and location=1 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=20 and endslt=31 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=32 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=38 and firstact=103 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=42 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=54 and endslt=54 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=55 and endslt=57 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=63 and endslt=63 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=64 and endslt=69 drop=1. if hldid=10066 and persid=2 and realday=4 and startslt=76 and endslt=79 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=1 and endslt=14 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=15 and fourth>0 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=16 and fourth=-5 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=17 and firstact=1301 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=18 and firstact=502 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=19 and endslt=36 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=37 and endslt=40 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=41 and endslt=54 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=55 and whowith1=1 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=56 and second=1502 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=57 and third=-5 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=58 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=59 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=62 and endslt=67 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=69 and second=816 drop=1. if hldid=10066 and persid=2 and realday=5 and startslt=81 and endslt=82 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=24 and endslt=25 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=26 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=39 and endslt=40 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=41 and whowith2=-5 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=42 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=48 and endslt=51 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=63 and whowith2=20 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=65 and firstact=1704 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=66 and whowith1=0 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=68 and second=816 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=69 and whowith1=1 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=70 and endslt=72 drop=1. if hldid=10066 and persid=2 and realday=6 and startslt=83 and second=1601 drop=1. if hldid=10066 and persid=2 and realday=7 and startslt=1 and endslt=29 drop=1. if hldid=10066 and persid=2 and realday=7 and startslt=35 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=7 and startslt=36 and second=701 drop=1. if hldid=10066 and persid=2 and realday=7 and startslt=37 and second=901 drop=1. if hldid=10066 and persid=2 and realday=7 and startslt=38 and second=-5 drop=1. if hldid=10066 and persid=2 and realday=7 and startslt=41 and second=-5 drop=1. if hldid=50699 and persid=3 and realday=3 and startslt=40 and endslt=96 drop=1. select if drop=0. execute. *fix error in coding of day order. if hldid=60071 and persid=2 and realday=2 and startslt=79 dayno=6. execute. cro realday by startday. freq dayno. compute id=dayno. compute diary=dayno. freq realday. recode realday (7=1) (1=2) (2=3) (3=4) (4=5) (5=6) (6=7) into day. val lab day 1 Sunday 2 Monday 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday. cro realday by day. vector clockst(3) start(3) end(3) time(3) main(3) sec(3) av(3) inout(3) eloc(3) ict(3) mtrav(3) alone(3) child(3) sppart(3) oad(3). do repeat a=clockst2 to oad3. compute a=-5. end repeat. compute start1=0. if startslt>1 start1=(startslt-1)*15. compute end1=endslt*15. compute time1=end1-start1. aggregate outfile=* mode=addvariables /break hldid persid realday /tottime=SUM(time1). freq tottime. if startslt=1 clockst1=4.00. if startslt=2 clockst1=4.15. if startslt=3 clockst1=4.30. if startslt=4 clockst1=4.45. if startslt=5 clockst1=5.00. if startslt=6 clockst1=5.15. if startslt=7 clockst1=5.30. if startslt=8 clockst1=5.45. if startslt=9 clockst1=6.00. if startslt=10 clockst1=6.15. if startslt=11 clockst1=6.30. if startslt=12 clockst1=6.45. if startslt=13 clockst1=7.00. if startslt=14 clockst1=7.15. if startslt=15 clockst1=7.30. if startslt=16 clockst1=7.45. if startslt=17 clockst1=8.00. if startslt=18 clockst1=8.15. if startslt=19 clockst1=8.30. if startslt=20 clockst1=8.45. if startslt=21 clockst1=9.00. if startslt=22 clockst1=9.15. if startslt=23 clockst1=9.30. if startslt=24 clockst1=9.45. if startslt=25 clockst1=10.00. if startslt=26 clockst1=10.15. if startslt=27 clockst1=10.30. if startslt=28 clockst1=10.45. if startslt=29 clockst1=11.00. if startslt=30 clockst1=11.15. if startslt=31 clockst1=11.30. if startslt=32 clockst1=11.45. if startslt=33 clockst1=12.00. if startslt=34 clockst1=12.15. if startslt=35 clockst1=12.30. if startslt=36 clockst1=12.45. if startslt=37 clockst1=13.00. if startslt=38 clockst1=13.15. if startslt=39 clockst1=13.30. if startslt=40 clockst1=13.45. if startslt=41 clockst1=14.00. if startslt=42 clockst1=14.15. if startslt=43 clockst1=14.30. if startslt=44 clockst1=14.45. if startslt=45 clockst1=15.00. if startslt=46 clockst1=15.15. if startslt=47 clockst1=15.30. if startslt=48 clockst1=15.45. if startslt=49 clockst1=16.00. if startslt=50 clockst1=16.15. if startslt=51 clockst1=16.30. if startslt=52 clockst1=16.45. if startslt=53 clockst1=17.00. if startslt=54 clockst1=17.15. if startslt=55 clockst1=17.30. if startslt=56 clockst1=17.45. if startslt=57 clockst1=18.00. if startslt=58 clockst1=18.15. if startslt=59 clockst1=18.30. if startslt=60 clockst1=18.45. if startslt=61 clockst1=19.00. if startslt=62 clockst1=19.15. if startslt=63 clockst1=19.30. if startslt=64 clockst1=19.45. if startslt=65 clockst1=20.00. if startslt=66 clockst1=20.15. if startslt=67 clockst1=20.30. if startslt=68 clockst1=20.45. if startslt=69 clockst1=21.00. if startslt=70 clockst1=21.15. if startslt=71 clockst1=21.30. if startslt=72 clockst1=21.45. if startslt=73 clockst1=22.00. if startslt=74 clockst1=22.15. if startslt=75 clockst1=22.30. if startslt=76 clockst1=22.45. if startslt=77 clockst1=23.00. if startslt=78 clockst1=23.15. if startslt=79 clockst1=23.30. if startslt=80 clockst1=23.45. if startslt=81 clockst1=00.00. if startslt=82 clockst1=00.15. if startslt=83 clockst1=00.30. if startslt=84 clockst1=00.45. if startslt=85 clockst1=01.00. if startslt=86 clockst1=01.15. if startslt=87 clockst1=01.30. if startslt=88 clockst1=01.45. if startslt=89 clockst1=02.00. if startslt=90 clockst1=02.15. if startslt=91 clockst1=02.30. if startslt=92 clockst1=02.45. if startslt=93 clockst1=03.00. if startslt=94 clockst1=03.15. if startslt=95 clockst1=03.30. if startslt=96 clockst1=03.45. freq clockst1. *the original diaries enabled people to make up to 4 actvity entries. As MTUS *only has main and secondary activity, check into these additional activities *to decide how best to retain all additional details. freq fourth. *.03% of episodes are a fourth activity. *fix mystery codes and errors in the fourth activity. recode fourth (1305=1301). do if hldid=10381 and persid=2 and whowith2=-5 and whowith1>0 and (fourth>0 and fourth<99). compute whowith2=whowith1. compute whowith1=fourth. compute fourth=-5. Else if hldid=10381 and persid=2 and whowith1=-5 and (fourth>0 and fourth<99). compute whowith1=fourth. compute fourth=-5. End if. freq fourth. temp. select if fourth>99. freq firstact time1. *some non-sensible entries (doing nothing followed by many activities). Some *activities that look legititmate. Deal with this by separating episodes *into a 10 min and a 5 min episodes. *fix mystery codes and errors in the third activity. freq third. recode third (107=807) (123=-5) (371=3701) (606=605) (1012=1201). recode third (1307=1301) (2210=2201) (3010=3001) (3710=3701). freq third. *fix mystery codes and errors in the second activity. freq second. recode second (21, 128, 129, 370=-5) (36, 60=3604) (107=1107) (151=1501) (152=1502) (178=1802) (183=813) (310=3101) (368=3605) (369, 371=3701) (400=4010) (608=604) (1031, 1304, 1307, 1391=1301) (1410=1401) (1503, 1504=1502) (2210=2201) (2704=2701) (2903=2803) (3010=3001) (3104, 3110, 3191=3101) (3402, 3410=3401) (3704, 3710, 3791=3701) (3910=3901) (4070=4007) (4101=4010) (-8=-5) (6011, 6012=601) (6023=603) (8067=807) (8102=802). freq second. freq firstact. recode firstact (110=1101) (130=1301) (369=3601) (1009=1001) (999=9999) (4101=4010). Do if firstact=2704 and location=5. compute firstact=103. Else if firstact=2704. compute firstact=2701. End if. freq firstact. *look into mystery location codes. freq location. temp. select if location=45. freq firstact second. If (location<1 or location>44) and (firstact=502 or firstact=817 or firstact=1202 or firstact=1702 or firstact=1703 or second=502 or second=817 or second=1202 or second=1702 or second=1703 or firstact=1203 or firstact=1204 or second=1203 or second=1204) location=44. If (location<1 or location>44) and (firstact=1903 or firstact=1913 or second=1903 or second=1913) location=33. temp. select if location=46. freq firstact second. if hldid=40410 and persid=1 and realday=2 and (startslt>59 and startslt<66) location=25. if (location<1 or location>45) and (firstact=2701 or firstact=2702 or firstact=2703 or second=2701 or second=2702 or second=2703) location=23. if (location<1 or location>45) and (firstact=2801 or firstact=2802 or firstact=2803 or second=2801 or second=2802 or second=2803) location=28. if (location<1 or location>45) and (firstact=2901 or second=2901) location=3. execute. recode location (46=45). temp. select if location=51. freq firstact second. recode location (51=1). temp. select if location>45. freq firstact second. if (location<1 or location>45) and firstact=2402 location=27. if (location<1 or location>45) and firstact=1901 location=34. execute. recode location (46 thru hi=47). *sequences of events manually checked. if (hldid=10363 or hldid=20828 or hldid=40404 or hldid=40610 or hldid=40889 or hldid=40998 or hldid=50322 or hldid=60042 or hldid=60052) and location=47 location=1. if (hldid=30039) and location=47 location=5. Do if hldid=30477 and persid=1 and realday=6 and startslt=27. compute location=7. compute second=1202. End if. if (hldid=40158) and location=47 location=7. temp. select if location<1. freq firstact second. if location<1 and (firstact=401 or firstact=402 or second=401 or second=402) location=5. if location<1 and (firstact=503 or firstact=504 or firstact=505 or second=503 or second=504 or second=505 or firstact=1705 or firstact=1706 or second=1705 or second=1706) location=44. if location<1 and (firstact=1805 or second=1805) location=45. if location<1 and (firstact=1905 or second=1905 or firstact=2101 or second=2101) location=33. if location<1 and (firstact=1910 or second=1910 or firstact=1911 or second=1911) location=34. if location<1 and (firstact=1912 or second=1912) location=25. if firstact<9999 and location<1 and hldid=lag(hldid) and persid=lag(persid) and realday=lag(realday) and lag(location)=1 location=1. if location=0 and hldid=10162 location=5. if location<1 and (firstact=708 or firstact=806 or firstact=807 or firstact=1302 or firstact=1501 or firstact=1601 or firstact=1704 or firstact=3801) location=-3. execute. if hldid=10363 and persid=1 and realday=2 and (startslt=53 or startslt=54) location=5. if hldid=10371 and persid=3 and realday=6 and startslt=35 location=45. if hldid=20937 and persid=2 and realday=3 and startslt=35 location=5. if hldid=30477 and persid=2 and realday=4 and (startslt=39 or startslt=55) location=3. if hldid=40644 and persid=1 and realday=4 and (startslt=14 or startslt=16) location=5. if hldid=50020 and persid=2 and ((realday=1 and startslt>67) or (realday=2 and startslt>45) or (realday=7 and startslt>68)) location=1. if hldid=50078 and persid=4 and realday=5 and (startslt=53 or startslt=54) location=3. if hldid=50624 and persid=2 and realday=7 and startslt=48 location=18. if hldid=60052 and persid=1 and realday=5 and startslt=33 location=5. if hldid=60839 and persid=1 and realday=1 and (startslt<12 or startslt>79) location=1. if hldid=60839 and persid=1 and realday=7 and startslt>81 location=1. execute. recode location (-3=1). temp. select if location<1. freq firstact second. if location<1 and firstact<200 location=-3. execute. Do if (hldid=40620 and location=-3) or (hldid=40874 and persid=1 and location<1) or (hldid=50020 and persid=2 and realday=1 and startslt=14) or (hldid=50020 and persid=2 and realday=6 and startslt=50) or (hldid=60516 and persid=1 and realday=1 and startslt=36). compute location=5. Else if lag(location)=5 and location=-3. compute location=5. Else if location=-3. compute location=45. End if. if location<1 and firstact<9999 location=-3. execute. if location=-3 and startslt>1 and ((lag(location)>0 and lag(location)<10) or lag(location)=17 or lag(location)=18 or lag(location)=23 or lag(location)=29) location=lag(location). if (hldid=10224 or hldid=10315 or hldid=30161 or hldid=30168 or hldid=30173 or (hldid=30199 and persid=4 and realday=3 and startslt=46) or hldid=30412 or hldid=30459 or hldid=30551 or (hldid=30556 and persid=3 and realday=1 and startslt=35) or hldid=30928 or hldid=40093 or hldid=50039 or hldid=50627 or hldid=60121 or hldid=60604 or hldid=60743 or hldid=60817 or (hldid=60839 and (persid=2 and realday=7 and startslt=67) or (persid=3 and realday=5 and startslt=42))) and location=-3 location=1. Do if hldid=50219 and persid=2 and realday=5 and (startslt=55 or startslt=57). compute whowith2=15. compute location=3. End if. if hldid=50557 and firstact=2310 and location=-3 location=18. if hldid=60772 and location=-3 location=3. execute. recode location (-3=45). temp. select if location<1. freq firstact. *now that activity and location codes fixed, look for options to impute missing *and to fill in errors from later time slots. temp. select if (third=9999 or third<1) and (fourth>0). freq fourth firstact location time1. Do if (third=9999 or third<1) and (fourth>0). compute third=fourth. compute fourth=0. End if. temp. select if (second=9999 or second<1) and (third>0). freq third firstact location time1. Do if (second=9999 or second<1) and (third>0). compute second=third. compute third=0. End if. temp. select if firstact=9999 and (second>0 or location>0). freq second location time1. do if firstact=9999 and second=1801. compute firstact=1801. compute second=0. Else if firstact=9999 and location>37. compute firstact=62. Else if firstact=9999 and location=2. compute firstact=41. End if. freq firstact. *Remove non-diaries. compute drop=0. if firstact=9999 and startslt=1 and endslt=96 drop=1. if hldid=10224 and persid=1 and realday>3 drop=1. if hldid=10230 and persid=4 and realday<3 drop=1. if hldid=10230 and persid=4 and realday=7 drop=1. if hldid=11609 and persid=2 and (realday<3 or realday>3) drop=1. if hldid=30576 and persid=2 and (realday<5 or realday>6) drop=1. if hldid=30707 and persid=2 and (realday<4 or realday>4) drop=1. if hldid=30764 and persid=4 and realday<3 drop=1. if hldid=31006 and persid=2 and realday=4 drop=1. if hldid=40111 and persid=2 and realday>2 drop=1. if hldid=40197 and persid=2 and realday>3 drop=1. if hldid=40700 and persid=1 and (realday<3 or realday>4) drop=1. if hldid=40700 and persid=2 and (realday<3 or realday>4) drop=1. if hldid=40804 and persid=2 and realday<6 drop=1. if hldid=60353 and persid=1 and realday>2 drop=1. if hldid=60353 and persid=2 and realday>2 drop=1. if hldid=60353 and persid=3 and realday>2 drop=1. if hldid=60368 and persid=1 and (realday<2 or realday>2) drop=1. select if drop=0. execute. temp. select if firstact=9999 and (startslt=1 or endslt=96). freq time1. Do if firstact=9999 and (startslt=1 and endslt<25). compute firstact=3. compute location=-3. End if. Do if firstact=9999 and (startslt>62 and endslt=96). compute firstact=3. if lag(location)=1 location=1. if lag(location)~=1 location=-3. End if. freq location. if hldid=30201 and persid=1 and realday=5 and startslt=79 location=2. if hldid=50020 and persid=2 and realday=7 and startslt=14 location=1. execute. recode location (-3=1). execute. compute test=0. if firstact=9999 and (lag(firstact)=3 or (lag(firstact)>1600 and lag(firstact)<1604)) test=1. freq test. temp. select if test=1. freq time1. if test=1 and time1<70 firstact=1. if test=1 and time1<70 location=lag(location). compute test=0. if firstact=9999 and ((lag(firstact)>501 and lag(firstact)<506) or (lag(firstact)>1200 and lag(firstact)<1204) or (lag(firstact)>1700 and lag(firstact)<1707) or lag(firstact)=817) test=1. freq test. do if test=1 and ((hldid=11275 and persid=2 and realday=6 and startslt=54) or (hldid=30232 and persid=3 and realday=4 and startslt=70) or (hldid=30245 and persid=2 and realday=5 and startslt=48) or (hldid=40506 and persid=1 and realday=7 and startslt=53) or (hldid=50009 and persid=1 and realday=2 and startslt=35) or (hldid=50026 and persid=1 and realday=1 and startslt=74) or (hldid=60029 and persid=1 and realday=4 and startslt=65)). compute firstact=1. compute location=1. Else if hldid=60616 and persid=2 and realday=2 and startslt=57. compute firstact=3. compute location=1. Else if test=1 and ((hldid=11364 and persid=1 and realday=6 and startslt=78) or (hldid=11458 and persid=3 and realday=2 and startslt=33)). compute location=1. End if. freq firstact. *final error fixing. Do if hldid=60202 and persid=2 and realday=2 and startslt=5. compute third=1501. compute fourth=-5. End if. Do if hldid=50557 and persid=1 and realday=5 and startslt=43. compute third=1502. compute fourth=-5. End if. execute. *fill in time use episodes. *ICT. compute ict1=0. if firstact=207 or firstact=209 or firstact=818 or firstact=3302 or firstact=4004 or firstact=4009 or second=207 or second=209 or second=818 or second=3302 or second=4004 or second=4009 ict1=1. freq ict1. temp. select if third=207 or third=209 or third=818 or third=3302 or third=4004 or third=4009. freq firstact. if third=207 or third=209 or third=818 or third=3302 or third=4004 or third=4009 ict2=1. freq ict2. temp. select if fourth=207 or fourth=209 or fourth=818 or fourth=3302 or fourth=4004 or fourth=4009. freq firstact. *make a further adjustment later to copy over ICT1 values if items in 2nd or 3rd *secondary activity slots. *primary activity. *possibilities to code main=13 - other time at workplace. temp. select if location=5. freq firstact. *possibilities to code walk dog. temp. select if firstact=806 or second=806. freq location. *possible to codes walking the dog. *check whether pet services and job search travel coded with second, 3rd or fourth *activities. temp. select if firstact=404. freq second third fourth. *no fourth activity; 2 instances of a 3rd activity; 21 instances of a second activity. temp. select if firstact=816. freq second third fourth. *no fourth activity; 2 instances of a 3rd activity; 22 instances of a second activity. compute test=0. Do if ((firstact=101 or firstact=102 or firstact=103 or firstact=104) and location>1) or ((firstact=201 or firstact=202 or firstact=203 or firstact=204 or firstact=205 or firstact=206 or firstact=207 or firstact=208 or firstact=209 or firstact=210) and location=5). compute av1=1. if third>0 av2=1. if fourth>0 av3=1. Else if ((firstact=101 or firstact=102 or firstact=103 or firstact=104) and location=1) or firstact=201 or firstact=202 or firstact=203 or firstact=204 or firstact=205 or firstact=206 or firstact=207 or firstact=208 or firstact=209 or firstact=210. compute av1=2. if third>0 av2=2. if fourth>0 av3=2. Else if firstact=301 or firstact=302 or firstact=501. compute av1=3. if third>0 av2=3. if fourth>0 av3=3. Else if firstact=401 or firstact=402 or firstact=403 or firstact=404 or firstact=405. compute av1=4. if third>0 or (firstact=404 and second>0) av2=4. if fourth>0 or (firstact=404 and third>0) av3=4. Else if firstact=502 or firstact=503 or firstact=504 or firstact=505. compute av1=5. if third>0 av2=5. if fourth>0 av3=5. Else if firstact=601 or firstact=602 or firstact=603 or firstact=604 or firstact=605. compute av1=6. if third>0 av2=6. if fourth>0 av3=6. Else if firstact=701 or firstact=702 or firstact=703 or firstact=704 or firstact=705 or firstact=706 or firstact=707 or firstact=708 or firstact=807 or firstact=808. compute av1=7. if third>0 av2=7. if fourth>0 av3=7. Else if firstact=801 or firstact=802 or firstact=803 or firstact=804 or firstact=805 or firstact=809 or firstact=810 or firstact=811 or firstact=812 or firstact=813 or firstact=814 or firstact=815 or firstact=816 or firstact=818 or firstact=819. compute av1=8. if third>0 or (firstact=816 and second>0) av2=8. if fourth>0 or (firstact=816 and third>0) av3=8. Else if firstact=806 or firstact=901. compute av1=9. if third>0 av2=9. if fourth>0 av3=9. Else if firstact=1001 or firstact=1002 or firstact=1003 or firstact=1004 or firstact=1005 or firstact=1006 or firstact=1007 or firstact=1008 or firstact=2301. compute av1=10. if third>0 av2=10. if fourth>0 av3=10. Else if firstact=1101 or firstact=1102 or firstact=1103 or firstact=1104 or firstact=1105 or firstact=1106 or firstact=1107 or firstact=1108 or firstact=1109 or firstact=1110 or firstact=1111. compute av1=11. if third>0 av2=11. if fourth>0 av3=11. Else if firstact=817 or firstact=1201 or firstact=1202 or firstact=1203 or firstact=1204 or firstact=1705 or firstact=1706. compute av1=12. if third>0 av2=12. if fourth>0 av3=12. Else if firstact=1301 or firstact=1302 or firstact=1704. compute av1=13. if third>0 av2=13. if fourth>0 av3=13. Else if firstact=1401 or firstact=1402 or firstact=1404 or firstact=1405 or firstact=1406 or firstact=1408. compute av1=14. if third>0 av2=14. if fourth>0 av3=14. Else if (firstact=1501 or firstact=1502) and location=5. compute av1=1. if third>0 av2=1. if fourth>0 av3=1. Else if (firstact=1501 or firstact=1502) and (location=23 or location=28). compute av1=28. if third>0 av2=28. if fourth>0 av3=28. Else if firstact=1501 or firstact=1502. compute av1=15. if third>0 av2=15. if fourth>0 av3=15. Else if firstact=1601 or firstact=1602 or firstact=1603 or firstact=3. compute av1=16. if third>0 av2=16. if fourth>0 av3=16. Else if firstact=1701 or firstact=1702 or firstact=1703 or firstact=1807 or firstact=62. compute av1=17. if third>0 av2=17. if fourth>0 av3=17. Else if firstact=1801 or firstact=1802 or firstact=1803 or firstact=1804 or firstact=1805 or firstact=1806. compute av1=18. if third>0 av2=18. if fourth>0 av3=18. Else if firstact=1901 or firstact=1902 or firstact=1903 or firstact=1904 or firstact=1905 or firstact=1906 or firstact=1907 or firstact=1908 or firstact=1909 or firstact=1910 or firstact=1911 or firstact=1912 or firstact=1913 or firstact=1914 or firstact=1915. compute av1=19. if third>0 av2=19. if fourth>0 av3=19. Else if firstact=2001. compute av1=20. if third>0 av2=20. if fourth>0 av3=20. Else if firstact=2101 or firstact=2102. compute av1=21. if third>0 av2=21. if fourth>0 av3=21. Else if firstact=2201. compute av1=22. if third>0 av2=22. if fourth>0 av3=22. Else if firstact=2302 or firstact=2303 or firstact=2304 or firstact=2305 or firstact=2306 or firstact=2307 or firstact=2308 or firstact=2309 or firstact=2310 or firstact=2508 or firstact=4010. compute av1=23. if third>0 av2=23. if fourth>0 av3=23. Else if firstact=2401 or firstact=2402 or firstact=2403 or firstact=2404. compute av1=24. if third>0 av2=24. if fourth>0 av3=24. Else if firstact=2501 or firstact=2502 or firstact=2503 or firstact=2504 or firstact=2505 or firstact=2506 or firstact=2507. compute av1=25. if third>0 av2=25. if fourth>0 av3=25. Else if firstact=2601. compute av1=26. if third>0 av2=26. if fourth>0 av3=26. Else if firstact=2701 or firstact=2702 or firstact=2703. compute av1=27. if third>0 av2=27. if fourth>0 av3=27. Else if firstact=2801 or firstact=2802 or firstact=2803 or firstact=2804. compute av1=28. if third>0 av2=28. if fourth>0 av3=28. Else if firstact=2901 or firstact=2902 or (firstact=3802 and (location>1 and location<5)). compute av1=29. if third>0 av2=29. if fourth>0 av3=29. Else if firstact=2901 or firstact=2902 or (firstact=3802 and (location>1 and location<5)). compute av1=29. if third>0 av2=29. if fourth>0 av3=29. Else if firstact=3802 and location=1 and (whowith1>9 or whowith2>9 or whowith3>9). compute av1=36. if third>0 av2=36. if fourth>0 av3=36. Else if firstact=3802. compute av1=38. if third>0 av2=38. if fourth>0 av3=38. Else if firstact=3001. compute av1=30. if third>0 av2=30. if fourth>0 av3=30. Else if firstact=3101 or firstact=3102 or firstact=3103. compute av1=31. if third>0 av2=31. if fourth>0 av3=31. Else if firstact=3201. compute av1=32. if third>0 av2=32. if fourth>0 av3=32. Else if firstact=3301 or firstact=3302. compute av1=33. if third>0 av2=33. if fourth>0 av3=33. Else if firstact=3401. compute av1=34. if third>0 av2=34. if fourth>0 av3=34. Else if firstact=3501 or firstact=3502. compute av1=35. if third>0 av2=35. if fourth>0 av3=35. Else if firstact=3601 or firstact=3602 or firstact=3603 or firstact=3604 or firstact=3605. compute av1=36. if third>0 av2=36. if fourth>0 av3=36. Else if firstact=3701 or firstact=3702. compute av1=37. if third>0 av2=37. if fourth>0 av3=37. Else if firstact=3801. compute av1=38. if third>0 av2=38. if fourth>0 av3=38. Else if firstact=3901. compute av1=39. if third>0 av2=39. if fourth>0 av3=39. Else if firstact=4001 or firstact=4002 or firstact=4003 or firstact=4004 or firstact=4005 or firstact=4006 or firstact=4007 or firstact=4008 or firstact=4009. compute av1=40. if third>0 av2=40. if fourth>0 av3=40. Else if firstact<99 or firstact=9999. compute av1=41. Else. compute test=firstact. end if. freq test av1 av2 av3. *double check that right activities entered into each AV code, starting with 1, *code line changed after each check until 41. temp. select if av1=41. freq firstact location. compute test=0. compute sec1=69. Do if firstact=1704. compute main1=1. if third>0 main2=1. if fourth>0 main3=1. Else if firstact=1601 or firstact=1602 or firstact=1603. compute main1=2. if third>0 main2=2. if fourth>0 main3=2. Else if firstact=1301 or firstact=1302. compute main1=4. if third>0 main2=4. if fourth>0 main3=4. Else if firstact=402 or (location=5 and (firstact=1501 or firstact=1502)). compute main1=5. if third>0 main2=5. if fourth>0 main3=5. Else if (location=28 or location=23) and (firstact=1501 or firstact=1502). compute main1=39. if third>0 main2=39. if fourth>0 main3=39. Else if firstact=1501 or firstact=1502. compute main1=6. if third>0 main2=6. if fourth>0 main3=6. Else if (location>1 and (firstact=101 or firstact=104)) or (location=5 and (firstact=206 or firstact=207 or firstact=208 or firstact=209)). compute main1=7. if third>0 main2=7. if fourth>0 main3=7. Else if (location=1 and (firstact=101 or firstact=104 or firstact=201 or firstact=202 or firstact=301)) or firstact=206 or firstact=207 or firstact=208 or firstact=209. compute main1=8. if third>0 main2=8. if fourth>0 main3=8. Else if firstact=201 or firstact=202 or firstact=301. compute main1=9. if third>0 main2=9. if fourth>0 main3=9. Else if firstact=302. compute main1=10. if third>0 main2=10. if fourth>0 main3=10. Else if firstact=505. compute main1=11. if third>0 main2=11. if fourth>0 main3=11. Else if firstact=102 or firstact=103. compute main1=12. if third>0 main2=12. if fourth>0 main3=12. Else if location=5 and (firstact=1704 or firstact=3601 or firstact=3802). compute main1=13. if third>0 main2=13. if fourth>0 main3=13. Else if firstact=3802 and ((location>1 and location<5) or (location=1 and (whowith1>6 or whowith2>6 or whowith3>6))). compute main1=48. if third>0 main2=48. if fourth>0 main3=48. Else if firstact=3802. compute main1=55. if third>0 main2=55. if fourth>0 main3=55. Else if firstact=203 or firstact=204 or firstact=205 or firstact=210 or firstact=501. compute main1=14. if third>0 main2=14. if fourth>0 main3=14. Else if firstact=504. compute main1=14. if second>0 main2=14. if third>0 main3=14. if second<9 sec1=63. if second>0 and third<9 sec2=63. if third>0 sec3=63. Else if firstact=401 or firstact=403. compute main1=15. if third>0 main2=15. if fourth>0 main3=15. Else if firstact=3301 or firstact=3302. compute main1=16. if third>0 main2=16. if fourth>0 main3=16. Else if firstact=404 or firstact=405 or firstact=2504. compute main1=17. if third>0 main2=17. if fourth>0 main3=17. Else if firstact=601 or firstact=602 or firstact=604 or firstact=4001. compute main1=18. if third>0 main2=18. if fourth>0 main3=18. Else if firstact=603 or firstact=605. compute main1=19. if third>0 main2=19. if fourth>0 main3=19. Else if firstact=703 or firstact=704 or firstact=705 or firstact=706. compute main1=20. if third>0 main2=20. if fourth>0 main3=20. Else if firstact=701 or firstact=702 or firstact=801. compute main1=21. if third>0 main2=21. if fourth>0 main3=21. Else if firstact=802 or firstact=803 or firstact=804. compute main1=22. if third>0 main2=22. if fourth>0 main3=22. Else if firstact=707 or firstact=708 or firstact=805 or firstact=807 or firstact=808 or firstact=818. compute main1=23. if third>0 main2=23. if fourth>0 main3=23. Else if firstact=1001 or firstact=1002 or firstact=1005 or firstact=1008. compute main1=24. if third>0 main2=24. if fourth>0 main3=24. Else if firstact=1401 or firstact=1402 or firstact=1404 or firstact=1405 or firstact=1406 or firstact=1408. compute main1=25. if third>0 main2=25. if fourth>0 main3=25. Else if firstact=1003 or firstact=1004 or firstact=1006 or firstact=1007 or firstact=1204 or firstact=2301. compute main1=26. if third>0 main2=26. if fourth>0 main3=26. Else if firstact=816. compute main1=26. if second>0 main2=26. if third>0 main3=26. if second<9 sec1=27. if second>0 and third<9 sec2=27. if third>0 sec3=27. Else if firstact=806 and location=40. compute main1=47. if third>0 main2=47. if fourth>0 main3=47. Else if firstact=806. compute main1=27. if third>0 main2=27. if fourth>0 main3=27. Else if firstact=1101 or firstact=1102 or firstact=1103 or firstact=1105 or firstact=1106. compute main1=28. if third>0 main2=28. if fourth>0 main3=28. Else if firstact=1108. compute main1=29. if third>0 main2=29. if fourth>0 main3=29. Else if firstact=1107. compute main1=30. if third>0 main2=30. if fourth>0 main3=30. Else if firstact=1104 or firstact=1109 or firstact=1110 or firstact=1111. compute main1=31. if third>0 main2=31. if fourth>0 main3=31. Else if firstact=809 or firstact=810 or firstact=811 or firstact=812 or firstact=813 or firstact=814 or firstact=815 or firstact=819. compute main1=32. if third>0 main2=32. if fourth>0 main3=32. Else if firstact=2302 or firstact=2303 or firstact=2304 or firstact=2305 or firstact=2306 or firstact=2307 or firstact=2308 or firstact=2309 or firstact=2310 or firstact=2508 or firstact=4010. compute main1=33. if third>0 main2=33. if fourth>0 main3=33. Else if firstact=2201. compute main1=34. if third>0 main2=34. if fourth>0 main3=34. Else if firstact=1805 or firstact=2502 or firstact=2505 or firstact=2506. compute main1=35. if third>0 main2=35. if fourth>0 main3=35. Else if firstact=2001. compute main1=36. if third>0 main2=36. if fourth>0 main3=36. Else if firstact=2401 or firstact=2402 or firstact=2403 or firstact=2404. compute main1=37. if third>0 main2=37. if fourth>0 main3=37. Else if firstact=1804 or firstact=1806. compute main1=38. if third>0 main2=38. if fourth>0 main3=38. Else if firstact=2701 or firstact=2703 or firstact=2801 or firstact=2802 or firstact=2803 or firstact=2804. compute main1=39. if third>0 main2=39. if fourth>0 main3=39. Else if firstact=2501 or firstact=2503 or firstact=2507 or firstact=2601 or firstact=2702. compute main1=40. if third>0 main2=40. if fourth>0 main3=40. Else if firstact=1901 or firstact=1902 or firstact=1904 or firstact=1906 or firstact=1907 or firstact=1908 or firstact=1909 or firstact=1911 or firstact=1912 or firstact=1913 or firstact=1915. compute main1=42. if third>0 main2=42. if fourth>0 main3=42. Else if firstact=1903 or firstact=2101. compute main1=43. if third>0 main2=43. if fourth>0 main3=43. Else if firstact=1910. compute main1=44. if third>0 main2=44. if fourth>0 main3=44. Else if firstact=1801 or firstact=1802 or firstact=1803. compute main1=45. if third>0 main2=45. if fourth>0 main3=45. Else if firstact=901 or firstact=1905 or firstact=1914 or firstact=2102. compute main1=46. if third>0 main2=46. if fourth>0 main3=46. Else if firstact=2901 or firstact=2902 or firstact=3801. compute main1=48. if third>0 main2=48. if fourth>0 main3=48. Else if firstact=3701 or firstact=3702. compute main1=49. if third>0 main2=49. if fourth>0 main3=49. Else if firstact=3603 or firstact=4005. compute main1=50. if third>0 main2=50. if fourth>0 main3=50. Else if firstact=3604 or firstact=3605 or firstact=4003. compute main1=51. if third>0 main2=51. if fourth>0 main3=51. Else if firstact=4002 or firstact=4006. compute main1=52. if third>0 main2=52. if fourth>0 main3=52. Else if firstact=4008. compute main1=53. if third>0 main2=53. if fourth>0 main3=53. Else if firstact=3901 or firstact=4007. compute main1=54. if third>0 main2=54. if fourth>0 main3=54. Else if firstact=3601 or firstact=3602. compute main1=55. if third>0 main2=55. if fourth>0 main3=55. Else if firstact=3401 or firstact=3501 or firstact=3502. compute main1=56. if third>0 main2=56. if fourth>0 main3=56. Else if firstact=3201. compute main1=57. if third>0 main2=57. if fourth>0 main3=57. Else if firstact=3001. compute main1=58. if third>0 main2=58. if fourth>0 main3=58. Else if firstact=3101 or firstact=3102 or firstact=3103. compute main1=59. if third>0 main2=59. if fourth>0 main3=59. Else if firstact=4004. compute main1=60. if third>0 main2=60. if fourth>0 main3=60. Else if firstact=4009. compute main1=61. if third>0 main2=61. if fourth>0 main3=61. Else if firstact=502. compute main1=63. if third>0 main2=63. if fourth>0 main3=63. Else if firstact=503. compute main1=64. if third>0 main2=64. if fourth>0 main3=64. Else if firstact=1703. compute main1=65. if third>0 main2=65. if fourth>0 main3=65. Else if firstact=1201 or firstact=1203. compute main1=66. if third>0 main2=66. if fourth>0 main3=66. Else if firstact=817 or firstact=1202 or firstact=1705 or firstact=1706. compute main1=67. if third>0 main2=67. if fourth>0 main3=67. Else if firstact=1701 or firstact=1702 or firstact=1807. compute main1=68. if third>0 main2=68. if fourth>0 main3=68. Else if firstact<99. compute main1=firstact. Else if firstact=9999. compute main1=69. Else. compute test=firstact. end if. freq test main1 main2 main3 sec1. *double check that right activities entered into each main code, starting with 1, *code line changed after each check until 69. temp. select if main1=69. freq firstact location. *check for secondary job search travel and vet services. temp. select if second=404 or second=816. freq third fourth. *no fourth activity; 4 instances with a 3rd activity; 97 instances as a second activity. temp. select if third=404 or third=816. freq fourth. *16 such instances, in one case there is a fourth activity where information will be lost. temp. select if fourth=404 or fourth=816. freq firstact second third. *no such instances. *fill in rest of secondary activity. compute test=0. Do if second=1704. compute sec1=1. Else if second=1601 or second=1602 or second=1603. compute sec1=2. Else if second=1301 or second=1302. compute sec1=4. Else if second=402 or (location=5 and (second=1501 or second=1502)). compute sec1=5. Else if (location=28 or location=23) and (second=1501 or second=1502). compute sec1=39. Else if second=1501 or second=1502. compute sec1=6. Else if (location>1 and (second=101 or second=104)) or (location=5 and (second=206 or second=207 or second=208 or second=209)). compute sec1=7. Else if (location=1 and (second=101 or second=104 or second=201 or second=202 or second=301)) or second=206 or second=207 or second=208 or second=209. compute sec1=8. Else if second=201 or second=202 or second=301. compute sec1=9. Else if second=302. compute sec1=10. Else if second=505. compute sec1=11. Else if second=102 or second=103. compute sec1=12. Else if location=5 and (second=1704 or second=3601 or second=3802). compute sec1=13. Else if second=3802 and ((location>1 and location<5) or (location=1 and (whowith1>6 or whowith2>6 or whowith3>6))). compute sec1=48. Else if second=3802. compute sec1=55. Else if second=203 or second=204 or second=205 or second=210 or second=501. compute sec1=14. Else if second=504. compute sec1=14. if third<9 sec2=63. if third>0 and fourth<9 sec3=63. Else if second=401 or second=403. compute sec1=15. Else if second=3301 or second=3302. compute sec1=16. Else if second=404 or second=405 or second=2504. compute sec1=17. Else if second=601 or second=602 or second=604 or second=4001. compute sec1=18. Else if second=603 or second=605. compute sec1=19. Else if second=703 or second=704 or second=705 or second=706. compute sec1=20. Else if second=701 or second=702 or second=801. compute sec1=21. Else if second=802 or second=803 or second=804. compute sec1=22. Else if second=707 or second=708 or second=805 or second=807 or second=808 or second=818. compute sec1=23. Else if second=1001 or second=1002 or second=1005 or second=1008. compute sec1=24. Else if second=1401 or second=1402 or second=1404 or second=1405 or second=1406 or second=1408. compute sec1=25. Else if second=1003 or second=1004 or second=1006 or second=1007 or second=1204 or second=2301. compute sec1=26. Else if second=816. compute sec1=26. if third<9 sec2=27. if third>0 and fourth<9 sec3=27. Else if second=806 and location=40. compute sec1=47. Else if second=806. compute sec1=27. Else if second=1101 or second=1102 or second=1103 or second=1105 or second=1106. compute sec1=28. Else if second=1108. compute sec1=29. Else if second=1107. compute sec1=30. Else if second=1104 or second=1109 or second=1110 or second=1111. compute sec1=31. Else if second=809 or second=810 or second=811 or second=812 or second=813 or second=814 or second=815 or second=819. compute sec1=32. Else if second=2302 or second=2303 or second=2304 or second=2305 or second=2306 or second=2307 or second=2308 or second=2309 or second=2310 or second=2508 or second=4010. compute sec1=33. Else if second=2201. compute sec1=34. Else if second=1805 or second=2502 or second=2505 or second=2506. compute sec1=35. Else if second=2001. compute sec1=36. Else if second=2401 or second=2402 or second=2403 or second=2404. compute sec1=37. Else if second=1804 or second=1806. compute sec1=38. Else if second=2701 or second=2703 or second=2801 or second=2802 or second=2803 or second=2804. compute sec1=39. Else if second=2501 or second=2503 or second=2507 or second=2601 or second=2702. compute sec1=40. Else if second=1901 or second=1902 or second=1904 or second=1906 or second=1907 or second=1908 or second=1909 or second=1911 or second=1912 or second=1913 or second=1915. compute sec1=42. Else if second=1903 or second=2101. compute sec1=43. Else if second=1910. compute sec1=44. Else if second=1801 or second=1802 or second=1803. compute sec1=45. Else if second=901 or second=1905 or second=1914 or second=2102. compute sec1=46. Else if second=2901 or second=2902 or second=3801. compute sec1=48. Else if second=3701 or second=3702. compute sec1=49. Else if second=3603 or second=4005. compute sec1=50. Else if second=3604 or second=3605 or second=4003. compute sec1=51. Else if second=4002 or second=4006. compute sec1=52. Else if second=4008. compute sec1=53. Else if second=3901 or second=4007. compute sec1=54. Else if second=3601 or second=3602. compute sec1=55. Else if second=3401 or second=3501 or second=3502. compute sec1=56. Else if second=3201. compute sec1=57. Else if second=3001. compute sec1=58. Else if second=3101 or second=3102 or second=3103. compute sec1=59. Else if second=4004. compute sec1=60. Else if second=4009. compute sec1=61. Else if second=502. compute sec1=63. Else if second=503. compute sec1=64. Else if second=1703. compute sec1=65. Else if second=1201 or second=1203. compute sec1=66. Else if second=817 or second=1202 or second=1705 or second=1706. compute sec1=67. Else if second=1701 or second=1702 or second=1807. compute sec1=68. Else. compute test=second. end if. freq test sec1 sec2 sec3. compute test=0. Do if third=1704. compute sec2=1. Else if third=1601 or third=1602 or third=1603. compute sec2=2. Else if third=1301 or third=1302. compute sec2=4. Else if third=402 or (location=5 and (third=1501 or third=1502)). compute sec2=5. Else if (location=28 or location=23) and (third=1501 or third=1502). compute sec2=39. Else if third=1501 or third=1502. compute sec2=6. Else if (location>1 and (third=101 or third=104)) or (location=5 and (third=206 or third=207 or third=208 or third=209)). compute sec2=7. Else if (location=1 and (third=101 or third=104 or third=201 or third=202 or third=301)) or third=206 or third=207 or third=208 or third=209. compute sec2=8. Else if third=201 or third=202 or third=301. compute sec2=9. Else if third=302. compute sec2=10. Else if third=505. compute sec2=11. Else if third=102 or third=103. compute sec2=12. Else if location=5 and (third=1704 or third=3601 or third=3802). compute sec2=13. Else if third=3802 and ((location>1 and location<5) or (location=1 and (whowith1>6 or whowith2>6 or whowith3>6))). compute sec2=48. Else if third=3802. compute sec2=55. Else if third=203 or third=204 or third=205 or third=210 or third=501. compute sec2=14. Else if third=504. compute sec2=14. if fourth<9 sec3=63. Else if third=401 or third=403. compute sec2=15. Else if third=3301 or third=3302. compute sec2=16. Else if third=404 or third=405 or third=2504. compute sec2=17. Else if third=601 or third=602 or third=604 or third=4001. compute sec2=18. Else if third=603 or third=605. compute sec2=19. Else if third=703 or third=704 or third=705 or third=706. compute sec2=20. Else if third=701 or third=702 or third=801. compute sec2=21. Else if third=802 or third=803 or third=804. compute sec2=22. Else if third=707 or third=708 or third=805 or third=807 or third=808 or third=818. compute sec2=23. Else if third=1001 or third=1002 or third=1005 or third=1008. compute sec2=24. Else if third=1401 or third=1402 or third=1404 or third=1405 or third=1406 or third=1408. compute sec2=25. Else if third=1003 or third=1004 or third=1006 or third=1007 or third=1204 or third=2301. compute sec2=26. Else if third=816. compute sec2=26. if fourth<9 sec3=27. Else if third=806 and location=40. compute sec2=47. Else if third=806. compute sec2=27. Else if third=1101 or third=1102 or third=1103 or third=1105 or third=1106. compute sec2=28. Else if third=1108. compute sec2=29. Else if third=1107. compute sec2=30. Else if third=1104 or third=1109 or third=1110 or third=1111. compute sec2=31. Else if third=809 or third=810 or third=811 or third=812 or third=813 or third=814 or third=815 or third=819. compute sec2=32. Else if third=2302 or third=2303 or third=2304 or third=2305 or third=2306 or third=2307 or third=2308 or third=2309 or third=2310 or third=2508 or third=4010. compute sec2=33. Else if third=2201. compute sec2=34. Else if third=1805 or third=2502 or third=2505 or third=2506. compute sec2=35. Else if third=2001. compute sec2=36. Else if third=2401 or third=2402 or third=2403 or third=2404. compute sec2=37. Else if third=1804 or third=1806. compute sec2=38. Else if third=2701 or third=2703 or third=2801 or third=2802 or third=2803 or third=2804. compute sec2=39. Else if third=2501 or third=2503 or third=2507 or third=2601 or third=2702. compute sec2=40. Else if third=1901 or third=1902 or third=1904 or third=1906 or third=1907 or third=1908 or third=1909 or third=1911 or third=1912 or third=1913 or third=1915. compute sec2=42. Else if third=1903 or third=2101. compute sec2=43. Else if third=1910. compute sec2=44. Else if third=1801 or third=1802 or third=1803. compute sec2=45. Else if third=901 or third=1905 or third=1914 or third=2102. compute sec2=46. Else if third=2901 or third=2902 or third=3801. compute sec2=48. Else if third=3701 or third=3702. compute sec2=49. Else if third=3603 or third=4005. compute sec2=50. Else if third=3604 or third=3605 or third=4003. compute sec2=51. Else if third=4002 or third=4006. compute sec2=52. Else if third=4008. compute sec2=53. Else if third=3901 or third=4007. compute sec2=54. Else if third=3601 or third=3602. compute sec2=55. Else if third=3401 or third=3501 or third=3502. compute sec2=56. Else if third=3201. compute sec2=57. Else if third=3001. compute sec2=58. Else if third=3101 or third=3102 or third=3103. compute sec2=59. Else if third=4004. compute sec2=60. Else if third=4009. compute sec2=61. Else if third=502. compute sec2=63. Else if third=503. compute sec2=64. Else if third=1703. compute sec2=65. Else if third=1201 or third=1203. compute sec2=66. Else if third=817 or third=1202 or third=1705 or third=1706. compute sec2=67. Else if third=1701 or third=1702 or third=1807. compute sec2=68. Else. compute test=third. end if. freq test sec2 sec3. compute test=0. Do if fourth=1704. compute sec3=1. Else if fourth=1601 or fourth=1602 or fourth=1603. compute sec3=2. Else if fourth=1301 or fourth=1302. compute sec3=4. Else if fourth=402 or (location=5 and (fourth=1501 or fourth=1502)). compute sec3=5. Else if (location=28 or location=23) and (fourth=1501 or fourth=1502). compute sec3=39. Else if fourth=1501 or fourth=1502. compute sec3=6. Else if (location>1 and (fourth=101 or fourth=104)) or (location=5 and (fourth=206 or fourth=207 or fourth=208 or fourth=209)). compute sec3=7. Else if (location=1 and (fourth=101 or fourth=104 or fourth=201 or fourth=202 or fourth=301)) or fourth=206 or fourth=207 or fourth=208 or fourth=209. compute sec3=8. Else if fourth=201 or fourth=202 or fourth=301. compute sec3=9. Else if fourth=302. compute sec3=10. Else if fourth=505. compute sec3=11. Else if fourth=102 or fourth=103. compute sec3=12. Else if location=5 and (fourth=1704 or fourth=3601 or fourth=3802). compute sec3=13. Else if fourth=3802 and ((location>1 and location<5) or (location=1 and (whowith1>6 or whowith2>6 or whowith3>6))). compute sec3=48. Else if fourth=3802. compute sec3=55. Else if fourth=203 or fourth=204 or fourth=205 or fourth=210 or fourth=501. compute sec3=14. Else if fourth=504. compute sec3=14. Else if fourth=401 or fourth=403. compute sec3=15. Else if fourth=3301 or fourth=3302. compute sec3=16. Else if fourth=404 or fourth=405 or fourth=2504. compute sec3=17. Else if fourth=601 or fourth=602 or fourth=604 or fourth=4001. compute sec3=18. Else if fourth=603 or fourth=605. compute sec3=19. Else if fourth=703 or fourth=704 or fourth=705 or fourth=706. compute sec3=20. Else if fourth=701 or fourth=702 or fourth=801. compute sec3=21. Else if fourth=802 or fourth=803 or fourth=804. compute sec3=22. Else if fourth=707 or fourth=708 or fourth=805 or fourth=807 or fourth=808 or fourth=818. compute sec3=23. Else if fourth=1001 or fourth=1002 or fourth=1005 or fourth=1008. compute sec3=24. Else if fourth=1401 or fourth=1402 or fourth=1404 or fourth=1405 or fourth=1406 or fourth=1408. compute sec3=25. Else if fourth=1003 or fourth=1004 or fourth=1006 or fourth=1007 or fourth=1204 or fourth=2301. compute sec3=26. Else if fourth=816. compute sec3=26. Else if fourth=806 and location=40. compute sec3=47. Else if fourth=806. compute sec3=27. Else if fourth=1101 or fourth=1102 or fourth=1103 or fourth=1105 or fourth=1106. compute sec3=28. Else if fourth=1108. compute sec3=29. Else if fourth=1107. compute sec3=30. Else if fourth=1104 or fourth=1109 or fourth=1110 or fourth=1111. compute sec3=31. Else if fourth=809 or fourth=810 or fourth=811 or fourth=812 or fourth=813 or fourth=814 or fourth=815 or fourth=819. compute sec3=32. Else if fourth=2302 or fourth=2303 or fourth=2304 or fourth=2305 or fourth=2306 or fourth=2307 or fourth=2308 or fourth=2309 or fourth=2310 or fourth=2508 or fourth=4010. compute sec3=33. Else if fourth=2201. compute sec3=34. Else if fourth=1805 or fourth=2502 or fourth=2505 or fourth=2506. compute sec3=35. Else if fourth=2001. compute sec3=36. Else if fourth=2401 or fourth=2402 or fourth=2403 or fourth=2404. compute sec3=37. Else if fourth=1804 or fourth=1806. compute sec3=38. Else if fourth=2701 or fourth=2703 or fourth=2801 or fourth=2802 or fourth=2803 or fourth=2804. compute sec3=39. Else if fourth=2501 or fourth=2503 or fourth=2507 or fourth=2601 or fourth=2702. compute sec3=40. Else if fourth=1901 or fourth=1902 or fourth=1904 or fourth=1906 or fourth=1907 or fourth=1908 or fourth=1909 or fourth=1911 or fourth=1912 or fourth=1913 or fourth=1915. compute sec3=42. Else if fourth=1903 or fourth=2101. compute sec3=43. Else if fourth=1910. compute sec3=44. Else if fourth=1801 or fourth=1802 or fourth=1803. compute sec3=45. Else if fourth=901 or fourth=1905 or fourth=1914 or fourth=2102. compute sec3=46. Else if fourth=2901 or fourth=2902 or fourth=3801. compute sec3=48. Else if fourth=3701 or fourth=3702. compute sec3=49. Else if fourth=3603 or fourth=4005. compute sec3=50. Else if fourth=3604 or fourth=3605 or fourth=4003. compute sec3=51. Else if fourth=4002 or fourth=4006. compute sec3=52. Else if fourth=4008. compute sec3=53. Else if fourth=3901 or fourth=4007. compute sec3=54. Else if fourth=3601 or fourth=3602. compute sec3=55. Else if fourth=3401 or fourth=3501 or fourth=3502. compute sec3=56. Else if fourth=3201. compute sec3=57. Else if fourth=3001. compute sec3=58. Else if fourth=3101 or fourth=3102 or fourth=3103. compute sec3=59. Else if fourth=4004. compute sec3=60. Else if fourth=4009. compute sec3=61. Else if fourth=502. compute sec3=63. Else if fourth=503. compute sec3=64. Else if fourth=1703. compute sec3=65. Else if fourth=1201 or fourth=1203. compute sec3=66. Else if fourth=817 or fourth=1202 or fourth=1705 or fourth=1706. compute sec3=67. Else if fourth=1701 or fourth=1702 or fourth=1807. compute sec3=68. Else. compute test=fourth. end if. freq test sec3. do if startslt>1 and (((location>0 and location<6) or (location>16 and location<28) or (location>28 and location<36)) and ((lag(location)>0 and lag(location)<6) or (lag(location)>16 and lag(location)<28) or (lag(location)>28 and lag(location)<36))) and location~=lag(location). Do if sec1=69. compute sec1=62. Else if sec2<1. compute sec2=62. Else if sec3<1. compute sec3=62. end if. End if. freq sec1 sec2 sec3. do if startslt>1 and (location>0 and location<5) and (lag(main1)=2 or lag(main1)=3) and (main1=11 or (main1>61 and main1<69)) and sec1=69. compute sec1=1. End if. freq sec1. temp. select if sec2>0. freq main2 ict2 av2. if sec2>0 and main2=-5 main2=main1. if sec2>0 and ict2=-5 ict2=ict1. if sec2>0 and av2=-5 av2=av1. temp. select if sec3>0. freq main3 ict3. if sec3>0 and main3=-5 main3=main1. if sec3>0 and ict3=-5 ict3=ict1. if sec3>0 and av3=-5 av3=av1. execute. *inside / outside variable. Do if location=36 or location=37 or location=38 or location=41 or location=42 or location=43 or firstact=1701 or firstact=2504 or second=1701 or second=2504 or third=1701 or third=2504. compute inout1=3. Else if location=30 or location=31 or location=32 or location=33 or location=34 or location=35 or location=39 or location=40 or firstact=701 or firstact=705 or firstact=901 or firstact=1204 or firstact=1801 or firstact=1802 or firstact=1803 or firstact=1807 or firstact=1901 or firstact=1903 or firstact=1904 or firstact=1905 or firstact=1910 or firstact=1911 or firstact=1913 or firstact=1914 or firstact=2101 or firstact=2102 or firstact=3602 or second=701 or second=705 or second=901 or second=1204 or second=1801 or second=1802 or second=1803 or second=1807 or second=1901 or second=1903 or second=1904 or second=1905 or second=1910 or second=1911 or second=1913 or second=1914 or second=2101 or second=2102 or second=3602. compute inout1=2. Else if location=7 or location=8 or (location>9 and location<23) or location=24 or location=25 or location=26 or location=27 or location=29 or firstact=203 or firstact=204 or firstact=206 or firstact=207 or firstact=208 or firstact=209 or firstact=405 or firstact=601 or firstact=602 or firstact=603 or firstact=604 or firstact=702 or firstact=703 or firstact=704 or firstact=708 or firstact=801 or firstact=805 or firstact=809 or firstact=810 or firstact=811 or firstact=812 or firstact=813 or firstact=814 or firstact=815 or firstact=816 or firstact=818 or firstact=1001 or firstact=1002 or firstact=1003 or firstact=1004 or firstact=1006 or firstact=1007 or firstact=1008 or firstact=1101 or firstact=1102 or firstact=1103 or firstact=1105 or firstact=1106 or firstact=1301 or firstact=1401 or firstact=1402 or firstact=1404 or firstact=1405 or firstact=1406 or firstact=1408 or firstact=1302 or firstact=1601 or firstact=1603 or firstact=1806 or firstact=1912 or firstact=2301 or firstact=2302 or firstact=2303 or firstact=2304 or firstact=2306 or firstact=2307 or firstact=2401 or firstact=2402 or firstact=2503 or firstact=2507 or firstact=2601 or firstact=2601 or firstact=2701 or firstact=2702 or firstact=2703 or firstact=2801 or firstact=2802 or firstact=2803 or firstact=2804 or firstact=2901 or firstact=3101 or firstact=3102 or firstact=3103 or firstact=3302 or firstact=3702 or firstact=3901 or firstact=4001 or firstact=4004 or firstact=4007 or firstact=4008 or firstact=4009. compute inout1=1. Else. compute inout1=-8. End if. freq inout1. temp. select if inout1=-8. freq firstact location. if hldid=lag(hldid) and persid=lag(persid) and inout1=-8 and location<44 and (firstact<502 or (firstact>505 and firstact<1201) or (firstact>1204 and firstact<1702) or (firstact>2102 and firstact<2305) or (firstact>2305 and firstact<2404) or (firstact>2501 and firstact<2504) or (firstact>2504 and firstact<3602) or (firstact>3602 and firstact<9999)) and lag(inout1)=1 inout1=1. freq inout1. if hldid=lag(hldid) and persid=lag(persid) and inout1=-8 and (location>0 and location<5) and (lag(location)>35 and lag(location)<45) inout1=1. freq inout1. Do if sec3>0. compute inout3=inout1. End if. Do if sec2>0. compute inout2=inout1. End if. freq inout2 inout3. if sec3=62 and time1<31 inout3=2. if sec2=62 and time1<31 inout2=2. freq inout3. temp. select if sec2>0 and inout2<0. freq inout2. *code location. Do if location=1. compute eloc1=1. Else if location=2 or location=3 or location=4. compute eloc1=2. Else if (location=5 and ((firstact>302 and firstact<501) or lag(firstact)=503)) or location=17. compute eloc1=4. Else if location=5 or location=6. compute eloc1=3. Else if location=7 or location=8 or location=9 or (location>10 and location<17) or location=19 or location=20 or location=21 or location=24. compute eloc1=5. Else if location=23 or location=28. compute eloc1=6. Else if location=18. compute eloc1=7. Else if location=10 or (location>35 and location<45). compute eloc1=8. Else if location=22 or (location>24 and location<28) or (location>28 and location<36) or location=45. compute eloc1=9. Else. compute eloc1=-8. End if. freq eloc1. temp. select if eloc1=-8. freq firstact. *look at cases of possible miscoding of location at work or school. if hldid=lag(hldid) and persid=lag(persid) and firstact>302 and eloc1=3 and lag(eloc1)=4 eloc1=4. compute test=0. if hldid=lag(hldid) and persid=lag(persid) and ((eloc1=4 and lag(eloc1)=3) or (eloc1=3 and lag(eloc1)=4)) test=1. freq test. if hldid=11241 and persid=2 and realday=2 and startslt=34 eloc1=4. if hldid=11241 and persid=2 and realday=5 and startslt=20 eloc1=4. if hldid=11371 and persid=3 and realday=2 and startslt=36 eloc1=4. if hldid=20811 and persid=4 and realday=1 and startslt=30 eloc1=4. if hldid=20919 and persid=4 and realday=4 and startslt=36 eloc1=4. if hldid=30494 and persid=3 and realday=3 and startslt=64 eloc1=4. if hldid=30512 and persid=3 and realday=2 and startslt=39 eloc1=4. if hldid=30512 and persid=4 and realday=5 and startslt=19 eloc1=4. if hldid=30573 and persid=4 and realday=1 and startslt=19 eloc1=8. if hldid=30573 and persid=4 and realday=1 and startslt=19 eloc1=4. if hldid=30573 and persid=4 and realday=1 and startslt=19 location=44. if hldid=30573 and persid=4 and realday=1 and startslt=36 location=44. if hldid=30573 and persid=4 and realday=1 and startslt=36 eloc1=8. if hldid=30573 and persid=4 and realday=1 and startslt=36 eloc1=4. if hldid=30573 and persid=4 and realday=1 and startslt=39 eloc1=8. if hldid=30573 and persid=4 and realday=1 and startslt=39 eloc1=4. if hldid=30573 and persid=4 and realday=1 and startslt=39 location=44. if hldid=30573 and persid=4 and realday=1 and startslt=48 location=44. if hldid=30573 and persid=4 and realday=1 and startslt=48 eloc1=8. if hldid=30573 and persid=4 and realday=1 and startslt=48 eloc1=4. if hldid=30573 and persid=4 and realday=2 and startslt=18 eloc1=8. if hldid=30573 and persid=4 and realday=2 and startslt=18 eloc1=4. if hldid=30573 and persid=4 and realday=2 and startslt=18 location=44. if hldid=30573 and persid=4 and realday=2 and startslt=36 location=44. if hldid=30573 and persid=4 and realday=2 and startslt=36 eloc1=8. if hldid=30573 and persid=4 and realday=2 and startslt=36 eloc1=4. if hldid=30573 and persid=4 and realday=2 and startslt=39 eloc1=8. if hldid=30573 and persid=4 and realday=2 and startslt=39 eloc1=4. if hldid=30573 and persid=4 and realday=2 and startslt=39 location=44. if hldid=30573 and persid=4 and realday=2 and startslt=48 location=44. if hldid=30573 and persid=4 and realday=2 and startslt=48 eloc1=8. if hldid=30573 and persid=4 and realday=2 and startslt=48 eloc1=4. if hldid=30573 and persid=4 and realday=3 and startslt=19 eloc1=8. if hldid=30573 and persid=4 and realday=3 and startslt=19 eloc1=4. if hldid=30573 and persid=4 and realday=3 and startslt=19 location=44. if hldid=30573 and persid=4 and realday=3 and startslt=36 location=44. if hldid=30573 and persid=4 and realday=3 and startslt=36 eloc1=8. if hldid=30573 and persid=4 and realday=3 and startslt=36 eloc1=4. if hldid=30573 and persid=4 and realday=3 and startslt=39 eloc1=8. if hldid=30573 and persid=4 and realday=3 and startslt=39 eloc1=4. if hldid=30573 and persid=4 and realday=3 and startslt=39 location=44. if hldid=30573 and persid=4 and realday=3 and startslt=48 location=44. if hldid=30573 and persid=4 and realday=3 and startslt=48 eloc1=8. if hldid=30573 and persid=4 and realday=3 and startslt=48 eloc1=4. if hldid=30573 and persid=4 and realday=6 and startslt=20 eloc1=8. if hldid=30573 and persid=4 and realday=6 and startslt=20 eloc1=4. if hldid=30573 and persid=4 and realday=6 and startslt=20 location=44. if hldid=30573 and persid=4 and realday=6 and startslt=36 location=44. if hldid=30573 and persid=4 and realday=6 and startslt=36 eloc1=8. if hldid=30573 and persid=4 and realday=6 and startslt=36 eloc1=4. if hldid=30573 and persid=4 and realday=6 and startslt=39 eloc1=8. if hldid=30573 and persid=4 and realday=6 and startslt=39 eloc1=4. if hldid=30573 and persid=4 and realday=6 and startslt=39 location=44. if hldid=30573 and persid=4 and realday=6 and startslt=48 location=44. if hldid=30573 and persid=4 and realday=6 and startslt=48 eloc1=8. if hldid=30573 and persid=4 and realday=6 and startslt=48 eloc1=4. if hldid=30573 and persid=4 and realday=7 and startslt=20 eloc1=8. if hldid=30573 and persid=4 and realday=7 and startslt=20 eloc1=4. if hldid=30573 and persid=4 and realday=7 and startslt=20 location=44. if hldid=30573 and persid=4 and realday=7 and startslt=36 location=44. if hldid=30573 and persid=4 and realday=7 and startslt=36 eloc1=8. if hldid=30573 and persid=4 and realday=7 and startslt=36 eloc1=4. if hldid=30713 and persid=2 and realday=2 and startslt=38 eloc1=4. if hldid=30713 and persid=2 and realday=2 and startslt=34 eloc1=4. if hldid=40128 and persid=3 and realday=4 and startslt=18 eloc1=4. if hldid=40165 and persid=3 and realday=4 and startslt=20 eloc1=4. if hldid=40410 and persid=3 and realday=1 and startslt=19 eloc1=4. if hldid=40410 and persid=3 and realday=2 and startslt=20 eloc1=4. if hldid=40410 and persid=3 and realday=5 and startslt=19 eloc1=4. if hldid=40410 and persid=4 and realday=1 and startslt=20 eloc1=4. if hldid=40410 and persid=4 and realday=2 and startslt=19 eloc1=4. if hldid=40410 and persid=4 and realday=3 and startslt=19 eloc1=4. if hldid=40410 and persid=4 and realday=5 and startslt=19 eloc1=4. if hldid=50024 and persid=2 and realday=2 and startslt=18 eloc1=3. if hldid=50500 and persid=3 and realday=2 and startslt=38 location=37. if hldid=50500 and persid=3 and realday=2 and startslt=38 eloc1=8. if hldid=60502 and persid=3 and realday=5 and startslt=25 eloc1=4. execute. Do if main1=64 and lag(main1)=7 and hldid=lag(hldid) and persid=lag(persid). compute main1=63. Else if main1=63 and lag(main1)=15 and hldid=lag(hldid) and persid=lag(persid). compute main1=64. End if. sort cases by hldid(a) persid(a) realday(a) startslt(d). Do if main1=64 and lag(main1)=7 and hldid=lag(hldid) and persid=lag(persid). compute main1=63. Else if main1=63 and lag(main1)=15 and hldid=lag(hldid) and persid=lag(persid). compute main1=64. End if. sort cases by hldid(a) persid(a) realday(a) startslt(a). Do if sec3=62. compute eloc3=8. Else if sec3>0. compute eloc3=eloc1. End if. Do if sec2=62. compute eloc2=8. Else if sec2>0. compute eloc2=eloc1. End if. freq eloc2 eloc3. temp. select if sec2>0 and eloc2<0. freq eloc2. *make mode of transport. compute mtrav1=-7. Do if location=36. compute mtrav1=1. Else if location=37 or location=38 or location=41 or location=42. compute mtrav1=2. Else if location=40. compute mtrav1=3. Else if location=39. compute mtrav1=4. Else if location=43 or location=44. compute mtrav1=5. Else if firstact=1701 or firstact=2504. compute mtrav1=1. Else if firstact=1903 or firstact=2101 or firstact=2102. compute mtrav1=3. Else if firstact=1910. compute mtrav1=4. Else if eloc1=8. compute mtrav1=5. End if. freq mtrav1. cro mtrav1 by inout1. compute test=0. if mtrav1=-7 and inout1=3 test=1. freq test. if test=1 inout2=1. if test=1 eloc1=8. Do if sec2=62 and mtrav1=-7. compute mtrav2=5. Else if sec2>0. compute mtrav2=mtrav1. End if. Do if sec3=62 and mtrav1=-7. compute mtrav3=5. Else if sec3>0. compute mtrav3=mtrav1. End if. execute. if test=1 mtrav1=1. freq mtrav2 mtrav3. *fix some additional location errors. if hldid=30824 and persid=1 and realday=1 and startslt=66 inout1=2. if hldid=40085 and persid=3 and realday=7 and (startslt=24 or startslt=44) inout1=2. if hldid=40085 and persid=3 and realday=7 and (startslt>24 and startslt<44) inout1=1. if hldid=60175 and persid=1 and realday=4 and startslt=42 inout1=2. if hldid=60489 and persid=2 and realday=5 and startslt=20 mtrav1=1. if hldid=60796 and persid=2 and realday=1 and startslt=19 inout1=2. execute. *make who else present variables. Do if whowith2<1 and whowith3>0. compute whowith2=whowith3. compute whowith3=-5. End if. Do if whowith1<1 and whowith2>0. compute whowith1=whowith2. compute whowith2=-5. End if. freq whowith1. *fix some errors. if hldid=10021 and persid=6 and realday=2 and whowith1=36 whowith1=35. if hldid=41006 and persid=5 and realday=2 and whowith1=36 whowith1=35. if hldid=60011 and persid=3 and realday=3 and whowith1=36 whowith1=35. if hldid=10166 and persid=3 and realday=1 and whowith1=37 whowith1=35. execute. recode whowith1 whowith2 whowith3 (36 thru hi=-5). freq whowith1. temp. select if whowith1=0. freq firstact. compute alone1=0. if whowith1=0 alone1=1. compute child1=0. if whowith1=2 or whowith1=8 or whowith1=11 or whowith1=16 or whowith2=2 or whowith2=8 or whowith2=11 or whowith2=16 or whowith3=2 or whowith3=8 or whowith3=11 or whowith3=16 or firstact=1101 or firstact=1102 or firstact=1103 or firstact=1104 or firstact=1105 or firstact=1107 or firstact=1108 or firstact=1109 or second=1101 or second=1102 or second=1103 or second=1104 or second=1105 or second=1107 or second=1108 or second=1109 child1=1. compute sppart1=0. if whowith1=1 or whowith2=1 or whowith3=1 sppart1=1. compute oad1=0. if whowith1=1 or whowith2=1 or whowith3=1 or (whowith1>2 and whowith1<8) or whowith1=9 or whowith1=10 or (whowith1>11 and whowith1<16) or whowith1>16 or (whowith2>2 and whowith2<8) or whowith2=9 or whowith2=10 or (whowith2>11 and whowith2<16) or whowith2>16 or (whowith3>2 and whowith3<8) or whowith3=9 or whowith3=10 or (whowith3>11 and whowith3<16) or whowith3>16 oad1=1. freq alone1 child1 sppart1 oad1. cro whowith1 by alone1. temp. select if child1=1. freq whowith1 firstact. temp. select if sppart1=1. freq whowith1 whowith2. temp. select if oad1=1. freq whowith1 whowith2. if sec2>0 alone2=alone1. if sec3>0 alone3=alone1. if sec2>0 child2=child1. if sec3>0 child3=child1. if sec2>0 sppart2=sppart1. if sec3>0 sppart3=sppart1. if sec2>0 oad2=oad1. if sec3>0 oad3=oad1. freq alone2 alone3 child2 child3 sppart2 sppart3 oad2 oad3. *deal with time variables where multiple activities in the episode. Do if sec3>0. compute end3=end1. compute end2=end1-time1/3. compute end1=end2-time1/3. compute start2=start1+time1/3. compute start3=start2+time1/3. compute clockst2=clockst1. compute clockst3=clockst1. compute time3=time1/3. compute time2=time1/3. compute time1=time1/3. End if. freq end2 end3 start2 start3 clockst2 clockst3. compute tottime=0. execute. if sec2<1 tottime=time1. if sec2>0 and sec3<1 tottime=time1. if sec3>0 tottime=time1+time2+time3. aggregate outfile=* mode=addvariables /break hldid persid realday /tottime2=SUM(tottime). freq tottime2. Do if sec2>0 and sec3<1. compute end2=end1. compute end1=end2-time1/3. compute start2=start1+time1*2/3. compute clockst2=clockst1. compute time2=time1*1/3. compute time1=time1*2/3. End if. freq end2 start2 clockst2. compute tottime=0. execute. if sec2<1 tottime=time1. if sec2>0 and sec3<1 tottime=time1+time2. if sec3>0 tottime=time1+time2+time3. aggregate outfile=* mode=addvariables /break hldid persid realday /tottime3=SUM(tottime). freq tottime3. formats clockst1 to clockst3 (F8.2). compute animal=0. Do if (firstact=806 or firstact=816 or firstact=1913 or second=806 or second=816 or second=1913) and time2=-5 and time3=-5. compute animal=time1. Else if (firstact=806 or firstact=816 or firstact=1913 or second=806 or second=816 or second=1913) and time2>-5 and time3=-5. compute animal=time1+time2. Else if (firstact=806 or firstact=816 or firstact=1913 or second=806 or second=816 or second=1913) and time2>-5 and time3>-5. compute animal=time1+time2+time3. Else if (third=806 or third=816 or third=1913) and time3=-5. compute animal=time2. Else if fourth=806 or fourth=816 or fourth=1913. compute animal=time3. End if. desc animal. temp. select if animal>0. desc animal. compute studmark=0. if firstact=402 or firstact=403 or second=402 or second=403 or third=402 or third=403 or fourth=402 or fourth=403 studmark=1. freq studmark. cro firstact by studmark. compute caremark=0. if main1=32 or main2=32 or main3=32 or sec1=32 or sec2=32 or sec3=32 caremark=1. freq caremark. vector clockst=clockst1 to clockst3 /start=start1 to start3 /end=end1 to end3 /time= time1 to time3 /main=main1 to main3 /sec=sec1 to sec3 /av=av1 to av3 /inout= inout1 to inout3 /eloc=eloc1 to eloc3 /ict=ict1 to ict3 /mtrav=mtrav1 to mtrav3 /alone=alone1 to alone3 /child=child1 to child3 /sppart=sppart1 to sppart3 /oad=oad1 to oad3. loop i=1 to 3. compute countrya=countrya. compute survey=survey. compute swave=swave. compute hldid=hldid. compute persid=persid. compute id=id. compute day=day. compute diary=diary. compute time=time(i). compute clockst=clockst(i). compute start=start(i). compute end=end(i). compute main=main(i). compute sec=sec(i). compute av=av(i). compute inout=inout(i). compute eloc=eloc(i). compute ict=ict(i). compute mtrav=mtrav(i). compute alone=alone(i). compute child=child(i). compute sppart=sppart(i). compute oad=oad(i). compute animal=animal. compute studmark=studmark. compute caremark=caremark. xsave outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\diary.sav' /keep = countrya survey swave hldid persid id day diary time clockst start end main sec av inout eloc ict mtrav alone child sppart oad animal studmark caremark. end loop. execute. rename variables (hldid=qno). recode firstact to location (-5=0). save outfile='C:\Documents and Settings\All Users\Documents\time-use-library\UK\1987\kdiaryt-amended.sav' /keep qno persid realday startslt endslt firstact second third fourth whowith1 whowith2 whowith3 location actdesc dayno startday header town /compressed. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\diary.sav'. sort cases by hldid persid id. select if time>-5. execute. compute epnum=-5. if start=0 epnum=1. if hldid=lag(hldid) and persid=lag(persid) and id=lag(id) epnum=lag(epnum)+1. freq epnum. vector mainx(69). Loop i=1 to 69. compute mainx(i)=0. if main=i mainx(i)=time. End loop. execute. vector avx(41). Loop i=1 to 41. compute avx(i)=0. if av=i avx(i)=time. End loop. execute. compute eat=0. compute sleep=0. compute extrav=0. compute pcare=0. compute anycare=0. compute miss=0. if main=69 miss=time. if main=5 or main=6 or main=18 or main=19 or main=39 or sec=5 or sec=6 or sec=18 or sec=19 or sec=39 or eloc=6 eat=1. if main=2 or main=3 or main=12 or main=55 or sec=2 or sec=3 or sec=12 or sec=55 sleep=1. if main=11 or (main>41 and main<48) or (main>61 and main<69) or sec=11 or (sec>41 and sec<48) or (sec>61 and sec<69) or eloc=8 extrav=1. if main=1 or main=4 or main=25 or sec=1 or sec=4 or sec=25 pcare=1. if (main>26 and main<33) or main=66 or (sec>26 and sec<33) or sec=66 anycare=1. desc miss. cro main by eat sleep extrav pcare anycare. sort cases by survey hldid persid id epnum. match files files=* table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\adddate.sav' /BY countrya hldid. execute. temp. select if id=1 and month=6. cro day by startday. compute cday=-8. do if month=6 and startday=7. if id=1 cday=8. if id=2 cday=9. if id=3 cday=10. if id=4 cday=11. if id=5 cday=12. if id=6 cday=13. if id=7 cday=14. Else if month=6 and startday=11. if id=1 cday=13. if id=2 cday=14. if id=3 cday=15. if id=4 cday=16. if id=5 cday=17. if id=6 cday=18. if id=7 cday=19. Else if month=6 and startday=21. if id=1 cday=23. if id=2 cday=24. if id=3 cday=25. if id=4 cday=26. if id=5 cday=27. if id=6 cday=28. if id=7 cday=29. End if. cro cday by month day. temp. select if id=1 and month=5. cro startday by day. do if month=5 and startday=1. if id=1 and day=2 cday=4. if id=2 and day=3 cday=5. if id=3 and day=4 cday=6. if id=4 and day=5 cday=7. if id=5 and day=6 cday=8. if id=6 and day=7 cday=9. if id=7 and day=1 cday=10. if id=1 and day=7 cday=2. if id=2 and day=1 cday=3. if id=3 and day=2 cday=4. if id=4 and day=3 cday=5. if id=5 and day=4 cday=6. if id=6 and day=5 cday=7. if id=7 and day=6 cday=8. Else if month=5 and startday=2. if id=1 and day=1 cday=3. if id=2 and day=2 cday=4. if id=3 and day=3 cday=5. if id=4 and day=4 cday=6. if id=5 and day=5 cday=7. if id=6 and day=6 cday=8. if id=7 and day=7 cday=9. if id=1 and day=2 cday=4. if id=2 and day=3 cday=5. if id=3 and day=4 cday=6. if id=4 and day=5 cday=7. if id=5 and day=6 cday=8. if id=6 and day=7 cday=9. if id=7 and day=1 cday=10. Else if month=5 and startday=3. if id=1 cday=4. if id=2 cday=5. if id=3 cday=6. if id=4 cday=7. if id=5 cday=8. if id=6 cday=9. if id=7 cday=10. Else if month=5 and startday=4. if id=1 cday=11. if id=2 cday=12. if id=3 cday=13. if id=4 cday=14. if id=5 cday=15. if id=6 cday=16. if id=7 cday=17. Else if month=5 and startday=5. if id=1 and day=2 cday=11. if id=2 and day=3 cday=12. if id=3 and day=4 cday=13. if id=4 and day=5 cday=14. if id=5 and day=6 cday=15. if id=6 and day=7 cday=16. if id=7 and day=1 cday=17. if id=1 and day=4 cday=6. if id=2 and day=5 cday=7. if id=3 and day=6 cday=8. if id=4 and day=7 cday=9. if id=5 and day=1 cday=10. if id=6 and day=2 cday=11. if id=7 and day=3 cday=12. if id=1 and day=5 cday=7. if id=2 and day=6 cday=8. if id=3 and day=7 cday=9. if id=4 and day=1 cday=10. if id=5 and day=2 cday=11. if id=6 and day=3 cday=12. if id=7 and day=4 cday=13. Else if month=5 and startday=6. if id=1 and day=4 cday=13. if id=2 and day=5 cday=14. if id=3 and day=6 cday=15. if id=4 and day=7 cday=16. if id=5 and day=1 cday=17. if id=6 and day=2 cday=18. if id=7 and day=3 cday=19. if id=1 and day=5 cday=7. if id=2 and day=6 cday=8. if id=3 and day=7 cday=9. if id=4 and day=1 cday=10. if id=5 and day=2 cday=11. if id=6 and day=3 cday=12. if id=7 and day=4 cday=13. Else if month=5 and startday=7. if id=1 cday=8. if id=2 cday=9. if id=3 cday=10. if id=4 cday=11. if id=5 cday=12. if id=6 cday=13. if id=7 cday=14. Else if month=5 and startday=8. if id=1 cday=9. if id=2 cday=10. if id=3 cday=11. if id=4 cday=12. if id=5 cday=13. if id=6 cday=14. if id=7 cday=15. Else if month=5 and startday=10. if id=1 cday=11. if id=2 cday=12. if id=3 cday=13. if id=4 cday=14. if id=5 cday=15. if id=6 cday=16. if id=7 cday=17. Else if month=5 and startday=11. if id=1 cday=12. if id=2 cday=13. if id=3 cday=14. if id=4 cday=15. if id=5 cday=16. if id=6 cday=17. if id=7 cday=18. Else if month=5 and startday=12. if id=1 cday=13. if id=2 cday=14. if id=3 cday=15. if id=4 cday=16. if id=5 cday=17. if id=6 cday=18. if id=7 cday=19. Else if month=5 and startday=13. if id=1 and day=5 cday=14. if id=2 and day=6 cday=15. if id=3 and day=7 cday=16. if id=4 and day=1 cday=17. if id=5 and day=2 cday=18. if id=6 and day=3 cday=19. if id=7 and day=4 cday=20. if id=1 and day=7 cday=16. if id=2 and day=1 cday=17. if id=3 and day=2 cday=18. if id=4 and day=3 cday=19. if id=5 and day=4 cday=20. if id=6 and day=5 cday=21. if id=7 and day=6 cday=22. Else if month=5 and startday=14. if id=1 cday=15. if id=2 cday=16. if id=3 cday=17. if id=4 cday=18. if id=5 cday=19. if id=6 cday=20. if id=7 cday=21. Else if month=5 and startday=18. if id=1 cday=19. if id=2 cday=20. if id=3 cday=21. if id=4 cday=22. if id=5 cday=23. if id=6 cday=24. if id=7 cday=25. Else if month=5 and startday=19. if id=1 cday=20. if id=2 cday=21. if id=3 cday=22. if id=4 cday=23. if id=5 cday=24. if id=6 cday=25. if id=7 cday=26. Else if month=5 and startday=20. if id=1 cday=21. if id=2 cday=22. if id=3 cday=23. if id=4 cday=24. if id=5 cday=25. if id=6 cday=26. if id=7 cday=27. Else if month=5 and startday=24. if id=1 cday=25. if id=2 cday=26. if id=3 cday=27. if id=4 cday=28. if id=5 cday=29. if id=6 cday=30. if id=7 cday=31. Else if month=5 and startday=26. if id=1 cday=27. if id=2 cday=28. if id=3 cday=29. if id=4 cday=30. if id=5 cday=31. if id=6 cday=1. if id=6 month=6. if id=7 cday=2. if id=7 month=6. Else if month=5 and startday=27. if id=1 cday=28. if id=2 cday=29. if id=3 cday=30. if id=4 cday=31. if id=5 cday=1. if id=5 month=6. if id=6 cday=2. if id=6 month=6. if id=7 cday=3. if id=7 month=6. End if. cro cday by month day. temp. select if id=1 and month=4. cro startday by day. do if month=4 and startday=1. if id=1 and day=3 cday=7. if id=2 and day=4 cday=8. if id=3 and day=5 cday=9. if id=4 and day=6 cday=10. if id=5 and day=7 cday=11. if id=6 and day=1 cday=12. if id=7 and day=2 cday=13. if id=1 and day=5 cday=2. if id=2 and day=6 cday=3. if id=3 and day=7 cday=4. if id=4 and day=1 cday=5. if id=5 and day=2 cday=6. if id=6 and day=3 cday=7. if id=7 and day=4 cday=8. if id=1 and day=6 cday=3. if id=2 and day=7 cday=4. if id=3 and day=1 cday=5. if id=4 and day=2 cday=6. if id=5 and day=3 cday=7. if id=6 and day=4 cday=8. if id=7 and day=5 cday=9. Else if month=4 and startday=2. if id=1 and day=1 cday=5. if id=2 and day=2 cday=6. if id=3 and day=3 cday=7. if id=4 and day=4 cday=8. if id=5 and day=5 cday=9. if id=6 and day=6 cday=10. if id=7 and day=7 cday=11. if id=1 and day=3 cday=7. if id=2 and day=4 cday=8. if id=3 and day=5 cday=9. if id=4 and day=6 cday=10. if id=5 and day=7 cday=11. if id=6 and day=1 cday=12. if id=7 and day=2 cday=13. if id=1 and day=5 cday=9. if id=2 and day=6 cday=10. if id=3 and day=7 cday=11. if id=4 and day=1 cday=12. if id=5 and day=2 cday=13. if id=6 and day=3 cday=14. if id=7 and day=4 cday=15. if id=1 and day=6 cday=3. if id=2 and day=7 cday=4. if id=3 and day=1 cday=5. if id=4 and day=2 cday=6. if id=5 and day=3 cday=7. if id=6 and day=4 cday=8. if id=7 and day=5 cday=9. if id=1 and day=7 cday=4. if id=2 and day=1 cday=5. if id=3 and day=2 cday=6. if id=4 and day=3 cday=7. if id=5 and day=4 cday=8. if id=6 and day=5 cday=9. if id=7 and day=6 cday=10. Else if month=4 and startday=3. if id=1 and day=1 cday=5. if id=2 and day=2 cday=6. if id=3 and day=3 cday=7. if id=4 and day=4 cday=8. if id=5 and day=5 cday=9. if id=6 and day=6 cday=10. if id=7 and day=7 cday=11. if id=1 and day=2 cday=6. if id=2 and day=3 cday=7. if id=3 and day=4 cday=8. if id=4 and day=5 cday=9. if id=5 and day=6 cday=10. if id=6 and day=7 cday=11. if id=7 and day=1 cday=12. if id=1 and day=6 cday=10. if id=2 and day=7 cday=11. if id=3 and day=1 cday=12. if id=4 and day=2 cday=13. if id=5 and day=3 cday=14. if id=6 and day=4 cday=15. if id=7 and day=5 cday=16. if id=1 and day=7 cday=4. if id=2 and day=1 cday=5. if id=3 and day=2 cday=6. if id=4 and day=3 cday=7. if id=5 and day=4 cday=8. if id=6 and day=5 cday=9. if id=7 and day=6 cday=10. Else if month=4 and startday=4. if id=1 and day=1 cday=5. if id=2 and day=2 cday=6. if id=3 and day=3 cday=7. if id=4 and day=4 cday=8. if id=5 and day=5 cday=9. if id=6 and day=6 cday=10. if id=7 and day=7 cday=11. if id=1 and day=2 cday=6. if id=2 and day=3 cday=7. if id=3 and day=4 cday=8. if id=4 and day=5 cday=9. if id=5 and day=6 cday=10. if id=6 and day=7 cday=11. if id=7 and day=1 cday=12. if id=1 and day=3 cday=7. if id=2 and day=4 cday=8. if id=3 and day=5 cday=9. if id=4 and day=6 cday=10. if id=5 and day=7 cday=11. if id=6 and day=1 cday=12. if id=7 and day=2 cday=13. if id=1 and day=4 cday=8. if id=2 and day=5 cday=9. if id=3 and day=6 cday=10. if id=4 and day=7 cday=11. if id=5 and day=1 cday=12. if id=6 and day=2 cday=13. if id=7 and day=3 cday=14. Else if month=4 and startday=5. if id=1 and day=1 cday=12. if id=2 and day=2 cday=13. if id=3 and day=3 cday=14. if id=4 and day=4 cday=15. if id=5 and day=5 cday=16. if id=6 and day=6 cday=17. if id=7 and day=7 cday=18. if id=1 and day=2 cday=6. if id=2 and day=3 cday=7. if id=3 and day=4 cday=8. if id=4 and day=5 cday=9. if id=5 and day=6 cday=10. if id=6 and day=7 cday=11. if id=7 and day=1 cday=12. if id=1 and day=3 cday=7. if id=2 and day=4 cday=8. if id=3 and day=5 cday=9. if id=4 and day=6 cday=10. if id=5 and day=7 cday=11. if id=6 and day=1 cday=12. if id=7 and day=2 cday=13. if id=1 and day=5 cday=9. if id=2 and day=6 cday=10. if id=3 and day=7 cday=11. if id=4 and day=1 cday=12. if id=5 and day=2 cday=13. if id=6 and day=3 cday=14. if id=7 and day=4 cday=15. if id=1 and day=6 cday=10. if id=2 and day=7 cday=11. if id=3 and day=1 cday=12. if id=4 and day=2 cday=13. if id=5 and day=3 cday=14. if id=6 and day=4 cday=15. if id=7 and day=5 cday=16. Else if month=4 and startday=6. if id=1 and day=2 cday=13. if id=2 and day=3 cday=14. if id=3 and day=4 cday=15. if id=4 and day=5 cday=16. if id=5 and day=6 cday=17. if id=6 and day=7 cday=18. if id=7 and day=1 cday=19. if id=1 and day=3 cday=7. if id=2 and day=4 cday=8. if id=3 and day=5 cday=9. if id=4 and day=6 cday=10. if id=5 and day=7 cday=11. if id=6 and day=1 cday=12. if id=7 and day=2 cday=13. if id=1 and day=6 cday=10. if id=2 and day=7 cday=11. if id=3 and day=1 cday=12. if id=4 and day=2 cday=13. if id=5 and day=3 cday=14. if id=6 and day=4 cday=15. if id=7 and day=5 cday=16. Else if month=4 and startday=7. if id=1 and day=2 cday=13. if id=2 and day=3 cday=14. if id=3 and day=4 cday=15. if id=4 and day=5 cday=16. if id=5 and day=6 cday=17. if id=6 and day=7 cday=18. if id=7 and day=1 cday=19. if id=1 and day=3 cday=14. if id=2 and day=4 cday=15. if id=3 and day=5 cday=16. if id=4 and day=6 cday=17. if id=5 and day=7 cday=18. if id=6 and day=1 cday=19. if id=7 and day=2 cday=20. if id=1 and day=4 cday=8. if id=2 and day=5 cday=9. if id=3 and day=6 cday=10. if id=4 and day=7 cday=11. if id=5 and day=1 cday=12. if id=6 and day=2 cday=13. if id=7 and day=3 cday=14. if id=1 and day=5 cday=9. if id=2 and day=6 cday=10. if id=3 and day=7 cday=11. if id=4 and day=1 cday=12. if id=5 and day=2 cday=13. if id=6 and day=3 cday=14. if id=7 and day=4 cday=15. if id=1 and day=7 cday=11. if id=2 and day=1 cday=12. if id=3 and day=2 cday=13. if id=4 and day=3 cday=14. if id=5 and day=4 cday=15. if id=6 and day=5 cday=16. if id=7 and day=6 cday=17. End if. Do if month=4 and startday=8. if id=1 and day=1 cday=12. if id=2 and day=2 cday=13. if id=3 and day=3 cday=14. if id=4 and day=4 cday=15. if id=5 and day=5 cday=16. if id=6 and day=6 cday=17. if id=7 and day=7 cday=18. if id=1 and day=3 cday=14. if id=2 and day=4 cday=15. if id=3 and day=5 cday=16. if id=4 and day=6 cday=17. if id=5 and day=7 cday=18. if id=6 and day=1 cday=19. if id=7 and day=2 cday=20. if id=1 and day=4 cday=15. if id=2 and day=5 cday=16. if id=3 and day=6 cday=17. if id=4 and day=7 cday=18. if id=5 and day=1 cday=19. if id=6 and day=2 cday=20. if id=7 and day=3 cday=21. if id=1 and day=5 cday=9. if id=2 and day=6 cday=10. if id=3 and day=7 cday=11. if id=4 and day=1 cday=12. if id=5 and day=2 cday=13. if id=6 and day=3 cday=14. if id=7 and day=4 cday=15. if id=1 and day=6 cday=10. if id=2 and day=7 cday=11. if id=3 and day=1 cday=12. if id=4 and day=2 cday=13. if id=5 and day=3 cday=14. if id=6 and day=4 cday=15. if id=7 and day=5 cday=16. Else if month=4 and startday=9. if id=1 and day=4 cday=15. if id=2 and day=5 cday=16. if id=3 and day=6 cday=17. if id=4 and day=7 cday=18. if id=5 and day=1 cday=19. if id=6 and day=2 cday=20. if id=7 and day=3 cday=21. if id=1 and day=5 cday=16. if id=2 and day=6 cday=17. if id=3 and day=7 cday=18. if id=4 and day=1 cday=19. if id=5 and day=2 cday=20. if id=6 and day=3 cday=21. if id=7 and day=4 cday=22. if id=1 and day=6 cday=10. if id=2 and day=7 cday=11. if id=3 and day=1 cday=12. if id=4 and day=2 cday=13. if id=5 and day=3 cday=14. if id=6 and day=4 cday=15. if id=7 and day=5 cday=16. if id=1 and day=7 cday=11. if id=2 and day=1 cday=12. if id=3 and day=2 cday=13. if id=4 and day=3 cday=14. if id=5 and day=4 cday=15. if id=6 and day=5 cday=16. if id=7 and day=6 cday=17. Else if month=4 and startday=10. if id=1 cday=11. if id=2 cday=12. if id=3 cday=13. if id=4 cday=14. if id=5 cday=15. if id=6 cday=16. if id=7 cday=17. End if. execute. do if month=4 and startday=11. if id=1 and day=1 cday=12. if id=2 and day=2 cday=13. if id=3 and day=3 cday=14. if id=4 and day=4 cday=15. if id=5 and day=5 cday=16. if id=6 and day=6 cday=17. if id=7 and day=7 cday=18. if id=1 and day=2 cday=13. if id=2 and day=3 cday=14. if id=3 and day=4 cday=15. if id=4 and day=5 cday=16. if id=5 and day=6 cday=17. if id=6 and day=7 cday=18. if id=7 and day=1 cday=19. if id=1 and day=4 cday=15. if id=2 and day=5 cday=16. if id=3 and day=6 cday=17. if id=4 and day=7 cday=18. if id=5 and day=1 cday=19. if id=6 and day=2 cday=20. if id=7 and day=3 cday=21. if id=1 and day=6 cday=17. if id=2 and day=7 cday=18. if id=3 and day=1 cday=19. if id=4 and day=2 cday=20. if id=5 and day=3 cday=21. if id=6 and day=4 cday=22. if id=7 and day=5 cday=23. if id=1 and day=7 cday=18. if id=2 and day=1 cday=19. if id=3 and day=2 cday=20. if id=4 and day=3 cday=21. if id=5 and day=4 cday=22. if id=6 and day=5 cday=23. if id=7 and day=6 cday=24. Else if month=4 and startday=12. if id=1 and day=1 cday=19. if id=2 and day=2 cday=20. if id=3 and day=3 cday=21. if id=4 and day=4 cday=22. if id=5 and day=5 cday=23. if id=6 and day=6 cday=24. if id=7 and day=7 cday=25. if id=1 and day=2 cday=13. if id=2 and day=3 cday=14. if id=3 and day=4 cday=15. if id=4 and day=5 cday=16. if id=5 and day=6 cday=17. if id=6 and day=7 cday=18. if id=7 and day=1 cday=19. if id=1 and day=5 cday=16. if id=2 and day=6 cday=17. if id=3 and day=7 cday=18. if id=4 and day=1 cday=19. if id=5 and day=2 cday=20. if id=6 and day=3 cday=21. if id=7 and day=4 cday=22. Else if month=4 and startday=13. if id=1 and day=2 cday=20. if id=2 and day=3 cday=21. if id=3 and day=4 cday=22. if id=4 and day=5 cday=23. if id=5 and day=6 cday=24. if id=6 and day=7 cday=25. if id=7 and day=1 cday=26. if id=1 and day=3 cday=14. if id=2 and day=4 cday=15. if id=3 and day=5 cday=16. if id=4 and day=6 cday=17. if id=5 and day=7 cday=18. if id=6 and day=1 cday=19. if id=7 and day=2 cday=20. if id=1 and day=4 cday=15. if id=2 and day=5 cday=16. if id=3 and day=6 cday=17. if id=4 and day=7 cday=18. if id=5 and day=1 cday=19. if id=6 and day=2 cday=20. if id=7 and day=3 cday=21. Else if month=4 and startday=14. if id=1 and day=2 cday=20. if id=2 and day=3 cday=21. if id=3 and day=4 cday=22. if id=4 and day=5 cday=23. if id=5 and day=6 cday=24. if id=6 and day=7 cday=25. if id=7 and day=1 cday=26. if id=1 and day=3 cday=21. if id=2 and day=4 cday=22. if id=3 and day=5 cday=23. if id=4 and day=6 cday=24. if id=5 and day=7 cday=25. if id=6 and day=1 cday=26. if id=7 and day=2 cday=27. if id=1 and day=4 cday=15. if id=2 and day=5 cday=16. if id=3 and day=6 cday=17. if id=4 and day=7 cday=18. if id=5 and day=1 cday=19. if id=6 and day=2 cday=20. if id=7 and day=3 cday=21. Else if month=4 and startday=15. if id=1 and day=3 cday=21. if id=2 and day=4 cday=22. if id=3 and day=5 cday=23. if id=4 and day=6 cday=24. if id=5 and day=7 cday=25. if id=6 and day=1 cday=26. if id=7 and day=2 cday=27. if id=1 and day=4 cday=22. if id=2 and day=5 cday=23. if id=3 and day=6 cday=24. if id=4 and day=7 cday=25. if id=5 and day=1 cday=26. if id=6 and day=2 cday=27. if id=7 and day=3 cday=28. if id=1 and day=5 cday=16. if id=2 and day=6 cday=17. if id=3 and day=7 cday=18. if id=4 and day=1 cday=19. if id=5 and day=2 cday=20. if id=6 and day=3 cday=21. if id=7 and day=4 cday=22. if id=1 and day=7 cday=18. if id=2 and day=1 cday=19. if id=3 and day=2 cday=20. if id=4 and day=3 cday=21. if id=5 and day=4 cday=22. if id=6 and day=5 cday=23. if id=7 and day=6 cday=24. Else if month=4 and startday=16. if id=1 and day=1 cday=19. if id=2 and day=2 cday=20. if id=3 and day=3 cday=21. if id=4 and day=4 cday=22. if id=5 and day=5 cday=23. if id=6 and day=6 cday=24. if id=7 and day=7 cday=25. if id=1 and day=3 cday=21. if id=2 and day=4 cday=22. if id=3 and day=5 cday=23. if id=4 and day=6 cday=24. if id=5 and day=7 cday=25. if id=6 and day=1 cday=26. if id=7 and day=2 cday=27. if id=1 and day=5 cday=23. if id=2 and day=6 cday=24. if id=3 and day=7 cday=25. if id=4 and day=1 cday=26. if id=5 and day=2 cday=27. if id=6 and day=3 cday=28. if id=7 and day=4 cday=29. if id=1 and day=6 cday=17. if id=2 and day=7 cday=18. if id=3 and day=1 cday=19. if id=4 and day=2 cday=20. if id=5 and day=3 cday=21. if id=6 and day=4 cday=22. if id=7 and day=5 cday=23. Else if month=4 and startday=17. if id=1 and day=1 cday=19. if id=2 and day=2 cday=20. if id=3 and day=3 cday=21. if id=4 and day=4 cday=22. if id=5 and day=5 cday=23. if id=6 and day=6 cday=24. if id=7 and day=7 cday=25. if id=1 and day=7 cday=18. if id=2 and day=1 cday=19. if id=3 and day=2 cday=20. if id=4 and day=3 cday=21. if id=5 and day=4 cday=22. if id=6 and day=5 cday=23. if id=7 and day=6 cday=24. Else if month=4 and startday=18. if id=1 and day=1 cday=19. if id=2 and day=2 cday=20. if id=3 and day=3 cday=21. if id=4 and day=4 cday=22. if id=5 and day=5 cday=23. if id=6 and day=6 cday=24. if id=7 and day=7 cday=25. if id=1 and day=2 cday=20. if id=2 and day=3 cday=21. if id=3 and day=4 cday=22. if id=4 and day=5 cday=23. if id=5 and day=6 cday=24. if id=6 and day=7 cday=25. if id=7 and day=1 cday=26. Else if month=4 and startday=19. if id=1 and day=2 cday=20. if id=2 and day=3 cday=21. if id=3 and day=4 cday=22. if id=4 and day=5 cday=23. if id=5 and day=6 cday=24. if id=6 and day=7 cday=25. if id=7 and day=1 cday=26. Else if month=4 and startday=20. if id=1 and day=2 cday=27. if id=2 and day=3 cday=28. if id=3 and day=4 cday=29. if id=4 and day=5 cday=30. if id=5 and day=6 cday=1. if id=5 and day=6 month=5. if id=6 and day=7 cday=2. if id=6 and day=7 month=5. if id=7 and day=1 cday=3. if id=7 and day=1 month=5. if id=1 and day=3 cday=21. if id=2 and day=4 cday=22. if id=3 and day=5 cday=23. if id=4 and day=6 cday=24. if id=5 and day=7 cday=25. if id=6 and day=1 cday=26. if id=7 and day=2 cday=27. if id=1 and day=4 cday=22. if id=2 and day=5 cday=23. if id=3 and day=6 cday=24. if id=4 and day=7 cday=25. if id=5 and day=1 cday=26. if id=6 and day=2 cday=27. if id=7 and day=3 cday=28. End if. execute. do if month=4 and startday=21. if id=1 and day=2 cday=27. if id=2 and day=3 cday=28. if id=3 and day=4 cday=29. if id=4 and day=5 cday=30. if id=5 and day=6 cday=1. if id=5 and day=6 month=5. if id=6 and day=7 cday=2. if id=6 and day=7 month=5. if id=7 and day=1 cday=3. if id=7 and day=1 month=5. if id=1 and day=4 cday=22. if id=2 and day=5 cday=23. if id=3 and day=6 cday=24. if id=4 and day=7 cday=25. if id=5 and day=1 cday=26. if id=6 and day=2 cday=27. if id=7 and day=3 cday=28. if id=1 and day=5 cday=23. if id=2 and day=6 cday=24. if id=3 and day=7 cday=25. if id=4 and day=1 cday=26. if id=5 and day=2 cday=27. if id=6 and day=3 cday=28. if id=7 and day=4 cday=29. Else if month=4 and startday=22. if id=1 and day=3 cday=28. if id=2 and day=4 cday=29. if id=3 and day=5 cday=30. if id=4 and day=6 cday=1. if id=4 and day=6 month=5. if id=5 and day=7 cday=2. if id=5 and day=7 month=5. if id=6 and day=1 cday=3. if id=6 and day=1 month=5. if id=7 and day=2 cday=4. if id=7 and day=3 month=5. if id=1 and day=4 cday=29. if id=2 and day=5 cday=30. if id=3 and day=6 cday=1. if id=3 and day=6 month=5. if id=4 and day=7 cday=2. if id=4 and day=7 month=5. if id=5 and day=1 cday=3. if id=5 and day=1 month=5. if id=6 and day=2 cday=4. if id=6 and day=2 month=5. if id=7 and day=3 cday=5. if id=7 and day=3 month=5. if id=1 and day=5 cday=23. if id=2 and day=6 cday=24. if id=3 and day=7 cday=25. if id=4 and day=1 cday=26. if id=5 and day=2 cday=27. if id=6 and day=3 cday=28. if id=7 and day=4 cday=29. if id=1 and day=6 cday=24. if id=2 and day=7 cday=25. if id=3 and day=1 cday=26. if id=4 and day=2 cday=27. if id=5 and day=3 cday=28. if id=6 and day=4 cday=29. if id=7 and day=5 cday=30. Else if month=4 and startday=23. if id=1 and day=1 cday=26. if id=2 and day=2 cday=27. if id=3 and day=3 cday=28. if id=4 and day=4 cday=29. if id=5 and day=5 cday=30. if id=6 and day=6 cday=1. if id=6 and day=6 month=5. if id=7 and day=7 cday=2. if id=7 and day=7 month=5. if id=1 and day=2 cday=27. if id=2 and day=3 cday=28. if id=3 and day=4 cday=29. if id=4 and day=5 cday=30. if id=5 and day=6 cday=1. if id=5 and day=6 month=5. if id=6 and day=7 cday=2. if id=6 and day=7 month=5. if id=7 and day=1 cday=3. if id=7 and day=1 month=5. if id=1 and day=6 cday=24. if id=2 and day=7 cday=25. if id=3 and day=1 cday=26. if id=4 and day=2 cday=27. if id=5 and day=3 cday=28. if id=6 and day=4 cday=29. if id=7 and day=5 cday=30. Else if month=4 and startday=24. if id=1 and day=1 cday=26. if id=2 and day=2 cday=27. if id=3 and day=3 cday=28. if id=4 and day=4 cday=29. if id=5 and day=5 cday=30. if id=6 and day=6 cday=1. if id=6 and day=6 month=5. if id=7 and day=7 cday=2. if id=7 and day=7 month=5. if id=1 and day=4 cday=29. if id=2 and day=5 cday=30. if id=3 and day=6 cday=1. if id=3 and day=6 month=5. if id=4 and day=7 cday=2. if id=4 and day=7 month=5. if id=5 and day=1 cday=3. if id=5 and day=1 month=5. if id=6 and day=2 cday=4. if id=6 and day=2 month=5. if id=7 and day=3 cday=5. if id=7 and day=3 month=5. if id=1 and day=6 cday=1. if id=1 and day=6 month=5. if id=2 and day=7 cday=2. if id=2 and day=7 month=5. if id=3 and day=1 cday=3. if id=3 and day=1 month=5. if id=4 and day=2 cday=4. if id=4 and day=2 month=5. if id=5 and day=3 cday=5. if id=5 and day=3 month=5. if id=6 and day=4 cday=6. if id=6 and day=4 month=5. if id=7 and day=5 cday=7. if id=7 and day=5 month=5. if id=1 and day=7 cday=25. if id=2 and day=1 cday=26. if id=3 and day=2 cday=27. if id=4 and day=3 cday=28. if id=5 and day=4 cday=29. if id=6 and day=5 cday=30. if id=7 and day=6 cday=1. if id=7 and day=6 month=5. Else if month=4 and startday=25. if id=1 and day=1 cday=26. if id=2 and day=2 cday=27. if id=3 and day=3 cday=28. if id=4 and day=4 cday=29. if id=5 and day=5 cday=30. if id=6 and day=6 cday=1. if id=6 and day=6 month=5. if id=7 and day=7 cday=2. if id=7 and day=7 month=5. if id=1 and day=3 cday=28. if id=2 and day=4 cday=29. if id=3 and day=5 cday=30. if id=4 and day=6 cday=1. if id=4 and day=6 month=5. if id=5 and day=7 cday=2. if id=5 and day=7 month=5. if id=6 and day=1 cday=3. if id=6 and day=1 month=5. if id=7 and day=2 cday=4. if id=7 and day=2 month=5. if id=1 and day=7 cday=2. if id=1 and day=7 month=5. if id=2 and day=1 cday=3. if id=2 and day=1 month=5. if id=3 and day=2 cday=4. if id=3 and day=2 month=5. if id=4 and day=3 cday=5. if id=4 and day=3 month=5. if id=5 and day=4 cday=6. if id=5 and day=4 month=5. if id=6 and day=5 cday=7. if id=6 and day=5 month=5. if id=7 and day=6 cday=8. if id=7 and day=6 month=5. Else if month=4 and startday=26. if id=1 and day=1 cday=3. if id=1 and day=1 month=5. if id=2 and day=2 cday=4. if id=2 and day=2 month=5. if id=3 and day=3 cday=5. if id=3 and day=3 month=5. if id=4 and day=4 cday=6. if id=4 and day=4 month=5. if id=5 and day=5 cday=7. if id=5 and day=5 month=5. if id=6 and day=6 cday=8. if id=6 and day=6 month=5. if id=7 and day=7 cday=9. if id=7 and day=7 month=5. if id=1 and day=2 cday=27. if id=2 and day=3 cday=28. if id=3 and day=4 cday=29. if id=4 and day=5 cday=30. if id=5 and day=6 cday=1. if id=5 and day=6 month=5. if id=6 and day=7 cday=2. if id=6 and day=7 month=5. if id=7 and day=1 cday=3. if id=7 and day=1 month=5. Else if month=4 and startday=27. if id=1 and day=2 cday=4. if id=1 and day=2 month=5. if id=2 and day=3 cday=5. if id=2 and day=3 month=5. if id=3 and day=4 cday=6. if id=3 and day=4 month=5. if id=4 and day=5 cday=7. if id=4 and day=5 month=5. if id=5 and day=6 cday=8. if id=5 and day=6 month=5. if id=6 and day=7 cday=9. if id=6 and day=7 month=5. if id=7 and day=1 cday=10. if id=7 and day=1 month=5. if id=1 and day=3 cday=28. if id=2 and day=4 cday=29. if id=3 and day=5 cday=30. if id=4 and day=6 cday=1. if id=4 and day=6 month=5. if id=5 and day=7 cday=2. if id=5 and day=7 month=5. if id=6 and day=1 cday=3. if id=6 and day=1 month=5. if id=7 and day=2 cday=4. if id=7 and day=2 month=5. if id=1 and day=4 cday=29. if id=2 and day=5 cday=30. if id=3 and day=6 cday=1. if id=3 and day=6 month=5. if id=4 and day=7 cday=2. if id=4 and day=7 month=5. if id=5 and day=1 cday=3. if id=5 and day=1 month=5. if id=6 and day=2 cday=4. if id=6 and day=2 month=5. if id=7 and day=3 cday=5. if id=7 and day=3 month=5. if id=1 and day=7 cday=2. if id=1 and day=7 month=5. if id=2 and day=1 cday=3. if id=2 and day=1 month=5. if id=3 and day=2 cday=4. if id=3 and day=2 month=5. if id=4 and day=3 cday=5. if id=4 and day=3 month=5. if id=5 and day=4 cday=6. if id=5 and day=4 month=5. if id=6 and day=5 cday=7. if id=6 and day=5 month=5. if id=7 and day=6 cday=8. if id=7 and day=6 month=5. Else if month=4 and startday=28. if id=1 and day=4 cday=29. if id=2 and day=5 cday=30. if id=3 and day=6 cday=1. if id=3 and day=6 month=5. if id=4 and day=7 cday=2. if id=4 and day=7 month=5. if id=5 and day=1 cday=3. if id=5 and day=1 month=5. if id=6 and day=2 cday=4. if id=6 and day=2 month=5. if id=7 and day=3 cday=5. if id=7 and day=3 month=5. if id=1 and day=5 cday=30. if id=2 and day=6 cday=1. if id=2 and day=6 month=5. if id=3 and day=7 cday=2. if id=3 and day=7 month=5. if id=4 and day=1 cday=3. if id=4 and day=1 month=5. if id=5 and day=2 cday=4. if id=5 and day=2 month=5. if id=6 and day=3 cday=5. if id=6 and day=3 month=5. if id=7 and day=4 cday=6. if id=7 and day=4 month=5. Else if month=4 and startday=29. if id=1 and day=1 cday=3. if id=1 and day=1 month=5. if id=2 and day=2 cday=4. if id=2 and day=2 month=5. if id=3 and day=3 cday=5. if id=3 and day=3 month=5. if id=4 and day=4 cday=6. if id=4 and day=4 month=5. if id=5 and day=5 cday=7. if id=5 and day=5 month=5. if id=6 and day=6 cday=8. if id=6 and day=6 month=5. if id=7 and day=7 cday=9. if id=7 and day=7 month=5. if id=1 and day=2 cday=4. if id=1 and day=2 month=5. if id=2 and day=3 cday=5. if id=2 and day=3 month=5. if id=3 and day=4 cday=6. if id=3 and day=4 month=5. if id=4 and day=5 cday=7. if id=4 and day=5 month=5. if id=5 and day=6 cday=8. if id=5 and day=6 month=5. if id=6 and day=7 cday=9. if id=6 and day=7 month=5. if id=7 and day=1 cday=10. if id=7 and day=1 month=5. if id=1 and day=3 cday=5. if id=1 and day=3 month=5. if id=2 and day=4 cday=6. if id=2 and day=4 month=5. if id=3 and day=5 cday=7. if id=3 and day=5 month=5. if id=4 and day=6 cday=8. if id=4 and day=6 month=5. if id=5 and day=7 cday=9. if id=5 and day=7 month=5. if id=6 and day=1 cday=10. if id=6 and day=1 month=5. if id=7 and day=2 cday=11. if id=7 and day=2 month=5. if id=1 and day=5 cday=30. if id=2 and day=6 cday=1. if id=2 and day=6 month=5. if id=3 and day=7 cday=2. if id=3 and day=7 month=5. if id=4 and day=1 cday=3. if id=4 and day=1 month=5. if id=5 and day=2 cday=4. if id=5 and day=2 month=5. if id=6 and day=3 cday=5. if id=6 and day=3 month=5. if id=7 and day=4 cday=6. if id=7 and day=4 month=5. if id=1 and day=7 cday=2. if id=1 and day=7 month=5. if id=2 and day=1 cday=3. if id=2 and day=1 month=5. if id=3 and day=2 cday=4. if id=3 and day=2 month=5. if id=4 and day=3 cday=5. if id=4 and day=3 month=5. if id=5 and day=4 cday=6. if id=5 and day=4 month=5. if id=6 and day=5 cday=7. if id=6 and day=5 month=5. if id=7 and day=6 cday=8. if id=7 and day=6 month=5. Else if month=4 and startday=30. if id=1 and day=6 cday=1. if id=1 and day=6 month=5. if id=2 and day=7 cday=2. if id=2 and day=7 month=5. if id=3 and day=1 cday=3. if id=3 and day=1 month=5. if id=4 and day=2 cday=4. if id=4 and day=2 month=5. if id=5 and day=3 cday=5. if id=5 and day=3 month=5. if id=6 and day=4 cday=6. if id=6 and day=4 month=5. if id=7 and day=5 cday=7. if id=7 and day=5 month=5. if id=1 and day=7 cday=2. if id=1 and day=7 month=5. if id=2 and day=1 cday=3. if id=2 and day=1 month=5. if id=3 and day=2 cday=4. if id=3 and day=2 month=5. if id=4 and day=3 cday=5. if id=4 and day=3 month=5. if id=5 and day=4 cday=6. if id=5 and day=4 month=5. if id=6 and day=5 cday=7. if id=6 and day=5 month=5. if id=7 and day=6 cday=8. if id=7 and day=6 month=5. End if. execute. cro cday by month day. temp. select if id=1 and month=3. cro startday by day. do if month=3 and startday=2. if id=1 cday=6. if id=2 cday=7. if id=3 cday=8. if id=4 cday=9. if id=5 cday=10. if id=6 cday=11. if id=7 cday=12. Else if month=3 and startday=11. if id=1 and day=4 cday=18. if id=2 and day=5 cday=19. if id=3 and day=6 cday=20. if id=4 and day=7 cday=21. if id=5 and day=1 cday=22. if id=6 and day=2 cday=23. if id=7 and day=3 cday=24. if id=1 and day=5 cday=12. if id=2 and day=6 cday=13. if id=3 and day=7 cday=14. if id=4 and day=1 cday=15. if id=5 and day=2 cday=16. if id=6 and day=3 cday=17. if id=7 and day=4 cday=18. Else if month=3 and startday=12. if id=1 cday=13. if id=2 cday=14. if id=3 cday=15. if id=4 cday=16. if id=5 cday=17. if id=6 cday=18. if id=7 cday=19. Else if month=3 and startday=13. if id=1 and day=2 cday=16. if id=2 and day=3 cday=17. if id=3 and day=4 cday=18. if id=4 and day=5 cday=19. if id=5 and day=6 cday=20. if id=6 and day=7 cday=21. if id=7 and day=1 cday=22. if id=1 and day=7 cday=14. if id=2 and day=1 cday=15. if id=3 and day=2 cday=16. if id=4 and day=3 cday=17. if id=5 and day=4 cday=18. if id=6 and day=5 cday=19. if id=7 and day=6 cday=20. Else if month=3 and startday=14. if id=1 and day=1 cday=15. if id=2 and day=2 cday=16. if id=3 and day=3 cday=17. if id=4 and day=4 cday=18. if id=5 and day=5 cday=19. if id=6 and day=6 cday=20. if id=7 and day=7 cday=21. if id=1 and day=2 cday=16. if id=2 and day=3 cday=17. if id=3 and day=4 cday=18. if id=4 and day=5 cday=19. if id=5 and day=6 cday=20. if id=6 and day=7 cday=21. if id=7 and day=1 cday=22. Else if month=3 and startday=15. if id=1 and day=2 cday=16. if id=2 and day=3 cday=17. if id=3 and day=4 cday=18. if id=4 and day=5 cday=19. if id=5 and day=6 cday=20. if id=6 and day=7 cday=21. if id=7 and day=1 cday=22. if id=1 and day=5 cday=19. if id=2 and day=6 cday=20. if id=3 and day=7 cday=21. if id=4 and day=1 cday=22. if id=5 and day=2 cday=23. if id=6 and day=3 cday=24. if id=7 and day=4 cday=25. Else if month=3 and startday=16. if id=1 and day=3 cday=17. if id=2 and day=4 cday=18. if id=3 and day=5 cday=19. if id=4 and day=6 cday=20. if id=5 and day=7 cday=21. if id=6 and day=1 cday=22. if id=7 and day=2 cday=23. if id=1 and day=4 cday=18. if id=2 and day=5 cday=19. if id=3 and day=6 cday=20. if id=4 and day=7 cday=21. if id=5 and day=1 cday=22. if id=6 and day=2 cday=23. if id=7 and day=3 cday=24. Else if month=3 and startday=17. if id=1 and day=4 cday=18. if id=2 and day=5 cday=19. if id=3 and day=6 cday=20. if id=4 and day=7 cday=21. if id=5 and day=1 cday=22. if id=6 and day=2 cday=23. if id=7 and day=3 cday=24. if id=1 and day=5 cday=19. if id=2 and day=6 cday=20. if id=3 and day=7 cday=21. if id=4 and day=1 cday=22. if id=5 and day=2 cday=23. if id=6 and day=3 cday=24. if id=7 and day=4 cday=25. Else if month=3 and startday=18. if id=1 and day=1 cday=22. if id=2 and day=2 cday=23. if id=3 and day=3 cday=24. if id=4 and day=4 cday=25. if id=5 and day=5 cday=26. if id=6 and day=6 cday=27. if id=7 and day=7 cday=28. if id=1 and day=2 cday=23. if id=2 and day=3 cday=24. if id=3 and day=4 cday=25. if id=4 and day=5 cday=26. if id=5 and day=6 cday=27. if id=6 and day=7 cday=28. if id=7 and day=1 cday=29. if id=1 and day=4 cday=25. if id=2 and day=5 cday=26. if id=3 and day=6 cday=27. if id=4 and day=7 cday=28. if id=5 and day=1 cday=29. if id=6 and day=2 cday=30. if id=7 and day=3 cday=31. if id=1 and day=5 cday=19. if id=2 and day=6 cday=20. if id=3 and day=7 cday=21. if id=4 and day=1 cday=22. if id=5 and day=2 cday=23. if id=6 and day=3 cday=24. if id=7 and day=4 cday=25. if id=1 and day=6 cday=20. if id=2 and day=7 cday=21. if id=3 and day=1 cday=22. if id=4 and day=2 cday=23. if id=5 and day=3 cday=24. if id=6 and day=4 cday=25. if id=7 and day=5 cday=26. Else if month=3 and startday=19. if id=1 and day=2 cday=23. if id=2 and day=3 cday=24. if id=3 and day=4 cday=25. if id=4 and day=5 cday=26. if id=5 and day=6 cday=27. if id=6 and day=7 cday=28. if id=7 and day=1 cday=29. if id=1 and day=6 cday=20. if id=2 and day=7 cday=21. if id=3 and day=1 cday=22. if id=4 and day=2 cday=23. if id=5 and day=3 cday=24. if id=6 and day=4 cday=25. if id=7 and day=5 cday=26. if id=1 and day=7 cday=21. if id=2 and day=1 cday=22. if id=3 and day=2 cday=23. if id=4 and day=3 cday=24. if id=5 and day=4 cday=25. if id=6 and day=5 cday=26. if id=7 and day=6 cday=27. End if. Execute. Do if month=3 and startday=20. if id=1 and day=1 cday=22. if id=2 and day=2 cday=23. if id=3 and day=3 cday=24. if id=4 and day=4 cday=25. if id=5 and day=5 cday=26. if id=6 and day=6 cday=27. if id=7 and day=7 cday=28. if id=1 and day=2 cday=23. if id=2 and day=3 cday=24. if id=3 and day=4 cday=25. if id=4 and day=5 cday=26. if id=5 and day=6 cday=27. if id=6 and day=7 cday=28. if id=7 and day=1 cday=29. if id=1 and day=4 cday=25. if id=2 and day=5 cday=26. if id=3 and day=6 cday=27. if id=4 and day=7 cday=28. if id=5 and day=1 cday=29. if id=6 and day=2 cday=30. if id=7 and day=3 cday=31. if id=1 and day=7 cday=21. if id=2 and day=1 cday=22. if id=3 and day=2 cday=23. if id=4 and day=3 cday=24. if id=5 and day=4 cday=25. if id=6 and day=5 cday=26. if id=7 and day=6 cday=27. Else if month=3 and startday=21. if id=1 and day=1 cday=22. if id=2 and day=2 cday=23. if id=3 and day=3 cday=24. if id=4 and day=4 cday=25. if id=5 and day=5 cday=26. if id=6 and day=6 cday=27. if id=7 and day=7 cday=28. if id=1 and day=2 cday=23. if id=2 and day=3 cday=24. if id=3 and day=4 cday=25. if id=4 and day=5 cday=26. if id=5 and day=6 cday=27. if id=6 and day=7 cday=28. if id=7 and day=1 cday=29. if id=1 and day=7 cday=28. if id=2 and day=1 cday=29. if id=3 and day=2 cday=30. if id=4 and day=3 cday=31. if id=5 and day=4 cday=1. if id=5 and day=4 month=4. if id=6 and day=5 cday=2. if id=6 and day=5 month=4. if id=7 and day=6 cday=3. if id=7 and day=6 month=4. Else if month=3 and startday=22. if id=1 and day=2 cday=23. if id=2 and day=3 cday=24. if id=3 and day=4 cday=25. if id=4 and day=5 cday=26. if id=5 and day=6 cday=27. if id=6 and day=7 cday=28. if id=7 and day=1 cday=29. if id=1 and day=4 cday=25. if id=2 and day=5 cday=26. if id=3 and day=6 cday=27. if id=4 and day=7 cday=28. if id=5 and day=1 cday=29. if id=6 and day=2 cday=30. if id=7 and day=3 cday=31. if id=1 and day=6 cday=27. if id=2 and day=7 cday=28. if id=3 and day=1 cday=29. if id=4 and day=2 cday=30. if id=5 and day=3 cday=31. if id=6 and day=4 cday=1. if id=6 and day=4 month=4. if id=7 and day=5 cday=2. if id=7 and day=5 month=4. Else if month=3 and startday=23. if id=1 and day=1 cday=29. if id=2 and day=2 cday=30. if id=3 and day=3 cday=31. if id=4 and day=4 cday=1. if id=4 and day=4 month=4. if id=5 and day=5 cday=2. if id=5 and day=5 month=4. if id=6 and day=6 cday=3. if id=6 and day=6 month=4. if id=7 and day=7 cday=4. if id=7 and day=7 month=4. if id=1 and day=2 cday=30. if id=2 and day=3 cday=31. if id=3 and day=4 cday=1. if id=3 and day=4 month=4. if id=4 and day=5 cday=2. if id=4 and day=5 month=4. if id=5 and day=6 cday=3. if id=5 and day=6 month=4. if id=6 and day=7 cday=4. if id=6 and day=7 month=4. if id=7 and day=1 cday=5. if id=7 and day=1 month=4. if id=1 and day=3 cday=24. if id=2 and day=4 cday=25. if id=3 and day=5 cday=26. if id=4 and day=6 cday=27. if id=5 and day=7 cday=28. if id=6 and day=1 cday=29. if id=7 and day=2 cday=30. if id=1 and day=4 cday=25. if id=2 and day=5 cday=26. if id=3 and day=6 cday=27. if id=4 and day=7 cday=28. if id=5 and day=1 cday=29. if id=6 and day=2 cday=30. if id=7 and day=3 cday=31. if id=1 and day=7 cday=28. if id=2 and day=1 cday=29. if id=3 and day=2 cday=30. if id=4 and day=3 cday=31. if id=5 and day=4 cday=1. if id=5 and day=4 month=4. if id=6 and day=5 cday=2. if id=6 and day=5 month=4. if id=7 and day=6 cday=3. if id=7 and day=6 month=4. Else if month=3 and startday=24. if id=1 and day=3 cday=31. if id=2 and day=4 cday=1. if id=2 and day=4 month=4. if id=3 and day=5 cday=2. if id=3 and day=5 month=4. if id=4 and day=6 cday=3. if id=4 and day=6 month=4. if id=5 and day=7 cday=4. if id=5 and day=7 month=4. if id=6 and day=1 cday=5. if id=6 and day=1 month=4. if id=7 and day=2 cday=6. if id=7 and day=2 month=4. if id=1 and day=4 cday=25. if id=2 and day=5 cday=26. if id=3 and day=6 cday=27. if id=4 and day=7 cday=28. if id=5 and day=1 cday=29. if id=6 and day=2 cday=30. if id=7 and day=3 cday=31. if id=1 and day=5 cday=26. if id=2 and day=6 cday=27. if id=3 and day=7 cday=28. if id=4 and day=1 cday=29. if id=5 and day=2 cday=30. if id=6 and day=3 cday=31. if id=7 and day=4 cday=1. if id=7 and day=4 month=4. if id=1 and day=7 cday=28. if id=2 and day=1 cday=29. if id=3 and day=2 cday=30. if id=4 and day=3 cday=31. if id=5 and day=4 cday=1. if id=5 and day=4 month=4. if id=6 and day=5 cday=2. if id=6 and day=5 month=4. if id=7 and day=6 cday=3. if id=7 and day=6 month=4. End if. Execute. Do if month=3 and startday=25. if id=1 and day=1 cday=29. if id=2 and day=2 cday=30. if id=3 and day=3 cday=31. if id=4 and day=4 cday=1. if id=4 and day=4 month=4. if id=5 and day=5 cday=2. if id=5 and day=5 month=4. if id=6 and day=6 cday=3. if id=6 and day=6 month=4. if id=7 and day=7 cday=4. if id=7 and day=7 month=4. if id=1 and day=4 cday=1. if id=1 and day=4 month=4. if id=2 and day=5 cday=2. if id=2 and day=5 month=4. if id=3 and day=6 cday=3. if id=3 and day=6 month=4. if id=4 and day=7 cday=4. if id=4 and day=7 month=4. if id=5 and day=1 cday=5. if id=5 and day=1 month=4. if id=6 and day=2 cday=6. if id=6 and day=2 month=4. if id=7 and day=3 cday=7. if id=7 and day=3 month=4. if id=1 and day=5 cday=26. if id=2 and day=6 cday=27. if id=3 and day=7 cday=28. if id=4 and day=1 cday=29. if id=5 and day=2 cday=30. if id=6 and day=3 cday=31. if id=7 and day=4 cday=1. if id=7 and day=4 month=4. if id=1 and day=6 cday=27. if id=2 and day=7 cday=28. if id=3 and day=1 cday=29. if id=4 and day=2 cday=30. if id=5 and day=3 cday=31. if id=6 and day=4 cday=1. if id=6 and day=4 month=4. if id=7 and day=5 cday=2. if id=7 and day=5 month=4. End if. execute. Do if month=3 and startday=26. if id=1 and day=1 cday=29. if id=2 and day=2 cday=30. if id=3 and day=3 cday=31. if id=4 and day=4 cday=1. if id=4 and day=4 month=4. if id=5 and day=5 cday=2. if id=5 and day=5 month=4. if id=6 and day=6 cday=3. if id=6 and day=6 month=4. if id=7 and day=7 cday=4. if id=7 and day=7 month=4. if id=1 and day=4 cday=1. if id=1 and day=4 month=4. if id=2 and day=5 cday=2. if id=2 and day=5 month=4. if id=3 and day=6 cday=3. if id=3 and day=6 month=4. if id=4 and day=7 cday=4. if id=4 and day=7 month=4. if id=5 and day=1 cday=5. if id=5 and day=1 month=4. if id=6 and day=2 cday=6. if id=6 and day=2 month=4. if id=7 and day=3 cday=7. if id=7 and day=3 month=4. if id=1 and day=5 cday=2. if id=1 and day=5 month=4. if id=2 and day=6 cday=3. if id=2 and day=6 month=4. if id=3 and day=7 cday=4. if id=3 and day=7 month=4. if id=4 and day=1 cday=5. if id=4 and day=1 month=4. if id=5 and day=2 cday=6. if id=5 and day=2 month=4. if id=6 and day=3 cday=7. if id=6 and day=3 month=4. if id=7 and day=4 cday=8. if id=7 and day=4 month=4. if id=1 and day=6 cday=27. if id=2 and day=7 cday=28. if id=3 and day=1 cday=29. if id=4 and day=2 cday=30. if id=5 and day=3 cday=31. if id=6 and day=4 cday=1. if id=6 and day=4 month=4. if id=7 and day=5 cday=2. if id=7 and day=5 month=4. if id=1 and day=7 cday=28. if id=2 and day=1 cday=29. if id=3 and day=2 cday=30. if id=4 and day=3 cday=31. if id=5 and day=4 cday=1. if id=5 and day=4 month=4. if id=6 and day=5 cday=2. if id=6 and day=5 month=4. if id=7 and day=6 cday=3. if id=7 and day=6 month=4. Else if month=3 and startday=27. if id=1 and day=1 cday=29. if id=2 and day=2 cday=30. if id=3 and day=3 cday=31. if id=4 and day=4 cday=1. if id=4 and day=4 month=4. if id=5 and day=5 cday=2. if id=5 and day=5 month=4. if id=6 and day=6 cday=3. if id=6 and day=6 month=4. if id=7 and day=7 cday=4. if id=7 and day=7 month=4. if id=1 and day=2 cday=30. if id=2 and day=3 cday=31. if id=3 and day=4 cday=1. if id=3 and day=4 month=4. if id=4 and day=5 cday=2. if id=4 and day=5 month=4. if id=5 and day=6 cday=3. if id=5 and day=6 month=4. if id=6 and day=7 cday=4. if id=6 and day=7 month=4. if id=7 and day=1 cday=5. if id=7 and day=1 month=4. if id=1 and day=4 cday=1. if id=1 and day=4 month=4. if id=2 and day=5 cday=2. if id=2 and day=5 month=4. if id=3 and day=6 cday=3. if id=3 and day=6 month=4. if id=4 and day=7 cday=4. if id=4 and day=7 month=4. if id=5 and day=1 cday=5. if id=5 and day=1 month=4. if id=6 and day=2 cday=6. if id=6 and day=2 month=4. if id=7 and day=3 cday=7. if id=7 and day=3 month=4. if id=1 and day=7 cday=28. if id=2 and day=1 cday=29. if id=3 and day=2 cday=30. if id=4 and day=3 cday=31. if id=5 and day=4 cday=1. if id=5 and day=4 month=4. if id=6 and day=5 cday=2. if id=6 and day=5 month=4. if id=7 and day=6 cday=3. if id=7 and day=6 month=4. Else if month=3 and startday=28. if id=1 and day=1 cday=29. if id=2 and day=2 cday=30. if id=3 and day=3 cday=31. if id=4 and day=4 cday=1. if id=4 and day=4 month=4. if id=5 and day=5 cday=2. if id=5 and day=5 month=4. if id=6 and day=6 cday=3. if id=6 and day=6 month=4. if id=7 and day=7 cday=4. if id=7 and day=7 month=4. if id=1 and day=2 cday=30. if id=2 and day=3 cday=31. if id=3 and day=4 cday=1. if id=3 and day=4 month=4. if id=4 and day=5 cday=2. if id=4 and day=5 month=4. if id=5 and day=6 cday=3. if id=5 and day=6 month=4. if id=6 and day=7 cday=4. if id=6 and day=7 month=4. if id=7 and day=1 cday=5. if id=7 and day=1 month=4. if id=1 and day=7 cday=4. if id=1 and day=7 month=4. if id=2 and day=1 cday=5. if id=2 and day=1 month=4. if id=3 and day=2 cday=6. if id=3 and day=2 month=4. if id=4 and day=3 cday=7. if id=4 and day=3 month=4. if id=5 and day=4 cday=8. if id=5 and day=4 month=4. if id=6 and day=5 cday=9. if id=6 and day=5 month=4. if id=7 and day=6 cday=10. if id=7 and day=6 month=4. Else if month=3 and startday=29. if id=1 and day=1 cday=5. if id=1 and day=1 month=4. if id=2 and day=2 cday=6. if id=2 and day=2 month=4. if id=3 and day=3 cday=7. if id=3 and day=3 month=4. if id=4 and day=4 cday=8. if id=4 and day=4 month=4. if id=5 and day=5 cday=9. if id=5 and day=5 month=4. if id=6 and day=6 cday=10. if id=6 and day=6 month=4. if id=7 and day=7 cday=11. if id=7 and day=7 month=4. if id=1 and day=2 cday=30. if id=2 and day=3 cday=31. if id=3 and day=4 cday=1. if id=3 and day=4 month=4. if id=4 and day=5 cday=2. if id=4 and day=5 month=4. if id=5 and day=6 cday=3. if id=5 and day=6 month=4. if id=6 and day=7 cday=4. if id=6 and day=7 month=4. if id=7 and day=1 cday=5. if id=7 and day=1 month=4. Else if month=3 and startday=30. if id=1 and day=3 cday=31. if id=2 and day=4 cday=1. if id=2 and day=4 month=4. if id=3 and day=5 cday=2. if id=3 and day=5 month=4. if id=4 and day=6 cday=3. if id=4 and day=6 month=4. if id=5 and day=7 cday=4. if id=5 and day=7 month=4. if id=6 and day=1 cday=5. if id=6 and day=1 month=4. if id=7 and day=2 cday=6. if id=7 and day=2 month=4. if id=1 and day=4 cday=1. if id=1 and day=4 month=4. if id=2 and day=5 cday=2. if id=2 and day=5 month=4. if id=3 and day=6 cday=3. if id=3 and day=6 month=4. if id=4 and day=7 cday=4. if id=4 and day=7 month=4. if id=5 and day=1 cday=5. if id=5 and day=1 month=4. if id=6 and day=2 cday=6. if id=6 and day=2 month=4. if id=7 and day=3 cday=7. if id=7 and day=3 month=4. if id=1 and day=5 cday=2. if id=1 and day=5 month=4. if id=2 and day=6 cday=3. if id=2 and day=6 month=4. if id=3 and day=7 cday=4. if id=3 and day=7 month=4. if id=4 and day=1 cday=5. if id=4 and day=1 month=4. if id=5 and day=2 cday=6. if id=5 and day=2 month=4. if id=6 and day=3 cday=7. if id=6 and day=3 month=4. if id=7 and day=4 cday=8. if id=7 and day=4 month=4. Else if month=3 and startday=31. compute month=4. if id=1 and day=2 cday=6. if id=2 and day=3 cday=7. if id=3 and day=4 cday=8. if id=4 and day=5 cday=9. if id=5 and day=6 cday=10. if id=6 and day=7 cday=11. if id=7 and day=1 cday=12. if id=1 and day=3 cday=7. if id=2 and day=4 cday=8. if id=3 and day=5 cday=9. if id=4 and day=6 cday=10. if id=5 and day=7 cday=11. if id=6 and day=1 cday=12. if id=7 and day=2 cday=13. if id=1 and day=4 cday=1. if id=2 and day=5 cday=2. if id=3 and day=6 cday=3. if id=4 and day=7 cday=4. if id=5 and day=1 cday=5. if id=6 and day=2 cday=6. if id=7 and day=3 cday=7. if id=1 and day=5 cday=2. if id=2 and day=6 cday=3. if id=3 and day=7 cday=4. if id=4 and day=1 cday=5. if id=5 and day=2 cday=6. if id=6 and day=3 cday=7. if id=7 and day=4 cday=8. if id=1 and day=7 cday=4. if id=2 and day=1 cday=5. if id=3 and day=2 cday=6. if id=4 and day=3 cday=7. if id=5 and day=4 cday=8. if id=6 and day=5 cday=9. if id=7 and day=6 cday=10. End if. freq cday. cro cday by month day. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w6.sav' /keep = countrya survey swave hldid persid id day cday month year diary time clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad. *change sppart from a flag to a time variable to sum for W58 files. compute sppart=sppart*time. desc sppart. Aggregate outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w553.sav' /break countrya survey swave hldid persid id /day=MAX(day) /month=MAX(month) /studmark=MAX(studmark) /caremark=MAX(caremark) /animal=SUM(animal) /sppart=SUM(sppart) /mainx1=SUM(mainx1) /mainx2=SUM(mainx2) /mainx3=SUM(mainx3) /mainx4=SUM(mainx4) /mainx5=SUM(mainx5) /mainx6=SUM(mainx6) /mainx7=SUM(mainx7) /mainx8=SUM(mainx8) /mainx9=SUM(mainx9) /mainx10=SUM(mainx10) /mainx11=SUM(mainx11) /mainx12=SUM(mainx12) /mainx13=SUM(mainx13) /mainx14=SUM(mainx14) /mainx15=SUM(mainx15) /mainx16=SUM(mainx16) /mainx17=SUM(mainx17) /mainx18=SUM(mainx18) /mainx19=SUM(mainx19) /mainx20=SUM(mainx20) /mainx21=SUM(mainx21) /mainx22=SUM(mainx22) /mainx23=SUM(mainx23) /mainx24=SUM(mainx24) /mainx25=SUM(mainx25) /mainx26=SUM(mainx26) /mainx27=SUM(mainx27) /mainx28=SUM(mainx28) /mainx29=SUM(mainx29) /mainx30=SUM(mainx30) /mainx31=SUM(mainx31) /mainx32=SUM(mainx32) /mainx33=SUM(mainx33) /mainx34=SUM(mainx34) /mainx35=SUM(mainx35) /mainx36=SUM(mainx36) /mainx37=SUM(mainx37) /mainx38=SUM(mainx38) /mainx39=SUM(mainx39) /mainx40=SUM(mainx40) /mainx41=SUM(mainx41) /mainx42=SUM(mainx42) /mainx43=SUM(mainx43) /mainx44=SUM(mainx44) /mainx45=SUM(mainx45) /mainx46=SUM(mainx46) /mainx47=SUM(mainx47) /mainx48=SUM(mainx48) /mainx49=SUM(mainx49) /mainx50=SUM(mainx50) /mainx51=SUM(mainx51) /mainx52=SUM(mainx52) /mainx53=SUM(mainx53) /mainx54=SUM(mainx54) /mainx55=SUM(mainx55) /mainx56=SUM(mainx56) /mainx57=SUM(mainx57) /mainx58=SUM(mainx58) /mainx59=SUM(mainx59) /mainx60=SUM(mainx60) /mainx61=SUM(mainx61) /mainx62=SUM(mainx62) /mainx63=SUM(mainx63) /mainx64=SUM(mainx64) /mainx65=SUM(mainx65) /mainx66=SUM(mainx66) /mainx67=SUM(mainx67) /mainx68=SUM(mainx68) /mainx69=SUM(mainx69) /avx1=SUM(avx1) /avx2=SUM(avx2) /avx3=SUM(avx3) /avx4=SUM(avx4) /avx5=SUM(avx5) /avx6=SUM(avx6) /avx7=SUM(avx7) /avx8=SUM(avx8) /avx9=SUM(avx9) /avx10=SUM(avx10) /avx11=SUM(avx11) /avx12=SUM(avx12) /avx13=SUM(avx13) /avx14=SUM(avx14) /avx15=SUM(avx15) /avx16=SUM(avx16) /avx17=SUM(avx17) /avx18=SUM(avx18) /avx19=SUM(avx19) /avx20=SUM(avx20) /avx21=SUM(avx21) /avx22=SUM(avx22) /avx23=SUM(avx23) /avx24=SUM(avx24) /avx25=SUM(avx25) /avx26=SUM(avx26) /avx27=SUM(avx27) /avx28=SUM(avx28) /avx29=SUM(avx29) /avx30=SUM(avx30) /avx31=SUM(avx31) /avx32=SUM(avx32) /avx33=SUM(avx33) /avx34=SUM(avx34) /avx35=SUM(avx35) /avx36=SUM(avx36) /avx37=SUM(avx37) /avx38=SUM(avx38) /avx39=SUM(avx39) /avx40=SUM(avx40) /avx41=SUM(avx41) /sleep=MAX(sleep) /maxep=MAX(epnum) /eat=MAX(eat) /extrav=MAX(extrav) /pcare=MAX(pcare) /anycare=MAX(anycare) /miss=SUM(miss). *now put diary and demographic files together. match files file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w553.sav' /in epfile table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk87dem.sav' /in demfile /BY survey hldid persid. cro epfile by demfile. *at first stage find matches between 1661 diarists and diaries. 4233 people in the demographic *file do not match to diaries, and 45 sets if dairies do not match to the demographics. * *first set of most obvious reduced problem cases increases matches between diarists and diaries to *1677. 4217 people in the demographic file now do not match to diaries, and 29 sets of diaries do *not match to the demographic file. look at cases clearly missing diaries in attempt to improve *matching. * *temp. *select if epfile=1 and demfile=0. *freq hldid. * *code from checking for the proper home of mystery diaries. *aggregate * outfile=* * mode=addvariables * /break hldid * /ndiarist=SUM(epfile). * *cro ndiarist by nodiary. *select if (epfile=1 and demfile=0) or ndiarist=0 or (ndiarist~=nodiary). *cro ndiarist by nodiary. * *examine potential matches to the missing diary case in Northampton. *select if (hldid>39999 and hldid<50000) and hhtype=3 and hhldsize>3 and age>16. *12 household meet these basic criteria, with p1 in couple, no diary, no young kids, p4 adult young person, full time *not in couple and not a student. These are:. *select if hldid=40207 or hldid=40220 or hldid=40251 or hldid=40329 or hldid=40577 or hldid=40627 * or hldid=40659 or hldid=40724 or hldid=40829 or hldid=40916 or hldid=40971. *40207 1 number different and 2 people completed diaries. check time together. *select if (hldid>49999 and hldid<60000) and hhtype=3 and hhldsize>3 and age>16 and nchild>0 and vehicle>2 * and ((persid=1 and sex=1) or (persid=2 and sex=2)). *select if (hldid>49999 and hldid<60000) and (hhtype=3 or hhtype=2) and age>16 and nchild<1 and vehicle>2 and persid=1 and sex=2 and civstat=1. *select if (hldid>49999 and hldid<60000) and (hhtype=3 or hhtype=2) and age>16 and nchild>0 and vehicle>2 * and sex=2 and civstat=1. *select if hldid=50170 or hldid=50196 or hldid=50200 or hldid=50280 or hldid=50286 or hldid=50491 or * hldid=50513 or hldid=50540 or hldid=50602 or hldid=50662. *select if hldid>59999 and hhtype=3 and age>16 and nchild>0 and vehicle>2 and sex=2 and civstat=1. *select if hldid>59999 and hhtype=3 and age>16 and agekidx>2 and vehicle>2 and sex=2 and civstat=1 and empstat<4. *select if hldid>59999 and hhtype=3 and age>16 and agekidx>2 and vehicle>2 and sex=1 and civstat=1 and empstat<4. *select if hldid<20000 and hhtype=3 and age>16 and agekidx>2 and vehicle>2 and sex=2 and civstat=1 and empstat<4 and persid=1 and computer=1. *select if hldid<20000 and hhtype=4 and age>16 and agekidx>2 and vehicle>2 and sex=2 and civstat=2 and empstat<4 and persid=1. *select if hldid<20000 and age>16 and agekidx<3 and sex=2 and civstat=2 and persid=1 and hhtype>1. *select if hldid<20000 and age>16 and nchild<1 and civstat=2 and hhtype=4 and singpar=0 and persid<3 and vehicle>2. *select if hldid<20000 and agekidx>1 and hhtype=3 and persid<4 and vehicle>2 and empstat<4. *select if hldid<20000 and agekidx<1 and (hhtype=3 or hhtype=2) and persid<3 and vehicle>2. *select if hldid<20000 and agekidx=1 and hhtype=3 and persid<3 and vehicle>2. *select if hldid<20000 and agekidx<1 and (hhtype=3 or hhtype=2) and persid=2 and vehicle>2 and sex=2 and civstat=1. *select if hldid<20000 and agekidx<1 and (hhtype=3 or hhtype=2) and persid=1 and vehicle>2 and sex=1 and civstat=1. *select if (hldid>49999 and hldid<60000) and agekidx>0 and persid=3 and civstat=2. *select if hldid=60118 or hldid=60724 or hldid=60909. *select if hldid=60204 or hldid=60484 or hldid=60745 or hldid=60791. *select if hldid=60562 or hldid=60753. *make adjustments for unknow values for diaries parly but not prefectly matched. Do if hldid=60909. compute incorig=-8. End if. Do if hldid=60745. compute agekid2=19. compute computer=-8. compute incorig=-8. compute health=3. compute workhrs=35. compute empinclm=-8. End if. Do if hldid=60753. compute hhldsize=4. compute agekid2=16. compute computer=-8. compute incorig=-8. compute empsp=-8. End if. *set age cap in accordance with MTUS guidelines. recode age (80 thru hi=80). desc age. *reset the variable diary to the MTUS value (now a marker on the number of diarists in the household. compute diary=id. execute. *identify poor quality diaries and cases missing basic demographic information. compute misbasic=0. If eat=0 misbasic=misbasic+1. If extrav=0 misbasic=misbasic+1. If sleep=0 misbasic=misbasic+1. If pcare=0 misbasic=misbasic+1. freq misbasic. *91.6% of diaries not missing any basic information; 99.1% missing non or one activity; *64 diaries missing basic information. cro misbasic by anycare maxep. *9 cases carers missing 2 activities, no carers missing more than *2 basic activities. 2 diaries by carers missing substantial time *or low episode. All cases missing 3 or 4 basic activities also *are low episode diaries. 12 of 26 diaries missing 2 basic activities *also are low-episode diaries. temp. select if maxep>6 and misbasic=2 and miss<91. cro anycare by maxep. if misbasic=2 and miss<91 and (maxep>15 or anycare=1) misbasic=0. freq misbasic. recode misbasic (0,1=0) (2 thru high=1). recode miss (0 thru 90=0) (91 thru hi=1). recode maxep (1 thru 6=1) (7 thru hi=0). freq sex age day. compute baddiary=0. if misbasic=1 or miss=1 or maxep=1 baddiary=1. freq baddiary. 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 maxep=0 and miss=1 and misbasic=0. compute badcase=3. Else if sex>-8 and age>-8 and day>-8 and maxep=1 and miss=0 and misbasic=0. compute badcase=4. Else if sex>-8 and age>-8 and day>-8 and maxep=0 and miss=0 and misbasic=1. compute badcase=5. Else if (sex=-8 or age=-8) and day=-8 and maxep=0 and miss=0 and misbasic=0. compute badcase=6. Else if (sex=-8 or age=-8) and day>-8 and maxep=0 and miss=1 and misbasic=0. compute badcase=7. Else if (sex=-8 or age=-8) and day>-8 and maxep=1 and miss=0 and misbasic=0. compute badcase=8. Else if (sex=-8 or age=-8) and day>-8 and maxep=0 and miss=0 and misbasic=1. compute badcase=9. Else if sex>-8 and age>-8 and day=-8 and maxep=0 and miss=1 and misbasic=0. compute badcase=10. Else if sex>-8 and age>-8 and day=-8 and maxep=1 and miss=0 and misbasic=0. compute badcase=11. Else if sex>-8 and age>-8 and day=-8 and maxep=0 and miss=0 and misbasic=1. compute badcase=12. Else if sex>-8 and age>-8 and day>-8 and maxep=1 and miss=1 and misbasic=0. compute badcase=13. Else if sex>-8 and age>-8 and day>-8 and maxep=0 and miss=1 and misbasic=1. compute badcase=14. Else if sex>-8 and age>-8 and day>-8 and maxep=1 and miss=0 and misbasic=1. compute badcase=15. Else if (sex=-8 or age=-8) and day=-8 and maxep=0 and miss=1 and misbasic=0. compute badcase=16. Else if (sex=-8 or age=-8) and day=-8 and maxep=1 and miss=0 and misbasic=0. compute badcase=17. Else if (sex=-8 or age=-8) and day=-8 and maxep=0 and miss=0 and misbasic=1. compute badcase=18. Else if (sex=-8 or age=-8) and day>-8 and maxep=1 and miss=1 and misbasic=0. compute badcase=19. Else if (sex=-8 or age=-8) and day>-8 and maxep=0 and miss=1 and misbasic=1. compute badcase=20. Else if (sex=-8 or age=-8) and day>-8 and maxep=1 and miss=0 and misbasic=1. compute badcase=21. Else if sex>-8 and age>-8 and day=-8 and maxep=1 and miss=1 and misbasic=0. compute badcase=22. Else if sex>-8 and age>-8 and day=-8 and maxep=0 and miss=1 and misbasic=1. compute badcase=23. Else if sex>-8 and age>-8 and day=-8 and maxep=1 and miss=0 and misbasic=1. compute badcase=24. Else if sex>-8 and age>-8 and day>-8 and maxep=1 and miss=1 and misbasic=1. compute badcase=25. Else if (sex=-8 or age=-8) and day=-8 and maxep=1 and miss=1 and misbasic=0. compute badcase=26. Else if (sex=-8 or age=-8) and day=-8 and maxep=0 and miss=1 and misbasic=1. compute badcase=27. Else if (sex=-8 or age=-8) and day=-8 and maxep=1 and miss=0 and misbasic=1. compute badcase=28. Else if (sex=-8 or age=-8) and day>-8 and maxep=1 and miss=1 and misbasic=1. compute badcase=29. Else if sex>-8 and age>-8 and day=-8 and maxep=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 maxep miss misbasic. 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). execute. 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 = 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). execute. cro student by studmark. if studmark=1 and student=0 student=1. freq student. compute carer=0. if caremark=1 carer=1. freq carer. cro educa by student. temp. select if student=1 and educa<0. freq age. if age<17 and student=1 educa=0. if age>16 and age<20 and student=1 educa=4. if age>19 and student=1 educa=15. freq educa. recode educa (-8=-8) (-7=-7) (0 thru 2=1) (3 thru 12=2) (13 thru hi=3) into edtry. cro educa by edtry. *save variables to add to episode level data. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\addage.sav' /keep hldid persid id msamp sex age badcase. compute agegp=1. if age<20 agegp=0. if age>24 and age<30 agegp=2. if age>29 and age<35 agegp=3. if age>34 and age<40 agegp=4. if age>39 and age<45 agegp=5. if age>44 and age<50 agegp=6. if age>49 and age<55 agegp=7. if age>54 and age<62 agegp=8. if age>61 agegp=9. val lab agegp 0 14-19 1 20-24 2 25-29 3 30-34 4 35-39 5 40-44 6 45-49 7 50-54 8 55-61 9 62 and older. temp. select if badcase=0. crosstabs /tables=agegp by sex /format=avalue tables /cells=count row /count round cell. Do if badcase>0. compute wt=0. Else if badcase=0. if sex=1 and agegp=0 wt=1.045540. if sex=1 and agegp=1 wt=1.182675. if sex=1 and agegp=2 wt=1.199007. if sex=1 and agegp=3 wt=1.064150. if sex=1 and agegp=4 wt=1.105738. if sex=1 and agegp=5 wt=1.087063. if sex=1 and agegp=6 wt=1.112986. if sex=1 and agegp=7 wt=1.056578. if sex=1 and agegp=8 wt=0.964488. if sex=1 and agegp=9 wt=1.090914. if sex=2 and agegp=0 wt=0.956186. if sex=2 and agegp=1 wt=0.864190. if sex=2 and agegp=2 wt=0.856609. if sex=2 and agegp=3 wt=0.942721. if sex=2 and agegp=4 wt=0.912913. if sex=2 and agegp=5 wt=0.925336. if sex=2 and agegp=6 wt=0.907557. if sex=2 and agegp=7 wt=0.949359. if sex=2 and agegp=8 wt=1.036387. if sex=2 and agegp=9 wt=0.927962. End if. sort cases by agegp sex day. aggregate out='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\group.sav' /break=agegp sex /grouptot=sum(wt)/ groupn=nu. execute. aggregate out='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\day.sav' /break=agegp sex day /daytot=sum(wt) /dayn=nu. execute. match files file=* table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\group.sav' /by agegp sex. execute. match files file=* table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\day.sav' /by agegp sex day. execute. compute exptot=(grouptot/7). Do if badcase=0. compute ocombwt=(exptot/daytot)/(dayn/daytot). Else if badcase>0. compute ocombwt=0. End if. Do if badcase=0 and age<62. compute propwt=(exptot/daytot)/(dayn/daytot). Else if badcase>0 or age>61. compute propwt=0. End if. desc propwt ocombwt. aggregate outfile=* mode=addvariables /break survey /wtsum1=SUM(ocombwt) /wtsum2=SUM(propwt). freq wtsum1 wtsum2. compute ocombwt=ocombwt*11332/11027.28. compute propwt=propwt*11332/10735.959. desc ocombwt propwt. weight by propwt. cro day by sex /cel=col. freq sex agegp day. weight off. weight by ocombwt. cro day by sex /cel=col. freq sex agegp day. weight off. sort cases by survey 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\1987\UK1987extravar.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 'country / English region' = MAX(region) /animal 'average minutes spent with animals per diary from respondent' = MAX(animal). apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\MTUS database\schema&etc\MTUSW58schema.sav'. means sppart by civstat /cells min max mean. temp. select if sppart>0 and civstat=2. freq sppart age. compute test=0. if sppart>0 and civstat=2 test=1. if age<19 test=0. freq test. *cases checked, and problems identified corrected in earlier parts of this code. 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 /wtsumo = SUM(ocombwt) /wtsump = SUM(propwt). freq wtsumo wtsump. freq countrya survey swave msamp 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 edtry rushed health carer disab. 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. if empstat=1 and unemp=1 unemp=0. 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. desc age main1 to main69 sppart. compute tot1=sum(AV1 to AV41). compute tot2=sum(main1 to main69). freq tot1 tot2. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w553.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 edtry rushed health carer disab 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. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w58.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 edtry rushed health carer disab main1 main2 main3 main4 main5 main6 main7 main8 main9 main10 main11 main12 main13 main14 main15 main16 main17 main18 main19 main20 main21 main22 main23 main24 main25 main26 main27 main28 main29 main30 main31 main32 main33 main34 main35 main36 main37 main38 main39 main40 main41 main42 main43 main44 main45 main46 main47 main48 main49 main50 main51 main52 main53 main54 main55 main56 main57 main58 main59 main60 main61 main62 main63 main64 main65 main66 main67 main68 main69 av1 av2 av3 av4 av5 av6 av7 av8 av9 av10 av11 av12 av13 av14 av15 av16 av17 av18 av19 av20 av21 av22 av23 av24 av25 av26 av27 av28 av29 av30 av31 av32 av33 av34 av35 av36 av37 av38 av39 av40 av41 sppart ocombwt propwt. aggregate /outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\aggr.sav' /break=hldid /urbanmin = min(urban) /urbanmax = max(urban) /incmin = min(income) /incmax = max(income) /akidmin = min(agekidx) /akidmax = max(agekidx) /akid2min = min(agekid2) /akid2max = max(agekid2) /nchimin = min(nchild) /nchimax = max(nchild) /hsizemin = min(hhldsize) /hsizemax = max(hhldsize) /htypmin = min(hhtype) /htypmax = max(hhtype) /ownhomin = min(ownhome) /ownhomax = max(ownhome) /compmin = min(computer) /compmax = max(computer) /vehicmin = min(vehicle) /vehicmax = max(vehicle). select if age<18. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w58kid.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 edtry rushed health carer disab main1 main2 main3 main4 main5 main6 main7 main8 main9 main10 main11 main12 main13 main14 main15 main16 main17 main18 main19 main20 main21 main22 main23 main24 main25 main26 main27 main28 main29 main30 main31 main32 main33 main34 main35 main36 main37 main38 main39 main40 main41 main42 main43 main44 main45 main46 main47 main48 main49 main50 main51 main52 main53 main54 main55 main56 main57 main58 main59 main60 main61 main62 main63 main64 main65 main66 main67 main68 main69 av1 av2 av3 av4 av5 av6 av7 av8 av9 av10 av11 av12 av13 av14 av15 av16 av17 av18 av19 av20 av21 av22 av23 av24 av25 av26 av27 av28 av29 av30 av31 av32 av33 av34 av35 av36 av37 av38 av39 av40 av41 sppart ocombwt propwt. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w58.sav'. select if age>17. desc age. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w58.sav'. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\aggr.sav'. cro urbanmin by urbanmax. cro incmin by incmax. cro akidmin by akidmax. cro akid2min by akid2max. cro nchimin by nchimax. cro hsizemin by hsizemax. cro htypmin by htypmax. cro ownhomin by ownhomax. cro compmin by compmax. cro vehicmin by vehicmax. match files file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w6.sav' table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\addage.sav' /BY hldid persid id. apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\MTUS database\schema&etc\MTUSW60schema.sav'. if mtrav=1 and eloc=9 eloc=8. *check labels and distrubutions. freq countrya survey swave msamp id day cday month year diary badcase sex age clockst main sec av inout eloc ict mtrav alone child sppart oad. desc hldid persid age time start end epnum. cro mtrav by inout eloc. cro main by ict. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w6kid.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 /compressed. select if age=-8 or age>17. desc age. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w6.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 /compressed. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w6kid.sav'. select if age>-8 and age<18. desc age. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\uk1987w6kid.sav' /compressed. *final tidy extra UK variables. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\UK1987extravar.sav'. var lab hldid 'Household identifier'. 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. val lab educalab -8 missing -7 not asked 0 child in school 1 no qualifications, adult 2 'CSE, not 1 England & Wales' 3 'O-Level, CSE, SCM' 4 'GCSE A-Level' 5 'SCE-O or lowers Scotland' 6 other non-significant qualification 7 'Scottish Higher' 8 certificate of 6th year of study 9 City & Guilds 10 ONC, OND, SNC, SND 11 Scottish Vec national certificate 12 Scottish BEC TEC cert CD 13 clerical or commercial qualification 14 apprenticeship 15 significant other qualification 16 HNC, HND, SHNC, SHND 17 professional qualification, no exam 18 teaching degree 19 nursing degree 20 university certificate or diploma 21 university degree. freq survey id sexd aged incolab educalab empinlab aglftsch ethnic region. desc hldid persid animal. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\UK1987extravar.sav'. SAVE TRANSLATE OUTFILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\UK1987extravar.dta' /TYPE=STATA /VERSION=8 /EDITION=INTERCOOLED /MAP /REPLACE. SAVE TRANSLATE OUTFILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\mtus\mtus data\W553\UK\1987\UK1987extravar.csv' /TYPE=CSV /MAP /REPLACE /FIELDNAMES /CELLS=VALUES.