***************************************************** **Syntax producing the 5.53, 5.8 and 6.0 version of** **USA 2010 (ATUS) written by Evrim Altintas ** **Centre for Time Use Research, ** **University of Oxford, Department of Sociology, ** **Manor Road Oxford OX1 3UQ United Kingdom ** ** 24 January 2013 ** *****************************************************. ************************************ *Diary, survey and case information* ************************************. *************************************************** *The AHTUS files do not include three variables * *found in the MTUS - cphome (child in parental * *home); empsp (employment status of the spouse); * *relrefp (relation to household reference person) * *these three variables extracted from the original* *data here * ***************************************************. ************************** *create parent identifier* **************************. GET FILE='F:\evrim\AHTUS\2010\atusrost_2010.sav'. rename variables (tucaseid=persid). compute c=0. compute p1=99. compute p2=-7. execute. if terrp=24 c=1. if terrp=24 p1= tulineno. if terrp=24 p2= tulineno. execute. freq c p1 p2. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=persid /cphome "child in parental home" = MAX(c) /parntid1=min(p1) /parntid2=max(p2). recode parntid1 (99=-7). execute. If parntid1>0 and parntid2>0 and parntid1=parntid2 parntid2=-7. select if tulineno=1. cro parntid1 by parntid2. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\extra1.sav' /keep persid cphome parntid1 parntid2. ******************************************** *create person identifier of spouse/partner* ********************************************. GET FILE='F:\evrim\AHTUS\2010\atusrost_2010.sav'. rename variables (tucaseid=persid). compute sp1=-7. execute. if terrp=20 or terrp=21 sp1= tulineno. execute. freq sp1. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=persid /partid=max(sp1). select if tulineno=1. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\partid.sav' /keep persid tulineno partid. ************************* *create a diarist marker* *************************. GET FILE='F:\evrim\AHTUS\2010\atusrost_2010.sav'. rename variables (terrp tucaseid = drstmark persid). select if drstmark=18 or drstmark=19. execute. sort cases by persid tulineno. save outfile='F:\evrim\AHTUS\2010\tempb\extra2b.sav' /keep persid tulineno drstmark. *************************************************** *create relrefp variable "rel to hhold ref person"* ***************************************************. GET FILE='F:\evrim\AHTUS\2010\atuscps_2010.sav' /keep tucaseid tulineno perrp hrnumhou. rename variables (tucaseid=persid). sort cases by persid tulineno. match files files=* files='F:\evrim\AHTUS\2010\tempb\extra2b.sav' /by persid tulineno. execute. freq hrnumhou perrp. cro perrp by drstmark. *note that in this case, the reference person is the reference *person from the CPS sample and not necessarily the diarist. recode perrp (low thru -1=-8) (1,2=1) (3,13,14=2) (4,9=3) (6=4) (7=5) (5,8=9) (10, 12, 15 thru hi=10) into relrefp. execute. val lab RELREFP 1 'person 1' 2 'spouse/partner' 3 'child' 4 'parent' 5 'sibling' 6 'son/daughter-in-law' 7 'parent-in-law' 8 'brother/sister-in-law' 9 'other relative' 10 'not related' -7 'Not applicable/not asked' -8 'non-response' -9 'could not be created'. cro perrp by relrefp. *NOTE: Because of the changes in hhold structure or/and coding error, *there are some inconsistencies between respondent/ roster file and CPS *file. For more detailed description and how these resolved see Read Me file or *"the quality checks" section on this file. select if drstmark>0. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\extra2.sav' /keep persid hrnumhou relrefp. **************************************************** *create the time use variables for the 18+ diarists* ****************************************************. ************************************* *compute diary, survey and case info* *************************************. GET FILE='F:\evrim\AHTUS\2010\Harmonised Files\USA2010hfep.SAV'. freq survey. rename variables (hhid pid diaryday origwght recwght survey = hldid persid day ocombwt propwt surveyo). compute countrya = 38. compute survey = 2003. compute swave = 0. compute msamp = 0. compute diary=1. compute id = 1. execute. *note this dataset already contains the variables *month and year in mtus format. apply dictionary from 'F:\evrim\AHTUS\mtusw58schema.sav'. ********************************************* *harmonised time use variables (av1 ro av41)* *from version 1 through 5.8 * *********************************************. vector av(41). loop i=1 to 41. compute av(i)=0. end loop. do if main=8 or main=10 or main=13 or main=14 or main=15. compute av1=time. else if main=11. compute av2=time. else if main=12. compute av3=time. else if main=16 or main=18 or main=19. compute av4=time. else if main=92 or main=93 or main=94. compute av5=time. else if main=20 or main=21. compute av6=time. else if main=22 or main=23. compute av7=time. else if main=24 or main=25 or main=40 or main=68. compute av8=time. else if main=67. compute av9=time. else if main=26 or main=27 or main=30 or main=31. compute av10=time. else if main=65 or (main>32 and main<40). compute av11=time. else if main=91 or (main>94 and main<98). compute av12=time. else if main=1 or main=2 or main=6. compute av13=time. else if main=7 or main=28 or main=29 or main=32. compute av14=time. else if main=9 and eloc~=6. compute av15=time. else if main=3 or main=4 or main=5. compute av16=time. else if main=90 or main=98. compute av17=time. else if main=50 or main=54 or main=55 or main=64. compute av18=time. else if main=60 or main=63 or main=66. compute av19=time. else if main=51. compute av20=time. else if main=62. compute av21=time. else if main=49. compute av22=time. else if (main>40 and main<47) or main=48. compute av23=time. else if main=52 or main=53. compute av24=time. else if main=57. compute av25=time. else if main=56 or (main=9 and eloc=6). compute av28=time. else if (main=71 or main=72) and eloc>1. compute av29=time. else if main=85. compute av30=time. else if main=86. compute av31=time. else if main=84. compute av32=time. else if main=17 or main=89. compute av33=time. else if main=81. compute av34=time. else if main=82 or main=83. compute av35=time. else if main=70 or main=78. compute av36=time. else if main=88. compute av37=time. else if (main=71 or main=72) and eloc<2. compute av38=time. else if main=76. compute av39=time. else if main=73 or main=74 or main=75 or main=77 or main=87. compute av40=time. else if main=-8 or main=58. compute av41=time. end if. desc av1 to av41. *compute a test variable to make sure activity categories * add up to 1440. compute total = SUM (av1 to av41). execute. *Three categories have no reported instance: av26(social clubs), av27(pubs) and av35 (read papers, magazines). *Reading books, periodicals or newspapers were not coded seperately *after 2001. All forms of reading were collapsed to reading for personal *interest (original code 120312). Therefore it is not possible to create *av35 for the files after 2003. We coded "reading for personal interest" as av34 (reading books). compute av35=-9. compute av26=-9. compute av27=-9. execute. sort cases by persid. *note that these files only include adult diarists. aggregate /outfile='F:\evrim\AHTUS\2010\USA2010W553adult.sav' /break=countrya survey swave msamp hldid persid id /day= max(day) /month= max(month) /year= max(year) /diary= max(diary) /av1= sum(av1) /av2= sum(av2) /av3= sum(av3) /av4= sum(av4) /av5= sum(av5) /av6= sum(av6) /av7= sum(av7) /av8= sum(av8) /av9= sum(av9) /av10= sum(av10) /av11= sum(av11) /av12= sum(av12) /av13= sum(av13) /av14= sum(av14) /av15= sum(av15) /av16= sum(av16) /av17= sum(av17) /av18= sum(av18) /av19= sum(av19) /av20= sum(av20) /av21= sum(av21) /av22= sum(av22) /av23= sum(av23) /av24= sum(av24) /av25= sum(av25) /av26= max(av26) /av27= max(av27) /av28= sum(av28) /av29= sum(av29) /av30= sum(av30) /av31= sum(av31) /av32= sum(av32) /av33= sum(av33) /av34= sum(av34) /av35= max(av35) /av36= sum(av36) /av37= sum(av37) /av38= sum(av38) /av39= sum(av39) /av40= sum(av40) /av41= sum(av41) /total= sum(total) /ocombwt= max(ocombwt) /propwt= max(propwt). aggregate /outfile='F:\evrim\AHTUS\2010\USA2010W58avadult.sav' /break=countrya survey swave msamp hldid persid id /day= max(day) /month= max(month) /year= max(year) /diary = max(diary) /av1= sum(av1) /av2= sum(av2) /av3= sum(av3) /av4= sum(av4) /av5= sum(av5) /av6= sum(av6) /av7= sum(av7) /av8= sum(av8) /av9= sum(av9) /av10= sum(av10) /av11= sum(av11) /av12= sum(av12) /av13= sum(av13) /av14= sum(av14) /av15= sum(av15) /av16= sum(av16) /av17= sum(av17) /av18= sum(av18) /av19= sum(av19) /av20= sum(av20) /av21= sum(av21) /av22= sum(av22) /av23= sum(av23) /av24= sum(av24) /av25= sum(av25) /av26= max(av26) /av27= max(av27) /av28= sum(av28) /av29= sum(av29) /av30= sum(av30) /av31= sum(av31) /av32= sum(av32) /av33= sum(av33) /av34= sum(av34) /av35= max(av35) /av36= sum(av36) /av37= sum(av37) /av38= sum(av38) /av39= sum(av39) /av40= sum(av40) /av41= sum(av41) /ocombwt= max(ocombwt) /propwt= max(propwt). ***************************** *av variable for version 6.0* *****************************. compute av=999. execute. do if main=8 or main=10 or main=13 or main=14 or main=15. compute av=1. else if main=11. compute av=2. else if main=12. compute av=3. else if main=16 or main=18 or main=19. compute av=4. else if main=92 or main=93 or main=94. compute av=5. else if main=20 or main=21. compute av=6. else if main=22 or main=23. compute av=7. else if main=24 or main=25 or main=40 or main=68. compute av=8. else if main=67. compute av=9. else if main=26 or main=27 or main=30 or main=31. compute av=10. else if main=65 or (main>32 and main<40). compute av=11. else if main=91 or (main>94 and main<98). compute av=12. else if main=1 or main=2 or main=6. compute av=13. else if main=7 or main=28 or main=29 or main=32. compute av=14. else if main=9 and eloc~=6. compute av=15. else if main=3 or main=4 or main=5. compute av=16. else if main=90 or main=98. compute av=17. else if main=50 or main=54 or main=55 or main=64. compute av=18. else if main=60 or main=63 or main=66. compute av=19. else if main=51. compute av=20. else if main=62. compute av=21. else if main=49. compute av=22. else if (main>40 and main<47) or main=48. compute av=23. else if main=52 or main=53. compute av=24. else if main=57. compute av=25. else if main=56 or (main=9 and eloc=6). compute av=28. else if (main=71 or main=72) and eloc>1. compute av=29. else if main=85. compute av=30. else if main=86. compute av=31. else if main=84. compute av=32. else if main=17 or main=89. compute av=33. else if main=81. compute av=34. else if main=82 or main=83. compute av=35. else if main=70 or main=78. compute av=36. else if main=88. compute av=37. else if (main=71 or main=72) and eloc<2. compute av=38. else if main=76. compute av=39. else if main=73 or main=74 or main=75 or main=77 or main=87. compute av=40. else if main=-8 or main=58. compute av=41. end if. variable labels av "main activity 41 category list". value labels av 1 'paid work' 2 'paid work at home' 3 'paid work, second job' 4 'school, classes' 5 'travel to/from work' 6 'cook/ wash up' 7 'housework' 8 'odd jobs' 9 'gardening' 10 'shopping' 11 'childcare' 12 'domestic travel' 13 'dress/personal care' 14 'consume personal services' 15 'meals and snacks' 16 'sleep' 17 'free time travel' 18 'excursions' 19 'active sports participation' 20 'passive sports participation' 21 'walking' 22 'religious activities' 23 'civic activities ' 24 'cinema or theatre' 25 'dances or parties' 26 'social clubs' 27 'pubs' 28 'restaurants' 29 'visit friends at their homes' 30 'listen to radio' 31 'watch television or video' 32 'listen to records, tapes, cds' 33 'study, homework' 34 'read books' 35 'read papers, magazines' 36 'relax' 37 'conversation' 38 'entertain friends at home' 39 'knit, sew' 40 'other leisure' 41 'unclassified or missing activities'. freq av. temp. select if av<10. cro main by av. temp. select if av>10 and av<20. cro main by av. temp. select if av>19 and av<29. cro main by av. temp. select if av>28 and av<35. cro main by av. temp. select if av>34 and av<42. cro main by av. *note that this file only includes adult diarists. sort cases by survey swave persid epnum. save outfile='F:\evrim\AHTUS\2010\USA2010W60avadult.sav' /keep countrya survey swave msamp hldid persid id epnum av. *check whether the total time equals 1440. get file= 'F:\evrim\AHTUS\2010\USA2010W553adult.sav'. freq total. *all diaries add up to the correct 1440 minutes. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\USA2010W553adult.sav' /drop total. ************************************************* *create time use and who else present variables* *for versions 5.8 and 6.0 * *************************************************. GET FILE='F:\evrim\AHTUS\2010\atusresp_2010.sav' /keep tucaseid tuyear tumonth tudidate tudiday tufinwgt. freq tuyear tumonth tudidate tudiday. rename variables (tucaseid tuyear tumonth tudiday = pid year month diaryday). *****Make sure they are all numeric!****. compute cday= tudidate - trunc(tudidate/100)*100. freq cday. sort cases by pid. save outfile='F:\evrim\AHTUS\2010\tempb\datewght.sav' /keep pid diaryday cday month year tufinwgt. *extract sex and age to check weights - also to refine closefamily code. GET FILE='F:\evrim\AHTUS\2010\atusrost_2010.sav'. *select for the diarists only. select if terrp=18 or terrp=19. rename variables (tucaseid teage tesex =pid age sex). freq sex. desc age. sort cases by pid. save outfile='F:\evrim\AHTUS\2010\tempb\dem.sav' /keep pid sex age. *the who else is present file lists various *codes for children aged <18, but the code *does not specify the ages - match ages from *roster file, and use code created for the *demographic file. Note in this case, unlike the *construction of variables for the demographic file, *we include the young non-household children. GET FILE='F:\evrim\AHTUS\2010\atusrost_2010.sav' /keep TUCASEID TULINENO TEAGE. compute u5=0. compute u18=0. If teage>-1 and teage<5 u5=1. If teage>-1 and teage<18 u18=1. freq u5 u18. rename variables tucaseid=pid. sort cases by pid tulineno. save outfile='F:\evrim\AHTUS\2010\tempb\kidflag.sav'. **************************** *who else present variables* ****************************. GET FILE='F:\evrim\AHTUS\2010\atuswho_2010.sav'. rename variables (tucaseid tuact_n=pid epnum). sort cases by pid tulineno. match files files=* table='F:\evrim\AHTUS\2010\tempb\kidflag.sav' /by pid tulineno. execute. compute sppart=0. compute oad=0. compute alone=0. compute child=0. compute infant=0. compute hhadult=0. execute. freq sppart to hhadult. ******** *sppart* ********. If tuwhocod=20 or tuwhocod=21 sppart=1. cro tuwhocod by sppart. cro sppart by u18. freq sppart. ***** *oad* *****. If tuwhocod>19 and u18=0 oad=1. freq oad. cro oad by u18 u5 child. cro tuwhocod by oad. ******* *alone* *******. If tuwhocod=18 or tuwhocod=19 alone=1. cro tuwhocod by u18 u5. cro tuwhocod by alone. ******* *child* *******. *note that some spouses aged <18 - to avoid confusion with spouse and *a child being present from cases of a spouse aged 16-17 only present, *code the child variables only for cases where the tuwhocod>spouse/partner. If u18=1 and tuwhocod>21 child=1. cro child by u18 u5. cro tuwhocod by child. *we will use infant & hhadult while creating activity codes. ******** *infant* ********. If u5=1 and tuwhocod>21 infant=1. cro infant by u5 child. cro tuwhocod by infant. ********* *hhadult* *********. Do if tuwhocod=26 or (tuwhocod>27 and tuwhocod<40). compute hhadult=1. Else if tuwhocod=-1. compute hhadult=-7. Else if tuwhocod=-2 or tuwhocod=-3. compute hhadult=-8. End if. freq hhadult. cro hhadult by tuwhocod. AGGREGATE /OUTFILE="F:\evrim\AHTUS\2010\tempb\who.sav" /BREAK=pid epnum /alone = MAX(alone) /infant = MAX(infant) /child = MAX(child) /sppart = MAX(sppart) /oad = MAX(oad) /hhadult = MAX(hhadult). ********************** ********************** **time use variables** **********************. ****************************************************************** *create variables epnum, clockst, start, end, time, maxep, lastep* ******************************************************************. Get file='F:\evrim\AHTUS\2010\atusact_2010.sav' /keep tucaseid tuact_n tustart tustop. sort cases by tucaseid tuact_n. SAVE TRANSLATE OUTFILE='F:\evrim\AHTUS\2010\tempb\startstop.dat' /TYPE=TAB /MAP /REPLACE /FIELDNAMES. *this start and stop time information is recorded as string *fields (in hour minute second format, though the second *field is left blank). The file is saved as ASCII and reopened *breaking up the time fields to concert the time information *to a format consistent with the other heritage files. GET DATA /TYPE = TXT /FILE = 'F:\evrim\AHTUS\2010\tempb\startstop.dat' /DELCASE = LINE /DELIMITERS = "\t:" /ARRANGEMENT = DELIMITED /FIRSTCASE = 2 /IMPORTCASE = ALL /VARIABLES = pid F14.0 epnum F2.0 sthr F2.0 stmin F2.0 stsec F2.0 finhr F2.0 finmin F2.0 finsec F2.0 . CACHE. EXECUTE. sort cases by pid(a) epnum (d). compute clockst= sthr*100 + stmin. freq clockst. *NOTE that unlike the other surveys, the 2005 ATUS *begins the diary day at 4:00 and not at midnight. *the clockst variable denotes the clock time when *the activity began - but the variables start and *end are converted to mark the minute position in *the diary for consistency with the previous surveys. Do if sthr>3. compute cst=clockst-400. Else if sthr<4. compute cst=clockst+2000. End if. Do if finhr>3. compute cend= (finhr*100 + finmin)-400. Else if finhr<4. compute cend= (finhr*100 + finmin)+2000. end if. execute. *NOTE also that the end time shows the actual *end time and not the end of the diary day. *While this information is extremely useful, *as it is not available in the heritage surveys, *the end time of the last episode is set to 2400. AGGREGATE /OUTFILE* mode=addvariables /BREAK=pid /maxep = MAX(epnum). compute lastep=0. If epnum=maxep lastep=1. freq lastep. *this confirms the recording of 13260 diaries. if lastep=1 cend=2400. desc cend cst. sort cases by pid(a) epnum(a). Compute start=trunc(cst/100)*60+(cst-(trunc(cst/100))*100). Compute end=trunc(cend/100)*60+(cend-(trunc(cend/100))*100). compute time=end-start. desc start end time. compute clockst=clockst/100. save outfile="F:\evrim\AHTUS\2010\tempb\sstime.sav" /keep pid epnum clockst start end time maxep lastep. ***************************************************************** *create variables inout, mtrav, eloc, survey, wave, main and sec* *****************************************************************. Get file='F:\evrim\AHTUS\2010\atusact_2010.sav'. missing values all (). rename variables (tucaseid tuact_n =pid epnum). compute main=-5. compute sec=0. compute inout=-5. compute eloc=-5. compute mtrav=-5. compute survey=7. compute wave=7. *Wave must be changed every year. *(2010=8, 2009=7, 2008=6, 2007=5, 2006=4, 2005=3, 2004=2 etc). apply dictionary from 'F:\evrim\AHTUS\MTUSW58schema_main.sav'. freq survey wave. match files files=* files="F:\evrim\AHTUS\2010\tempb\sstime.sav" /BY pid epnum. execute. match files files=* table='F:\evrim\AHTUS\2010\tempb\datewght.sav' /BY pid. match files files=* files="F:\evrim\AHTUS\2010\tempb\who.sav" /by pid epnum. freq actcode tewhere. temp. select if tewhere=-1 or tewhere=89. freq actcode. temp. select if actcode=10101 or actcode=10102 or actcode=10201 or actcode=10299 or actcode=10401 or actcode=10499 or actcode=30111 or actcode=30112 or actcode=30503 or actcode=30504 or actcode=40111 or actcode=40112 or actcode=40507 or actcode=40508 or actcode=130131 or actcode=500105 or actcode=500106. freq actcode. *all instances of sleep (10101); sleeplessnes (10102); sleeping (nec) (10199) *washing & dressing (10201); grooming nec (10299); personal care (10401); *personal care nec (10499), 500106 (do not remember), and 500105 *(none of your business) have no recorded location. Recode the *location of these activities (except for the do not remember) *as the location where they are before starting the activity (unless *this is travelling) or as the next location unless the next *location is travelling or the end of the diary. sort cases by pid(a) epnum(d). compute nextact=-5. compute nextloc=-5. if pid=lag(pid) nextact=lag(actcode). if pid=lag(pid) nextloc=lag(tewhere). freq nextact nextloc. *there are 13260 diaries (we know this as the frequency *of epnum=1 is 13260) with nextloc and nextact=-5 - these *are the last episodes in the diary day. temp. select if nextact=-5. freq lastep. sort cases by pid(a) epnum(a). compute next=-5. Do if lastep=1. compute next=5. Else if nextloc=-1 or nextloc=89. compute next=1. Else if nextact>500000 and ((nextloc>0 and nextloc<12) or nextloc=30 or nextloc=31 or nextloc=32). compute next=3. Else if nextact<180000 and ((nextloc>0 and nextloc<12) or nextloc=30 or nextloc=31 or nextloc=32). compute next=4. Else if ((nextloc>11 and nextloc<30) or nextloc=99 or (nextact>17999 and nextact<500101) or nextact=500103). compute next=2. End if. val lab next 1 next still missing 2 travel next 3 next act missing but next location known 4 next act known and not travel and location known 5 end of diary and missing location. freq next. compute prevact=-5. compute prevloc=-5. if pid=lag(pid) prevact=lag(actcode). if pid=lag(pid) prevloc=lag(tewhere). freq prevact prevloc. *again 13260 cases of previous activity and location=-5. *these are the first episodes. temp. select if epnum=1. freq prevact. compute prev=-5. Do if epnum=1. compute prev=5. Else if prevloc=-1 or prevloc=89. compute prev=1. Else if prevact>500000 and ((prevloc>0 and prevloc<12) or prevloc=30 or prevloc=31 or prevloc=32). compute prev=3. Else if prevact<170000 and ((prevloc>0 and prevloc<12) or prevloc=30 or prevloc=31 or prevloc=32). compute prev=4. Else if ((prevloc>11 and prevloc<30) or prevloc=99 or (prevact>17999 and prevact<500101) or prevact=500103). compute prev=2. End if. val lab prev 1 previous still missing 2 previous travel 3 previous act missing but previous location known 4 previous act known and not travel and location known 5 start of diary and missing location. freq prev. temp. select if lastep=1 or epnum=1. freq tewhere. *most of the first and last episodes have missing location. compute where=tewhere. compute where2=tewhere. freq where. *where will be used to code location. where2 is used to look at *the transformations to ensure the adjustments work as expected. *before we start, 47495 (18.5% of cases)=-1; 908 (0.3%) = 89; 3 =99. Do if pid=lag(pid) and (actcode=10101 or actcode=10102 or actcode=10199 or actcode=10201 or actcode=10299 or actcode=10401 or actcode=10499 or actcode=500106) and (prev=3 or prev=4). compute where=prevloc. Else if pid=lag(pid) and (actcode=10101 or actcode=10102 or actcode=10201 or actcode=10299 or actcode=10401 or actcode=10499 or actcode=500106) and (next=3 or next=4). compute where=nextloc. End if. freq where. cro tewhere by where. *19439 (7.6% of cases)=-1; 908 (0.4%)=89. Do if epnum=1. compute eptest=1. Else if epnum=2. compute eptest=2. Else if lastep=1. compute eptest=5. Else if epnum=maxep-1. compute eptest=4. Else. compute eptest=3. End if. val lab eptest 1 1st episode 2 2nd episode 3 middle episode 4 next from last episode 5 last episode. temp. select if where=-1 or where=89. freq eptest. *of those locations which remain missing 61.5% are the first episode; *8.6% 2nd episode; 16.1% last episode; 3.2% penultimate episode, rest *in middle. compute prev2=0. if where=-1 prev2=lag(where). if where=-1 and $casenum=1 prev2=-5. freq prev2. sort cases by pid(a) epnum(d). compute next2=0. if where=-1 next2=lag(where). if where=-1 and $casenum=1 next2=-5. freq next2. sort cases by pid(a) epnum(a). *second filling-in iteration - where there have been two slots in *a row with the location missing, fill in the location as the *previous or next location so long as the previous or next location *not travelling. Do if pid=lag(pid) and (where=-1 or where=89) and ((prev2>0 and prev2<12) or prev2=30 or prev2=31 or prev2=32). compute where=prev2. Else if (pid=lag(pid) or epnum=1) and (where=-1 or where=89) and ((next2>0 and next2<12) or next2=30 or next2=31 or next2=32). compute where=next2. End if. freq where. cro where by where2. *now 6248 (2.4% of cases)=-1; 908 (0.4%)=89. repeat the *previous iteration to pick up second and penultimate cases. compute prev2=0. if where=-1 prev2=lag(where). if where=-1 and $casenum=1 prev2=-5. freq prev2. sort cases by pid(a) epnum(d). compute next2=0. if where=-1 next2=lag(where). if where=-1 and $casenum=1 next2=-5. freq next2. sort cases by pid(a) epnum(a). Do if pid=lag(pid) and (where=-1 or where=89) and ((prev2>0 and prev2<12) or prev2=30 or prev2=31 or prev2=32). compute where=prev2. Else if (pid=lag(pid) or epnum=1) and (where=-1 or where=89) and ((next2>0 and next2<12) or next2=30 or next2=31 or next2=32). compute where=next2. End if. freq where. cro where by where2. *now 5193 (2% of cases)=-1; 908 (0.4%)=89. temp. select if where=-1 or where=89. freq eptest. *more now at beginning of diary- 37.9% first episode; 26.9% 2nd *episode; 2.7% last episode; 5.4% penult episode, rest in middle. compute test=0. if lastep=1 and where=-1 test=1. freq test. temp. select if epnum=1 and where=-1. freq next actcode nextact. *these diaries start with location unknown followed by travel *or more missing; about 1/6th sleep followed by personal care. temp. select if epnum=2 and where=-1. cro prevact by nextact nextloc. *deal with cases of sleep or personal care, followed by personal care *in episode 2, followed by travel. Determine where people end up *after their travel cycle completed. compute mark=0. if epnum=2 and actcode=10201 and prevact<10405 and (nextact>130103 and nextact<190000) mark=1. var lab mark 'marker of sleep then wash then cycle/walk or travel'. compute mark2=0. if lastep=1 and (prevact>180000 and prevact<500000) and where=-1 and actcode<10500 mark2=1. freq mark mark2. compute locs=0. compute locf=0. if epnum=1 locs=where. if lastep=1 locf=where. AGGREGATE /OUTFILE* mode=addvariables /BREAK=pid /pattern1 'starts sleep, wash, travel' = MAX(mark) /pattern2 'ends travel then person care or sleep' = MAX(mark2) /locstart=max(locs) /locend=max(locf). cro pattern1 by locend pattern2. cro pattern2 by locstart. if pattern2=1 and lastep=1 and (where=-1 or where=89) and locstart=1 where=1. if pattern1=1 and epnum=1 and (where=-1 or where=89) and locend=1 where=1. if pattern1=1 and epnum=2 and (where=-1 or where=89) and locend=1 where=1. freq where. *now 2280 cases (0.9%) have location=-1 and 908 (0.4%) location not remembered. *rerun some previous iterations as start and end locations now amended. sort cases by pid(a) epnum(d). compute nextloc=-5. if pid=lag(pid) nextloc=lag(where). sort cases by pid(a) epnum(a). compute next=-5. Do if lastep=1. compute next=5. Else if nextloc=-1 or nextloc=89. compute next=1. Else if nextact>500000 and ((nextloc>0 and nextloc<12) or nextloc=30 or nextloc=31 or nextloc=32). compute next=3. Else if nextact<180000 and ((nextloc>0 and nextloc<12) or nextloc=30 or nextloc=31 or nextloc=32). compute next=4. Else if ((nextloc>11 and nextloc<30) or nextloc=99 or (nextact>17999 and nextact<500101) or nextact=500103). compute next=2. End if. val lab next 1 next still missing 2 travel next 3 next act missing but next location known 4 next act known and not travel and location known 5 end of diary and missing location. freq next. compute prevloc=-5. if pid=lag(pid) prevloc=lag(tewhere). compute prev=-5. Do if epnum=1. compute prev=5. Else if prevloc=-1 or prevloc=89. compute prev=1. Else if prevact>500000 and ((prevloc>0 and prevloc<12) or prevloc=30 or prevloc=31 or prevloc=32). compute prev=3. Else if prevact<180000 and ((prevloc>0 and prevloc<12) or prevloc=30 or prevloc=31 or prevloc=32). compute prev=4. Else if ((prevloc>11 and prevloc<30) or prevloc=99 or (prevact>17999 and prevact<500101) or prevact=500103). compute prev=2. End if. val lab prev 1 previous still missing 2 previous travel 3 previous act missing but previous location known 4 previous act known and not travel and location known 5 start of diary and missing location. freq prev. Do if pid=lag(pid) and (actcode=10101 or actcode=10102 or actcode=10201 or actcode=10299 or actcode=10401 or actcode=10499 or actcode=500106) and (prev=3 or prev=4). compute where=prevloc. Else if pid=lag(pid) and (actcode=10101 or actcode=10102 or actcode=10201 or actcode=10299 or actcode=10401 or actcode=10499 or actcode=500106) and (next=3 or next=4). compute where=nextloc. End if. freq where. cro tewhere by where. *now 2022 cases (0.8%) have location=-1 and 908 (0.4%) location not remembered. compute prev2=0. if where=-1 prev2=lag(where). if where=-1 and $casenum=1 prev2=-5. sort cases by pid(a) epnum(d). compute next2=0. if where=-1 next2=lag(where). if where=-1 and $casenum=1 next2=-5. sort cases by pid(a) epnum(a). Do if pid=lag(pid) and (where=-1 or where=89) and ((prev2>0 and prev2<12) or prev2=30 or prev2=31 or prev2=32). compute where=prev2. Else if (pid=lag(pid) or epnum=1) and (where=-1 or where=89) and ((next2>0 and next2<12) or next2=30 or next2=31 or next2=32). compute where=next2. End if. freq where. cro where by where2. *now 1921 cases (0.7%) have location=-1 and 908 (0.4%) location not remembered. temp. select if where=89. freq eptest. *none of 908 don't remember cases at the end of the diary, *Pnly one at the beginning of the diary. *most in the middle of the diary. temp. select if where=-1. freq eptest. *first and middle episodes now have majority of location not reported during *sleep or personal care. look at sequences around both cases. temp. select if where=89. freq prevact actcode nextact prevloc nextloc. *one common pattern here is travel for child or adult care(own household & *other household), followed by drop-off or pick up adult/child, followed *by adult care or child care travel. These cases are not at home or at the *workplace, unlikely to be school as school runs are more likely to be *remembered. The AHTUS location codes are less detailed than the ATUS *codes, and the location is going to be away from home and in transit, *so these locations set to other. If where=89 and (prevact>180000 and prevact<190000) and (actcode=30111 or actcode=30112 or actcode=30503 or actcode=30504 or actcode=40111 or actcode=40112 or actcode=40507 or actcode=40508) and (nextact>180000 and nextact<190000) where=11. *also a number of 89 cases during walking - check before and after locations and acts. temp. select if where=89 and actcode=130131. cro prevloc by nextloc. *nearly half of these cases are walks returning to the same place (more home than *elsewhere), or tansition walks between home or other home and elsewhere. Code such *cases as outdoors away from home. Other cases in between forms of transport - and *walking could be inside, but are not at home or specified place, so code these as *other place. do if where=89 and actcode=130131 and ((prevloc>-1 and prevloc<12) or (nextloc>-1 and nextloc<12)). compute where=9. else if where=89 and actcode=130131. compute where=11. end if. freq where. *now 1921 cases (0.7%) have location=-1 and 74 (0.0%)=89 location not remembered. temp. select if where=89. freq prevact actcode nextact prevloc nextloc. *these remaining 74 cases all involve waiting for or dropping off an adult *or child, so set these to other location on same principle as the previous *transformation. If where=89 and (actcode=30111 or actcode=30112 or actcode=30503 or actcode=30504 or actcode=40507 or actcode=40508 or actcode=100103) where=11. temp. select if where=-1 and epnum>1 and lastep=0. cro prevloc by nextloc. *two main cases where missing location but not beginning or end of diary day, *strings of missing cases (sleep and personal care) together, and single *personal care breaks in between travel episodes. Deal with former first, *counting the number of cases in these strings. compute test=0. Do if epnum=1 and where=-1. compute test=1. Else if where=-1 and pid=lag(pid). compute test=lag(test)+1. End if. freq test. *3 cases where there are 4 strings of missings. Visually examine this case. *Note: Examine the cases with more than three strings of missings. temp. select if test>3. freq pid. *20100303100161 is a good diary with 38 episodes. *20100908101749 is a good diary with 13 episodes. *20100907100562 is a good diary with 33 episodes. Missings are in between two travels. *we cannot conclude that they took place at respondent's house. *Those 3 diaries are visually examined. *In the first two ones, the activities in all the episodes are sleep or washing/dressing. *where place is missing obviously takes place at respondents' house. *E.g.The resp returns back home watches TV and then goes to bed. *Wakes up and does personal care (at home). *Recode the period after self care as resp.s home. Do if pid=20100303100161 or pid=20100908101749 and where=-1. compute where=1. End if. If where=-1 and (prevloc>-1 and prevloc<12) and (nextloc>-1 and nextloc<12) and prevloc=nextloc where=prevloc. execute. temp. select if test=3. cro epnum by locend. *most strings of three are at start of diary day and day ends at home. temp. select if where=-1 and epnum<4. cro locstart by locend. if where=-1 and epnum<4 and locend=1 where=1. freq where. *now 1111 cases (0.4%) have location=-1. temp. select if where=-1. fre prevact nextact actcode. temp. select if where=-1. desc time. compute test=0. if (actcode=10101 or actcode=10102) and where=-1 test=1. temp. select if test=1. freq epnum lastep. *219 (177+42) of these 336 cases where sleep remains in missing location *are the first or last episode of the diary day. Visually look *at cases. compute mark=0. compute mark2=0. compute locs=0. compute locf=0. if epnum=1 locs=where. if lastep=1 locf=where. if where=1 mark=1. if where=3 mark2=3. freq mark2. AGGREGATE /OUTFILE* mode=addvariables /BREAK=pid /anyhome 'any time at own home' = MAX(mark) /anyohome 'any time at another home' = MAX(mark2) /locstart2=max(locs) /locend2=max(locf). temp. select if test=1. freq locstart2 locend2. *where the person starts or ends the day at home and *the location where they are asleep is unknown at the *other end of the diary day, code the sleep to being *at home. if test=1 and epnum=1 and locend2=1 where=1. if test=1 and lastep=1 and locstart2=1 where=1. compute test=0. if (actcode=10101 or actcode=10102) and where=-1 test=1. if test=1 and epnum=1 and locend2=3 where=3. if test=1 and lastep=1 and locstart2=3 where=3. compute test=0. if (actcode=10101 or actcode=10102) and where=-1 test=1. temp. select if test=1. cro anyhome by anyohome. temp. select if test=1. desc time. compute test2=0. if time<61 and test=1 test2=1. freq test2. *naps visually examined. *if the person spends any time at home, assume these sleep and nap *episodes are at home. If no time spent at home but time spent at *someone else's home, then the sleeping location set to other home. if anyhome=1 and test=1 where=1. if anyhome=0 and anyohome=3 and test=1 where=3. freq where. *now 821 cases (0.3%) have location=-1. compute test=0. if (actcode=10101 or actcode=10102) and where=-1 test=1. freq test. *now only 46 cases of sleep with unidentified location. visually examine. *these diaries either clearly involve sleep at an other location *or give no clear indication. Code these as at other locations. temp. select if test=1. freq pid. *Check those cases visually:. AGGREGATE /OUTFILE* mode=addvariables /BREAK=pid /testpid = MAX(test). save outfile = 'F:\evrim\AHTUS\2010\tempb\mid1.sav'. temp. select if testpid=1. save outfile = 'F:\evrim\AHTUS\2010\tempb\testfile.sav' /KEEP pid epnum tewhere where actcode. get file 'F:\evrim\AHTUS\2010\tempb\testfile.sav'. sort cases by pid epnum. execute. * Visually examined those cases. All of them cases either involved travel * before/after sleep or another place was reported before/after sleep. So * not possible to identify the location. get file = 'F:\evrim\AHTUS\2010\tempb\mid1.sav'. compute atoth=0. if where=9 or where=11 atoth=1. AGGREGATE /OUTFILE* mode=addvariables /BREAK=pid /anyother 'any time at other location' = MAX(atoth) /nolocslp 'any sleep with no time at home or other home' = MAX(test). temp. select if test=1. cro anyother by nolocslp. if where=-1 and anyother=1 where=11. freq where. *now 323 cases (0.1%) have location=-1. temp. select if where=-1. fre prevact nextact actcode. temp. select if where=-1. desc time. *most of the remainder between travel gaps, remainder left missing. *now that the location information filled in wherever possible, *make AHTUS variables. *this coding syntax has a hierarchy - coded as outside if possible *first, and if not possible to code as outside, then if possible *to code as in transit, and if not possible, then to code as inside. *cases with unknown location that are most likely to take place inside *sleep and personal care, and those sports that are generally inside, *USA bowling, billiards, gymnastics, martial arts, set to inside, *main activity not possible to code but location is walking set to outside; *and residual set to -8. *see what people are doing when walking (need to avoid coding mall walking *as outside). temp. select if tewhere=14. freq actcode. save outfile = 'F:\evrim\AHTUS\2010\tempb\mid1.sav'. get file = 'F:\evrim\AHTUS\2010\tempb\mid1.sav'. ******* *inout* *******. compute inout=-5. freq inout. Do if where~=18 and where~=19 and (where=9 or where=17 or actcode=20401 or actcode=20402 or actcode=20499 or actcode=20501 or actcode=20502 or actcode=20599 or actcode=70102 or actcode=40502 or actcode=40105 or actcode=130102 or actcode=130104 or actcode=130106 or actcode=130108 or actcode=130110 or actcode=130112 or actcode=130113 or actcode=130114 or actcode=130116 or actcode=130118 or actcode=130121 or actcode=130123 or actcode=130124 or actcode=130126 or actcode=130127 or actcode=130129 or (where=14 and (actcode=30103 or actcode=30105 or actcode= 30112 or actcode=30199 or actcode=40199 or actcode=40401 or actcode=49999 or actcode=40507 or actcode=500103 or actcode=500104 or (actcode>180100 and actcode<500101)))). compute inout=2. Else if where<12 or (where>29 and where<89). compute inout=1. Else if where=12 or where=13 or where=15 or where=16 or where=18 or where=19 or where=20 or where=21 or where=99 or (actcode=30103 or actcode=40507 or actcode=110203 or actcode=150202 or (actcode>180100 and actcode<500101) or actcode=30112 or actcode=30503 or actcode=40112). compute inout=3. Else if actcode=20101 or actcode=20301 or actcode=20399 or actcode=20104 or actcode=150302 or actcode<200000 or actcode=130219 or actcode=130215 or actcode=130207 or actcode=130205 or actcode=130119 or actcode=130115 or actcode=130107 or actcode=130105. compute inout=1. Else if where=14. compute inout=2. Else. compute inout=-8. End if. value labels inout 1 'inside' 2 'outside' 3 'in a vehicle'. freq inout. value labels where 1 "Respondent's home or yard" 2 "Respondent's workplace" 3 "Someone else's home" 4 'Restaurant or bar' 5 'Place of worship' 6 'Grocery store' 7 'Other store-mall' 8 'School' 9 'Outdoors away from home' 10 'Library' 11 'Other place' 12 'Car, truck, or motorcycle [driver]' 13 'Car, truck, or motorcycle [passenger]' 14 'Walking' 15 'Bus' 16 'Subway-train' 17 'Bicycle' 18 'Boat-ferry' 19 'Taxi-limousine service' 20 'Airplane' 21 'Other mode of transportation' 30 'Bank' 31 'Gym-health club' 32 'Post Office' 89 'Unspecified place'. cro tewhere where by inout. *walking should never be in a vehicle. temp. select if where=14 and inout=3. cro pid by actcode. *If true this will give error. *Three cases of pick up/drop off other hh child. if where=14 and inout=3 inout=2. *Car/truck should be in a vehicle. temp. select if (where=12 and inout=2) or (where=13 and inout=2). freq actcode. *These cases corrected below. If where=12 inout=3. If where=13 inout=3. cro where by inout. temp. select if inout=2. freq actcode tewhere. temp. select if inout=1. freq actcode tewhere. temp. select if inout=3. freq actcode tewhere. ****** *eloc* ******. Do if where=1. compute eloc=1. Else if where=3. compute eloc=2. Else if where=2. compute eloc=3. Else if where=8. compute eloc=4. Else if where=6 or where=7 or where=10 or where=30 or where=31 or where=32. compute eloc=5. Else if where=4. compute eloc=6. Else if where=5. compute eloc=7. Else if (where>11 and where<22) or (actcode>179999 and actcode<=189999). compute eloc=8. Else if where=9 or where=11. compute eloc=9. Else. compute eloc=-8. End if. freq eloc. cro eloc by inout. freq tewhere. *If inout=3 (in a vehicle) eloc=-8(location unknown) must be coded as *eloc=8 (travelling). temp. select if inout=3 and eloc=-8. freq actcode. *All cases are picking up/dropping off children. If inout=3 and eloc=-8 eloc=8. *There should not be any case of inout=1(inside) and eloc=8(travelling). temp. select if inout=1 and eloc=8. freq actcode where tewhere. *some activities are not travel. *tewhere & where is either 11(other place) or 14(walking). temp. select if inout=1 and eloc=8 and where=14. freq actcode. temp. select if inout=1 and eloc=8 and where=11. freq actcode. *205 of those cases are coded as walking (where=14) *code the ones as walking outside. *The rest is travelling, so code them as inout=3. If eloc=8 and inout=1 and where=14 and actcode= 20602 inout=2. If eloc=8 and inout=1 and where=11 inout=3. temp. select if inout=1 and eloc=8. freq actcode where tewhere. *we will code the rest as outside-. If eloc=8 and inout=1 inout=2. compute temp=0. If inout=1 and eloc=8 and where=14 temp=1. freq temp. cro where by eloc. temp. select if inout=1 and eloc=8 and where=11. freq actcode. *If true this will give warning. compute temp=0. If inout=1 and eloc=8 and where=11 temp=1. freq temp. If temp=1 inout=3. If temp=1 where=99. cro where by eloc. cro eloc by inout. *check whether any travel activities coded as eloc -8. temp. select if eloc=-8. freq actcode. ******* *mtrav* *******. Do if where=12 or where=13 or where=19. compute mtrav=1. Else if where=15 or where=16 or where=18 or where=20. compute mtrav=2. Else if where=14 or actcode=130131. compute mtrav=3. Else if where=17 or actcode=130104. compute mtrav=4. Else if where=21 or inout=3 or eloc=8. compute mtrav=5. Else. compute mtrav=-7. End if. freq mtrav. cro eloc by mtrav. cro where by mtrav. cro mtrav by inout. *************************** *mtrav and inout checklist* ***************************. * (1) most cases of mtrav=3(on foot) should be inout=2(outside). * (2) mtrav=3(walking) should never be inout=3 (in vehicle). * (3) all mtrav=1(in car) should be inout=3(in vehicle). * (4) the vast majority of mtrav=4(other active travel) must be inout=2(outside). * (5) mtrav=5(travel by unknown means) should be inout=3(in a vehichle, almost all of it will be in a vehicle). temp. select if mtrav=3 and inout=3. freq actcode where eloc pid. *If mtrav=3 and inout=3 and actcode=130131 inout=2. temp. select if mtrav=5 and inout=2. freq actcode where eloc. *where is either 9(outdoors) or 21(other mode of transportation). *leave running and fishing as inout=2(outside) but not traveling. If mtrav=5 and inout=2 and actcode~=130124 and actcode~=130112 inout=3. If mtrav=5 and inout=2 mtrav=-7. cro mtrav by inout. cro eloc by mtrav. temp. select if mtrav=-7 and eloc=8. freq actcode inout. *Running and fishing, code as other location. If mtrav=-7 and eloc=8 and (actcode=130124 or actcode=130112) eloc=9. *final corrections to fix the inconsistencies. *If mtrav=3 and inout=3 inout=1 (We don't need this for 2010). temp. select if mtrav=1 and inout=2. freq actcode eloc. *if true this will give warning. *If cases mtrav=1 (car) but inout=2 (outside) instead of inout=3. *Check them and code them as inout=3. *if mtrav=1 and inout=2 and actcode=130104 mtrav=4. *if mtrav=1 and inout=2 inout=3. temp. select if mtrav=3 or mtrav=4. freq actcode. ******* *child* *******. cro actcode by child. Do If child=0 and (actcode=30101 or actcode=30102 or actcode=30103 or actcode=30104 or actcode=30105 or actcode=30106 or actcode=30107 or actcode=30109 or actcode=30112 or actcode=30199 or actcode=30201 or actcode=30203 or actcode=30299 or actcode=30301 or actcode=30302 or actcode=30399 or actcode=40101 or actcode=40102 or actcode=40103 or actcode=40104 or actcode=40105 or actcode=40106 or actcode=40107 or actcode=40109 or actcode=40112 or actcode=40199 or actcode=40201 or actcode=40203 or actcode=40299 or actcode=40301 or actcode=40302 or actcode=40399). compute child=1. End if. freq child. apply dictionary from 'F:\evrim\AHTUS\MTUSW58schema_main.sav'. save outfile = 'F:\evrim\AHTUS\2010\tempb\mid2.sav'. get file ='F:\evrim\AHTUS\2010\tempb\mid2.sav'. ****** *main* ******. *use this if find a problem in activity code before rerunning code. compute main=-5. freq main. Do if actcode=10101 or actcode=10102 or actcode=10199. Compute main=2. Else if actcode=10401 or actcode=10499 or actcode=10599 or actcode=19999 or actcode=10201 or actcode=10299 or actcode=10301 or actcode=10399 or actcode=10501. Compute main=4. Else if actcode=50202. Compute main=5. Else if actcode=110201 or actcode=110203 or actcode=110204 or actcode=119999 or (eloc~=6 and (actcode=110101 or actcode=110199 or actcode=110299)). Compute main=6. Else if tewhere~=1 and (actcode=50101 or actcode=50199 or actcode=50299 or actcode=50205 or actcode=59999). Compute main=7. Else if tewhere=1 and (actcode=50101 or actcode=50199 or actcode=50299 or actcode=59999). Compute main=8. Else if actcode=50102 or actcode=50302 or actcode=50303 or actcode=50305 or actcode=50399. Compute main=9. Else if actcode=50301 or actcode=50304. Compute main=10. Else if actcode=50201 or actcode=50203 or actcode=50305. Compute main=12. Else if actcode=180502. Compute main=11. Else if actcode=50103 or actcode=50104 or actcode=50204. Compute main=13. Else if (actcode>50400 and actcode<50406) or actcode=50499 or actcode=180504. Compute main=14. Else if actcode=60101 or actcode=60103 or actcode=60104 or actcode=60199. Compute main=15. Else if actcode=60301 or actcode=60302 or actcode=60303 or actcode=60399. Compute main=16. Else if actcode=60102 or actcode=60299 or actcode=60201 or actcode=60202 or actcode=60203 or actcode=60204 or actcode=60401 or actcode=60402 or actcode=60403 or actcode=60499 or actcode=69999 or actcode=160103. Compute main=17. Else if actcode=20201 or actcode=20202. Compute main=18. Else if actcode=20203 or actcode=20299. Compute main=19. Else if actcode=20101 or actcode=20301 or actcode=20399 or actcode=20401. Compute main=20. Else if actcode=20102 or actcode=20103. Compute main=21. Else if actcode=20302 or actcode=20303 or actcode=20402 or actcode=20499 or actcode=20502 or actcode=20701 or actcode=20799 or actcode=20801 or actcode=20899. Compute main=22. Else if actcode=20104 or actcode=20199 or actcode=20901 or actcode=20902 or actcode=20905 or actcode=20999 or actcode=29999. Compute main=23. Else if actcode=70101 or actcode=70102 or actcode=70103 or actcode=70104 or actcode=70105 or actcode=70199 or actcode=90102 or actcode=70201 or actcode=70299 or actcode=70301 or actcode=70399 or actcode=79999. Compute main=24. Else if actcode=80501 or actcode=80502 or actcode=80599 or actcode=160105 or actcode=80401 or actcode=80402 or actcode=80403 or actcode=80499 or actcode=80701 or actcode=80702 or actcode=80799. Compute main=25. Else if actcode=90101 or actcode=90103 or actcode=90104 or actcode=90199 or actcode=90201 or actcode=90202 or actcode=90299 or actcode=90301 or actcode=90302 or actcode=90399 or actcode=90401 or actcode=90402 or actcode=90499 or actcode=90501 or actcode=90502 or actcode=90599 or actcode=99999 or actcode=160106 or actcode=80201 or actcode=80202 or actcode=80203 or actcode=80299 or actcode=100101 or actcode=100102 or actcode=100103 or actcode=100304 or actcode=100199 or actcode=100301 or actcode=100302 or actcode=100399 or actcode=100401 or actcode=100499 or actcode=109999 or actcode=160108 or actcode=80301 or actcode=80302 or actcode=80399 or actcode=80601 or actcode=80602 or actcode=80699 or actcode=80801 or actcode=80899 or actcode=89999 or actcode=160104. Compute main=26. Else if (infant=1) and (actcode=30101 or actcode=30108 or actcode=30109 or actcode=30199 or actcode=80101 or actcode=80102 or actcode=80199 or actcode=160107). Compute main=28. Else if (child=1 and (actcode=30101 or actcode=30108 or actcode=30109 or actcode=30199 or actcode=80199)) or actcode=80101 or actcode=80102 or actcode=80199 or actcode=160107. Compute main=31. Else if actcode=30108. compute main=31. Else if actcode=30101 or actcode=30301 or actcode=30302 or actcode=30303 or actcode=30399. Compute main=28. Else if actcode=30102 or actcode=30103 or actcode=30105 or actcode=30106 or actcode=40105. Compute main=30. Else if actcode=30104 or actcode=30107 or actcode=30201 or actcode=30202 or actcode=30203 or actcode=30204 or actcode=30299. Compute main=29. Else if actcode=30110 or actcode=30111 or actcode=30112 or actcode=39999. Compute main=31. Else if (actcode>30400 and actcode<30406) or actcode=30499 or (actcode>30500 and actcode<30505) or actcode=30599 or actcode=39999 or (actcode>40100 and actcode<40105) or (actcode>40105 and actcode<40113) or actcode=40199 or (actcode>40200 and actcode<40205) or actcode=40299 or (actcode>40300 and actcode<40304) or actcode=40399 or (actcode>40400 and actcode<40406) or actcode=40499 or (actcode>40500 and actcode<40509) or actcode=40599 or actcode=49999. Compute main=32. Else if (actcode>150100 and actcode<150107) or actcode=150199 or (actcode>150200 and actcode<150205) or actcode=150299 or actcode=150301 or actcode=150302 or actcode=150399 or actcode=150401 or actcode=150402 or actcode=150499 or actcode=150501 or actcode=150599 or actcode=150601 or actcode=150602 or actcode=150699 or actcode=159999 or actcode=150701 or actcode=150799 or actcode=150801 or actcode=150899 or actcode=100201 or actcode=100299 or actcode=100303 or actcode=100305. Compute main=33. Else if (actcode>140100 and actcode<140106) or actcode=149999. Compute main=34. Else if actcode=120405 or actcode=120499 or actcode=120504. Compute main=35. Else if (actcode>130200 and actcode<130300) or actcode=130302 or actcode=130399 or actcode=130402 or actcode=130499. Compute main=36. Else if actcode=120401 or actcode=120403. Compute main=37. Else if actcode=120402. Compute main=38. Else if actcode=110202 or actcode=110101 or actcode=110199 or actcode=120404 or actcode=110299. Compute main=39. Else if actcode=120201 or actcode=120202 or actcode=120299. Compute main=40. Else if (actcode>130100 and actcode<130104) or actcode=130105 or actcode=130107 or (actcode>130108 and actcode<130112) or (actcode>130112 and actcode<130116) or actcode=130117 or (actcode>130118 and actcode<130131) or (actcode>130131 and actcode<130200) or actcode=130301 or actcode=130401 or actcode=139999. Compute main=42. Else if actcode=130131 or (actcode>500000 and tewhere=14). Compute main=43. Else if actcode=130104. Compute main=44. Else if actcode=130108. Compute main=45. Else if actcode=130106 or actcode=130112 or actcode=130116 or actcode=130118 or actcode=20501 or actcode=20599. Compute main=46. *if main act dog/pet care sec act walk or mode of transport walk then walk dog *else if actcode=20601 or actcode=20699 and (sec=13131 or sec=42main or mtrav=3) *there is no sec act yet. else if actcode=20601 or actcode=20602 or actcode=20699 and mtrav=3. compute main=47. else if actcode=20601 or actcode=20699. compute main=27. Else if actcode=120101 or actcode=120199. Compute main=48. Else if actcode=160101 or actcode=160102 or actcode=169999 or actcode=160199 or actcode=160201 or actcode=160299. Compute main=49. Else if actcode=120307 or actcode=129999. Compute main=50. Else if actcode=120313. Compute main=52. Else if actcode=20903. Compute main=53. Else if actcode=120309 or actcode=120310 or actcode=120311. Compute main=54. Else if actcode=120301 or actcode=120302 or actcode=120399 or actcode=120501 or actcode=120502 or actcode=120503 or actcode=120599. Compute main=55. Else if actcode=120312. Compute main=56. Else if actcode=120306. Compute main=57. Else if actcode=120305. Compute main=58. Else if actcode=120303 or actcode=120304. Compute main=59. Else if actcode=20904 or actcode=120308. Compute main=61. Else if actcode=500103. Compute main=62. Else if actcode=180501 or actcode=180503 or actcode=180504 or actcode=180599. Compute main=63. Else if (actcode>180600 and actcode<180605) or actcode=180699. Compute main=64. Else if (actcode>181400 and actcode<181500) or (actcode>181500 and actcode<181600). Compute main=65. Else if actcode=180301 or actcode=180399 or actcode=180302 or actcode=180303 or actcode=180304 or actcode=180305 or actcode=180401 or actcode=180402 or actcode=180403 or actcode=180404 or actcode=180405 or actcode=180499. Compute main=66. Else if actcode=180101 or actcode=180199 or (actcode>181100 and actcode<181200)or (actcode>180200 and actcode<180300)or (actcode>180700 and actcode<180800) or (actcode>180800 and actcode<180900) or (actcode>180900 and actcode<181000) or (actcode>181000 and actcode<181100). Compute main=67. Else if actcode=189999 or (actcode>181200 and actcode<181400) or (actcode>181600 and actcode<181800) or actcode=181801 or actcode=181899. Compute main=68. Else if actcode=500101 or actcode=500102 or actcode=500104 or actcode=500105 or actcode=500106 or actcode=500107 or actcode=509999. Compute main=69. end if. freq main. temp. select if main=-5. freq actcode. *if all ok, this will produce a warning that there are no such cases. temp. select if main<15. cro actcode by main. temp. select if main>14 and main<20. cro actcode by main. temp. select if main>19 and main<28. cro actcode by main. temp. select if main>27 and main<35. cro actcode by main. temp. select if main>34 and main<42. cro actcode by main. temp. select if main>41 and main<56. cro actcode by main. temp. select if main>55 and main<62. cro actcode by main. temp. select if main>61 and main<70. cro actcode by main. *set up variable for quality checks. vector dqcheck(3). Loop i=1 to 3. compute dqcheck(i)=0. end loop. var lab dqcheck1 "miss main, mode of transport or in restaurant". var lab dqcheck2 "miss main, 2nd act reported". var lab dqcheck3 "miss 20 min before/after travel". val lab dqcheck1 to dqcheck3 0 ordinary diary 1 includes pattern. freq dqcheck1 to dqcheck3. temp. select if main=69. freq eloc. Do If main=69 and eloc=8. compute main=62. compute dqcheck1=1. End if. *secondary childcare. freq trtcc_ln trtcocln. *data file examined visually. These variables mirror *the duration of the activity when the activity entailed *secondary child care, and otherwise are coded as -1. If trtcc_ln>0 or trtcocln>0 sec=31. If (main<62 and eloc=8) sec=62. freq sec. *if the main activity is missing and the location is *at home or another home and the previous location is *travel, main activity is coded as unknown personal *or household care. * *if the main activity is missing and the previous location *is travel and the present location is valid but not at *a home, the main activity is coded as imputed out of *home activity. * *If the main activity is missing and the location is *valid and not at home or another home and the *previous location is valid, not travelling, and *different from the present location, the main *activity is coded to imputed travel * *if the main activity is valid and not travel and *both the current and previous locations are valid *and the previous location is not travelling and the *current and previous location differ, the secondary *activity is coded as imputed travel. Do if pid=lag(pid). Do if main=69 and ((eloc=1 or eloc=2) and lag(eloc)=8). compute main=1. compute dqcheck3=1. Else if main=69 and ((eloc>2 and eloc<8) or eloc=9) and lag(eloc)=8. compute main=41. Else if main=69 and ((eloc>0 and eloc~=8 and lag(eloc)>0 and lag(eloc)~=8) and eloc~=lag(eloc)). compute main=62. compute dqcheck1=1. Else if (main=69 and main<62) and sec=0 and ( ((eloc>1 and eloc<6) or eloc=7) and ((lag(eloc)>1 and lag(eloc)<6) or lag(eloc)=7)) and eloc~=lag(eloc). compute sec=62. End if. End if. freq sec. temp. select if main=69 or main=1 or main=41 or main=62. freq main. *if main activity still missing and the location is *valid and not at home, code the main activity as *imputed activity away from home. If main=69 and eloc>2 main=41. temp. select if main=69 or main=41. freq main. temp. select if main=69. freq actcode. *214 of the missing activities are coded as unrecorded as *simultaneous activities recorded. investigate where these. temp. select if main=69 and actcode=500104. freq eloc sec clockst alone child sppart hhadult. *most such cases take place at home or another person's home; *~1/4 of cases overlap a child being in the person's care; *cases spread throughout the day. *check two of the three bad diary tests for these cases, *calculating missing time as not including this simultaneous *activity code. compute misstest=0. if main=69 and actcode~=500104 misstest=time. AGGREGATE /OUTFILE* mode=addvariables /BREAK=pid /summiss=sum(misstest) /totep=NU(epnum). temp. select if main=69 and actcode=500104. freq totep summiss. *these diaries have 6 or more activities, and 86 of them *have no or an acceptable amount of missing time (<=90). Recode this *activity as imputed personal or household care. if main=69 and actcode=500104 and summiss<90 main=1. *now see if any of the remaining missing cases happen at the end of the diary day. compute test=0. if lastep=1 and main=69 and lag(main)~=69 test=1. temp. select if test=1. freq time eloc actcode. *there are 20 such cases, all but one at home. compute test2=0. if test=1 test2=lag(main). freq test2. *7 wash dress, 7 sleep, 1 other meals/snacks, 1 receive or visit *friends and one watch TV, DVD. *now look at cases where the first activity is missing. compute test=0. If epnum=1 and main=69 test=1. freq test. temp. select if test=1. freq time eloc. *22 such cases, all but one at own home. compute test2=0. if lag(test)=1 test2=main. freq test2. cro test2 by eloc. *8 asleep, 3 personal care, 2 other meals, 1 food prep, 1 set table. *1 walking, 1 walk dogs, 2 travel for shpooing, 2 travel for other purposes *and one no recorded act. if test=1 and test2<62 main=3. if time<91 and (test=1 and test2>61) main=1. *look at cases that remain missing that happen after sleep. compute test=0. if pid=lag(pid) and main=69 and (lag(main)=2 or lag(main)=3) test=1. temp. select if test=1. freq eloc time. *163 such cases (161 at home, 1 other home); *those less than an hour at home coded as imputed personal or household care. If time<61 and test=1 and eloc~=-8 main=1. temp. select if main=69 or main=3. freq main. compute test=0. if main=69 and (lag(main)=6 or lag(main)=18 or lag(main)=19) test=1. temp. select if test=1. freq time eloc. *426 cases where the time gap in a diary follows eating *or food preparation of setting table/putting away *dishes; all at home or another's home. 62% an hour or less, *some gaps very long. Set gaps of an hour or less to *imputed personal or household care. If test=1 and (eloc=1 or eloc=2) and time<61 main=1. temp. select if main=69 or main=1. freq main. temp. select if actcode>500000. freq main. *at this point, 1533 of the 3707 cases coded with missing codes *in the original data are still coded as missing - 847 now imputed personal *or household care, 22 imputed sleep; 665 imputed time away from home; *47 walking; 593 imputed travel. temp. select if main=69. freq time eloc. *remaining gaps range from 1 minute to 905 min. 54.9% *are an hour or less. No further effort made to fill in gaps using *other diary information. If ((main>61 or sec>69)or(sec>61 and sec<69)) and mtrav=-7 mtrav=5. freq mtrav. *impute eating where no main activity eating but *main activity food preparation or setting table reported. compute eatdr=0. If main=5 or main=6 or main=39 eatdr=time. *check for missing eating time but recorded set table or food prep. AGGREGATE /OUTFILE=* mode=addvariables /BREAK=pid /anyeat = SUM(eatdr). freq anyeat. *at the moment, 3.2% no eating. temp. select if anyeat=0. freq maxep main. *some really low episode diaries with missing eating. *are some diaries with food preparation activities *but no eating. Do if anyeat=0 and (main=18 or main=19) and sec=0 and maxep>9. compute sec=1. End if. freq sec. freq main. *0.6% of main activity time missing in this file. rename variables (pid diaryday wave = persid day diary). sort cases by survey persid. compute diary=1. vector main(69) sec(69). execute. Do repeat a=main1 to main69 /b=sec1 to sec69 /i=1 to 69. compute a=0. compute b=0. If main=i a=time. If main=i and (sec>27 and sec<32) b=time. End repeat. *compute a test variable to ensure time use codes add up to 1440. *need to include missing time in the sum. compute total = SUM(main1 to main69). execute. freq main. *set all variable codes which could not be constructed *to -9 for missing. *main45 (other out-of-doors recreation), main60(play computer games) *and main51 (general indoor leisure) could not be created for this survey. *change and change max/sum accordingly. recode main45 sec45 main51 sec51 main60 sec60 (0=-9). execute. freq sec. *all the zero's are indeed "no recorded activity". *so we code them as 69. recode sec (0=69). freq sec. ***************** *sppart for W558* *****************. *While in W6 SPPART is a 0-1 marker for whether or not *the spouse is present during the episode, in the W5.8 files it *is the total time with the spouse/partner. Therefore we create a different *sppart for W58. freq sppart. compute sppart58=0. If sppart=1 sppart58=time. desc sppart sppart58. sort cases by persid epnum. save outfile ='F:\evrim\AHTUS\2010\tempb\mid5.sav'. get file 'F:\evrim\AHTUS\2010\tempb\mid5.sav'. AGGREGATE /OUTFILE='F:\evrim\AHTUS\2010\USA2010W58main.sav' /break=persid /day = MAX(day) /cday = MAX(cday) /month = MAX(month) /year = MAX(year) /tottime "total minutes recorded in diary" = SUM(time) /sppart = SUM(sppart58) /main1 = SUM(main1) /main2 = SUM(main2) /main3 = SUM(main3) /main4 = SUM(main4) /main5 = SUM(main5) /main6 = SUM(main6) /main7 = SUM(main7) /main8 = SUM(main8) /main9 = SUM(main9) /main10 = SUM(main10) /main11 = SUM(main11) /main12 = SUM(main12) /main13 = SUM(main13) /main14 = SUM(main14) /main15 = SUM(main15) /main16 = SUM(main16) /main17 = SUM(main17) /main18 = SUM(main18) /main19 = SUM(main19) /main20 = SUM(main20) /main21 = SUM(main21) /main22 = SUM(main22) /main23 = SUM(main23) /main24 = SUM(main24) /main25 = SUM(main25) /main26 = SUM(main26) /main27 = SUM(main27) /main28 = SUM(main28) /main29 = SUM(main29) /main30 = SUM(main30) /main31 = SUM(main31) /main32 = SUM(main32) /main33 = SUM(main33) /main34 = SUM(main34) /main35 = SUM(main35) /main36 = SUM(main36) /main37 = SUM(main37) /main38 = SUM(main38) /main39 = SUM(main39) /main40 = SUM(main40) /main41 = SUM(main41) /main42 = SUM(main42) /main43 = SUM(main43) /main44 = SUM(main44) /main45 = MAX(main45) /main46 = SUM(main46) /main47 = SUM(main47) /main48 = SUM(main48) /main49 = SUM(main49) /main50 = SUM(main50) /main51 = MAX(main51) /main52 = SUM(main52) /main53 = SUM(main53) /main54 = SUM(main54) /main55 = SUM(main55) /main56 = SUM(main56) /main57 = SUM(main57) /main58 = SUM(main58) /main59 = SUM(main59) /main60 = MAX(main60) /main61 = SUM(main61) /main62 = SUM(main62) /main63 = SUM(main63) /main64 = SUM(main64) /main65 = SUM(main65) /main66 = SUM(main66) /main67 = SUM(main67) /main68 = SUM(main68) /main69 = SUM(main69) /total = SUM(total). ************ *create ict* ************. compute ict=0. execute. If actcode=20904 or actcode=120308 ict=1. freq ict. cro main61 by ict. sort cases by persid epnum. Save outfile='F:\evrim\AHTUS\2010\USA2010W60main.sav' /keep persid day cday month year diary time clockst start end epnum main sec inout eloc ict mtrav alone child sppart oad. *check whether the sums adds up to 1440. get file='F:\evrim\AHTUS\2010\USA2010W58main.sav'. freq total. *all diaries add up to the correct 1440 minutes . *Remember to update the right hand side of the equation *with respect to the activity categories that could not be created. compute t=sum(main1 to main44) + sum(main46 to main50)+sum(main52 to main59) + sum(main61 to main69). freq t. desc sppart. save outfile='F:\evrim\AHTUS\2010\USA2010W58main.sav' /drop total t. ***************************************** *create badcase variable for ADULTS only* *****************************************. GET FILE='F:\evrim\AHTUS\2010\Harmonised Files\USA2010hfep.sav'. *compute misbasic variable*. compute tmiss=0. compute aeatdr=0. compute asleep=0. compute apcare=0. compute atrav=0. compute anycare=0. execute. If main=-8 tmiss=time. desc tmiss. *include the diaries with food preparation activities *but no eating. If main=8 or main=9 or main=20 or main=21 or main=56 or sec=2 or sec=8 or sec=9 or sec=20 or sec=21 or sec=56 or eloc=6 aeatdr=1. *includes do nothing, think, time out or work break. If main=3 or main=4 or main=5 or main=13 or main=78 or sec=3 or sec=4 or sec=5 or sec=13 or sec=78 asleep=1. *includes purchase of per'l care and imputed p'l or hhold care. If main=1 or main=2 or main=6 or main=7 or main=28 or sec=1 or sec=6 or sec=7 or sec=28 apcare=1. *includes sports/exercise, walking, cycling, outdoor recreation, *gardening, petcare, hunting. If (main>89 and main<99) or main=60 or main=62 or main=63 or main=64 or main=65 or main=66 or main=67 or main=68 or (sec>89 and sec<99) or sec=60 or sec=62 or sec=63 or sec=64 or sec=65 or sec=66 or sec=67 or sec=68 atrav=1. *to create carer flag. If (main>32 and main<41) or (sec>32 and sec<41) anycare=1. execute. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=survey wave hhid pid /eatdr=MAX(aeatdr) /sleep=MAX(asleep) /pcare=MAX(apcare) /trav=MAX(atrav). freq eatdr sleep pcare trav. *compute test variable to figure the diarists who stayed at home all day. compute test=0. if eloc~=lag(eloc) and (hhid=lag(hhid) and pid=lag(pid)) and trav=0 test=1. freq test. compute test2=0. if (hhid=lag(hhid) and pid=lag(pid)) and lag(asleep)=1 and (atrav=1 or (main>9 and main<70) or main>89) and pcare=0 test2=1. freq test2. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=survey wave hhid pid /pcarex=MAX(test2) /travx=MAX(test). if pcare=0 and pcarex=1 pcare=1. if trav=0 and travx=1 trav=1. freq eatdr sleep pcare trav. compute test=0. if eloc=1 or eloc=2 test=time. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=survey wave hhid pid /athome=SUM(test) /maxep=MAX(epnum). desc athome maxep. *Diaries including only 2 of the basic act but have at least *12 episodes where the diarist reports being at home all day *but otherwise meet the other 4 good diary criteria count as *good diaries. if trav=0 and maxep>11 and athome>1000 trav=1. freq trav. AGGREGATE /OUTFILE=* /BREAK=survey wave hhid pid /eatdr=SUM(eatdr) /sleep=SUM(sleep) /pcare=SUM(pcare) /tmiss=SUM(tmiss) /trav=SUM(trav) /anycare=MAX(anycare) /epnum=MAX(epnum) /day=MAX(diaryday). compute misbasic=0. execute. If trav=0 misbasic=misbasic+1. If sleep=0 misbasic=misbasic+1. If pcare=0 misbasic=misbasic+1. If eatdr=0 misbasic=misbasic+1. execute. var lab misbasic number basic activites not recorded. freq misbasic. cro anycare by misbasic. *diaries of carers who otherwise meet the 4 good diary criteria count as good diaries. if (epnum>7 or anycare=1) and misbasic=2 misbasic=1. freq misbasic. temp. select if misbasic>1. freq epnum tmiss. sort cases by hhid pid. match files file=* file="F:\evrim\AHTUS\2010\Harmonised Files\usa10quest.sav" /by hhid pid. execute. compute baddiary=0. execute. if tmiss>90 or epnum<7 or misbasic>1 baddiary=1. freq baddiary. *666 - 5.3% bad diaries.-12013 good ones. recode tmiss (0 thru 90=0) (91 thru hi=1). recode epnum (0 thru 6=1) (7 thru hi=0) into nep. recode misbasic (0,1=0) (2,3,4=1). execute. freq tmiss nep misbasic age sex. *As no sex or age missing, only the diary quality variables *determine bad case in this case. cro tmiss by nep by misbasic. *12013 (94.7%) of diaries of quality; * 2 diary bad on all three criteria * 59 diaries bad on 2 criteria *56 6 or fewer episodes and missing 2+ basic acts *3 6 or fewer episodes and missing 91+ minutes *0 missing 2+ basic acts and missing 91+ minutes * 605 bad on 1 criteria * 430 missing 91+ minutes, * 134 have 6 or fewer episodes, * 41 missing 2+ basic acts. *compute badcase*. Do If baddiary=0 and sex>-8 and age>-8 and day>-8. compute badcase=0. Else if baddiary=0 and (sex=-8 or age=-8) and day>-8. compute badcase=1. Else if baddiary=0 and sex>-8 and age>-8 and day=-8. compute badcase=2. Else if sex>-8 and age>-8 and day>-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=3. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=4. Else if sex>-8 and age>-8 and day>-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=5. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=0 and misbasic=0. compute badcase=6. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=7. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=8. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=9. Else if sex>-8 and age>-8 and day=-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=10. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=11. Else if sex>-8 and age>-8 and day=-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=12. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=13. Else if sex>-8 and age>-8 and day>-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=14. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=15. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=16. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=17. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=18. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=19. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=20. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=21. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=22. Else if sex>-8 and age>-8 and day=-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=23. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=24. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=1 and misbasic=1. compute badcase=25. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=26. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=27. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=28. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=1 and misbasic=1. compute badcase=29. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=1 and misbasic=1. compute badcase=30. Else. compute badcase=31. End if. val lab badcase 0 good case 1 miss age or sex only 2 miss day of week only 3 "miss 91+ minutes only" 4 "<7 episodes only" 5 "miss 2+ basic acts only" 6 "miss age/sex + day of week" 7 "miss age/sex + 91+ min" 8 "miss age/sex + <7 episodes" 9 "miss age/sex + 2+ basic acts" 10 "miss day of week + 91+ min" 11 "miss day of week + <7 episodes" 12 "miss day of week + 2+ basic acts" 13 "miss 91+ min + <7 episodes" 14 "miss 91+ min + 2+ basic acts" 15 "<7 ep & miss 2+ basic acts" 16 "miss age/sex + day or week + 91+ min" 17 "miss age/sex + day or week + <7 episodes" 18 "miss age/sex + day or week + 2+ basic acts" 19 "miss age/sex + 91+ min + <7 eps" 20 "miss age/sex + 91+ min + 2+ basic acts" 21 "miss age/sex + 2+ basic acts + <7 eps" 22 "miss day or week + 91+ min + <7 eps" 23 "miss day or week + 91+ min + 2+ basic acts" 24 "miss day or week + 2+ basic acts + <7 eps" 25 "miss 91+ min + 2+ basic acts + <7 eps" 26 "miss age/sex + day or week + 91+ min + <7 episodes" 27 "miss age/sex + day or week + 91+ min + 2+ basic acts" 28 "miss age/sex + day or week + <7 episodes + 2+ basic acts" 29 "miss age/sex + 91+ min + <7 episodes + 2+ basic acts" 30 "day or week + 91+ min + <7 episodes + 2+ basic acts" 31 bad on all five points. *check that all cases have a code. freq badcase. *double check that all correctly coded. cro badcase by sex day nep tmiss misbasic. rename variables (pid hhid =persid hlid ). sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\badcase.sav' /keep hlid persid epnum badcase. ***************************************************** ***************************************************** **create background variables for the 18+ diarists ** *****************************************************. ******* *occup* *******. *We have occupation variable in both respondent and CPS files. *But respondent files provides more recent info. GET FILE='F:\evrim\AHTUS\2010\atusresp_2010.sav' /keep tucaseid tulineno telfs trernwa trdtocc1 trmjocc1 teio1cow trmjocgr. rename variables (tucaseid=persid). Freq trdtocc1 trdtocc1 teio1cow. cro trdtocc1 by telfs teio1cow. means tables= trernwa by trdtocc1 /cells mean count. Recode trdtocc1 (1=1) (2=2) (3=3) (4=3) (5=5) (6=4) (7=2) (8=8) (9=7) (10=6) (11=8) (12=10) (13=11) (15=11) (16=11) (17=9) (18=12) (else=13) into occup. If telfs>2 occup=-7. var lab occup occupation. val lab occup -9 not asked in study -8 item missing -7 not working 1 management 2 finance & legal professions 3 science & engineering professionals 4 civil and social service professionals 5 education and social science professionals 6 medical professionals 7 other professionals 8 health, education and social care support 9 clerical and office support 10 security and armed forces 11 sales, services, creative support, and cleaning 12 farming, forestry, and fishing 13 construction, assembly & repair, moving goods, transport, extraction 14 Self-employed non-professionals. freq occup. cro occup by telfs trmjocgr. cro trdtocc1 by occup. *trdtocc1 gives the occupation of diarist but does not have *self-employed non professional category. We will use teio1cow to create this. temp. select if (teio1cow=6 or teio1cow=7) and occup>7. cro occup by teio1cow. *If occup is construction/transportation or sales and self-employed *code as self-employed non professionals. If (occup=11 and (teio1cow=6 or teio1cow=7)) or (occup=13 and (teio1cow=6 or teio1cow=7)) occup=14. freq occup. sort cases by persid (A) tulineno (A). save outfile='F:\evrim\AHTUS\2010\tempb\occup.sav' /keep persid occup. ********* *agekid2* *********. GET FILE='F:\evrim\AHTUS\2010\atusrost_2010.sav'. rename variables tucaseid=persid. compute young1=999. compute young2=999. compute young3=999. compute parpres=0. compute youngd=0. compute age=0. execute. *note on youngF: If the diarist is under 18 and taken care of by an other relative *we consider this case as child present and take it into account while coding age *of youngest child at the household. *However if the youngest person at the household is an adult and she has *an other relative older than herself we do not code this as child at home. compute youngd=0. If (terrp=18 or terrp=19) and teage<18 youngd=1. freq youngd. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=persid /yngd=MAX(youngd). If terrp=18 or terrp=19 age=teage. If (terrp=24) or (terrp=26 and yngd=1) parpres=1. execute. Do if terrp=22 or terrp=23 or terrp=27. compute young1=teage. Else if terrp<40. compute young2=teage. End if. if terrp=18 or terrp=19 or terrp=25 young3=teage. freq young1 young2 young3. AGGREGATE /OUTFILE='F:\evrim\AHTUS\2010\tempb\tempage.sav' /BREAK=persid /age = max(age) /agekida "age youngest child of diarist" = min(young1) /agekidb "age youngest person who is not child of diarist"= min (young2) /agekidc "youngest of diarist and her/his siblings" = min (young3) /parpres "lives with parent" = max(parpres). Get File='F:\evrim\AHTUS\2010\tempb\tempage.sav'. freq age agekida agekidb agekidc parpres. compute agekid2=-7. execute. Do if agekidb ge agekida. compute agekid2=agekida. Else if agekidb<18. compute agekid2=agekidb. Else if agekida<999 and agekida>agekidb. compute agekid2=agekida. Else if parpres=1. compute agekid2=agekidc. End if. * top code age at 80 to protect the anonymity of diarists. recode agekid2 (80 thru Highest=80). execute. VARIABLE LABELS agekid2 "age of youngest child". VALUE LABELS agekid2 -9 "QUESTION NOT ASKED" -8 "MISSING OR DIRTY ON THE CASE RECORD" -7 "NOT APPLICABLE" 0 "less THAN 1". fre agekid2. *There is no missing. *If so check those cases visually in roster and cps files to see whether they *report any child at home. *check that child diarist's ages are >= age youngest. temp. select if age<18. cro agekid2 by age. *check that no household where a parent of the diarist is *present is missing age youngest child. cro agekid2 by parpres. ********* *agekidx* *********. recode agekid2 (-8=-8) (-7=-7) (0 thru 4=1) (5 thru 12=2) (13 thru 17=3) (17 thru hi=4) into agekidx. execute. cro agekid2 by agekidx. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\nu5e.sav' /keep persid parpres agekid2 agekidx. freq age. *********** *own child* ***********. *own chi variable will be used to create single parent variable. get file='F:\evrim\AHTUS\2010\atuscps_2010.sav' /keep tucaseid tulineno prnmchld pemaritl prtage prcitshp prcowpg. SORT CASES BY tucaseid (A) tulineno (A). *note that the fromresp.sav file is created in the syntax *that generates the background variable file for the ATUS. MATCH FILES /FILE=* /FILE='F:\evrim\AHTUS\2010\tempa\fromresp.sav'/in=inresp /BY tucaseid tulineno. freq inresp. *this leaves just the respondents who completed diaries. The CPS *file includes information on all persons interviewed in the *households and other cases need to be eliminated. sel if inresp=1. execute. rename variables (tucaseid = pid). sort cases by pid. *we will use the age variable from roster file. *this is to be consistent with the rest of the files and to *use the most recent file. MATCH FILES /FILE=* /FILE='F:\evrim\AHTUS\2010\tempb\dem.sav' /BY pid. cro prnmchld by TRHHCHLD TRCHLDNM TRYHHCHD TROHHCH. cro trhhchld by trohhch. *there are some inconsistencies between prnmchld and trohhch. *prnmchld is number of own children<18,trohhch presence of own hhold children<18. compute test=0. If trohhch=1 and prnmchld=0 test=1. freq test. temp. select if test=1. freq trhhchld TRCHLDNM TRYHHCHD. *In 111 cases there is no own children<18 according to prnmchild but there is *own hhold children according to trohhch. *These cases might be the children who *came back home/started to leave with the respondent during *the time between CPS and respondent surveys were administered. *Or they could be own non hhold children. *Because TROHHCH is more recent we will use that one *to identify own kids and therefore single parents. Recode trohhch (1=1) (2=0) into own18. variable label own18 "presence of own hhold children". cro own18 by trohhch. rename variables (pid =persid ). cro prtage by own18. *the age distribution of parents is as expected. double check teenage parents. temp. select if prtage<18 and own18=1. freq prnmchld persid. *checked those 8 cases from roster and CPS file: *20100201100034,20100403100656,20100605102086 and 20100706100056 are 17 year olds who report to have a child *at the age of 2 or 3. *20100807101577 is a 17 year old who reports to have two children, one at the age of 1 and *the other at the age of 4. This information is consistent in CPS and roster. *20100605101966 is a 17 year old who reports own child at the age of 2 and a grand children at the age of 0. There is no mentioning of any of these childs is CPS. 0-year old could be her child or sibling? *20100606100006 is a 17 year old who reported two people aged 16 and 14 as own hhold child. *I checked these cases in CPS. The reference person in CPS reported these three people *as her grandchildren. We will refer to the infromation in CPS as the one in the roster file *is unreliable. If persid=20100606100006 own18=0. *20100605101326 is an 18 year old in roster which includes more recent information. *We extract age information from roster file so this respondent will not be in adult file. *This file will also be used to create citizen and sector variables. sort cases by persid. save outfile ='F:\evrim\AHTUS\2010\tempb\own18.sav' /keep persid own18 age prcitshp prcowpg. *adult file. get file ='F:\evrim\AHTUS\2010\tempb\own18.sav'. select if age>17. execute. freq age. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\own18ad.sav' /keep persid own18 prcitshp prcowpg. **************************** *other background variables* ****************************. Get File='F:\evrim\AHTUS\2010\Harmonised Files\usa10quest.sav' /keep hhid pid hhtype under18 under5 incomeqt ownhome urban sex age famstat civstat cohab fulltime parttime noemploy unemp student retired nadult income03 wkhrs wagelm educ disab empsp. rename variables (hhid pid hhtype urban wagelm income03= hldid persid hhtypeo urbano empinclm incorig). sort cases by persid. MATCH FILES /FILE=* /FILE='F:\evrim\AHTUS\2010\tempb\own18ad.sav' /by persid. ***** *age* *****. * top code age at 80 to protect the anonymity of diarists. recode age (80 thru Highest=80). execute. ******** *hhtype* ********. do if hhtypeo=2. compute hhtype = 2. else if hhtypeo=1. compute hhtype = 3. else if under18<1 and (hhtypeo=6 or hhtypeo=7). compute hhtype = 1. else if hhtypeo>0. compute hhtype = 4. else. compute hhtype = -8. end if. execute. cro hhtypeo by hhtype. cro civstat by hhtype. ********** *hhldsize* **********. compute hhldsize = nadult + under18. execute. cro hhldsize by hhtypeo. ******** *nchild* ********. compute nchild = under18. execute. ******** *income* ********. Recode incomeqt (-8=-8) (1=1) (2,3=2) (4=3) into income. execute. cro incomeqt by income. temp. select if incomeqt>0. freq incomeqt. ******* *urban* *******. recode urbano (1=1) (0=2) (else=-8) into urban. execute. cro urbano by urban. ********* *singpar* *********. cro own18 by under18. *as seen not all the household children under 18 are *own child of diarist. freq hhtypeo. do if hhtypeo=3 or (hhtypeo=5 & own18>0). compute singpar = 1. else if hhtypeo>0. compute singpar = 0. else. compute singpar=-8. end if. execute. cro hhldsize by singpar. cro under18 by singpar. cro own18 by singpar. ********* *civstat* *********. recode civstat (1=1) (2 thru high=2) (else=-8). execute. freq civstat. ********* *empstat* *********. means wkhrs by fulltime parttime /cells=min max. do if fulltime=1. compute empstat3=1. else if parttime=1. compute empstat3=2. else if wkhrs>34. compute empstat3=1. else if (wkhrs>0 and wkhrs<35). compute empstat3=2. else if noemploy=1 or wkhrs=0. compute empstat3=4. else. compute empstat3=-8. end if. execute. cro empstat3 by fulltime parttime noemploy. recode empstat3 (1 thru 3=1) (4=0) (else=-8) into emp. execute. rename variables (empstat3=empstat). execute. freq empstat. temp. select if empstat<0. freq persid. *This case is checked in respondent and CPS files. *In two variables in CPS she is coded as full time employed. *We will use that information. *The case is corrected at the end of the syntax. ********* *workhrs* *********. compute workhrs=wkhrs. freq wkhrs. cro wkhrs by noemploy. ******* *educa* *******. compute educa=educ. if (educa >0 and educa <3) edcat = 1. if educa=3 edcat = 2. if educa>3 edcat = 3. if educa<0 edcat = -8. ******* *cohab* *******. *In AHTUS we code cohab as 0 (for those who are not cohabiting, married or single), *and as 1 for cohabiting couples. In MTUS however married and single couples *are coded separetely. cro civstat by cohab. If civstat=2 and cohab=0 cohab=-7. cro civstat by cohab. apply dictionary from 'F:\evrim\AHTUS\mtusw58schema.sav'. *sex, cohab, unemp, retired, disab & student *already have the values/names for the MTUS. sort cases by persid. match files files=* files='F:\evrim\AHTUS\2010\tempb\extra1.sav' files='F:\evrim\AHTUS\2010\tempb\extra2.sav' files='F:\evrim\AHTUS\2010\tempb\partid.sav' files='F:\evrim\AHTUS\2010\tempb\occup.sav' files='F:\evrim\AHTUS\2010\tempb\badcase.sav' files='F:\evrim\AHTUS\2010\tempb\nu5e.sav' /by persid. execute. select if age>17. execute. *this filters out the young diarists. apply dictionary from 'F:\evrim\AHTUS\mtusw58schema.sav'. ******* *empsp* *******. freq empsp. cro empsp by partid civstat. cro empsp by relrefp. *39 people are coded as spouse in relrefp variable bu not in empsp. *check the inconsistency. compute test=0. if (empsp=-7 and relrefp=2) test=1. freq test. temp. select if test=1. freq persid. temp. select if test=1. freq relrefp civstat empsp. *Those 39 people are coded as spouse in relrefp variable *which is derived from cps file (from the variable "perrp"). *However in the empsp variable they are coded as not applicable because *they are not coded as partner in partid variable through which *empsp variable is created. *partid is derived from roster file (from the variable "terrp"). *We double checked those respondents in roster file and respondent files, *and they were all coded as "no spouse or married partner present" IN BOTH FILES. *Since the roster file provides the most recent information we code them as not married. *and make the necessary changes in empsp and relrefp variable. If (empsp=-7 and relrefp=2) relrefp=10. cro empsp by civstat relrefp. recode empsp (sysmis=-8). freq empsp. cro relrefp by empsp. ******** *cphome* ********. *we identified the children in a parental house but not their marriage status yet. if civstat=1 cphome=0. cro civstat by cphome. ******** *partid* ********. *partid identifies spouse/partner of diarist if the spouse/partner *of the diarist also completed a diary. *In this survey only one person per household completed a diary. *however because it is attached to a longitudunal survey where all *household members participated, we keep the partid variable. freq partid. ********** *computer* **********. *computer, vehicle, and rushed variables could not be created. compute computer=-9. var label computer "whether hhold have a computer". val lab computer -9 question not asked 1 yes 2 no. ********* *vehicle* *********. compute vehicle=-9. var label vehicle "whether hhold have an access to a private vehicle". val label vehicle -9 question not asked 0 no 1 animal only 2 non-motorised vehicle only 3 1 car 4 2+ cars. ******** *rushed* ********. compute rushed= -9. var label rushed "whether diarist usually feels rushed". val label rushed -9 question not asked 0 almost never 1 sometimes 2 often. ******** *health* ********. compute health= -9. val label health -9 question not asked -8 missing 0 poor 1 fair 2 good 3 very good. ******* *carer* *******. compute carer= -9. var label carer "whether diarist looks after disabled person". val laber carer -9 question not asked 1 yes 2 no. freq computer vehicle rushed carer. ********* *citizen* *********. compute citizen=-9. recode prcitshp(1 thru 4 =1) (5=0)(else=-8) into citizen. var lab citizen "citizenship status". val lab citizen 0 no 1 yes. cro prcitshp by citizen. ******** *sector* ********. cro prcowpg by empstat. compute sector=99. Do if prcowpg=1. compute sector=2. else if prcowpg=2. compute sector=1. else if empstat=4 and prcowpg=-1. compute sector=-7. else. compute sector=-8. End if. var lab sector "sector of employment". val lab sector -8 missing -7 not applicable 1 public sector 2 private sector. cro sector by empstat. cro sector by prcowpg. ******************* *incorig and educa* *******************. *income and education variables as originally recorded *in the surveys. val lab incorig 1 "Less than $5,000" 2 "5,000 to 7,499" 3 "7,500 to 9,999" 4 "10,000 to 12,499" 5 "12,500 to 14,999" 6 "15,000 to 19,999" 7 "20,000 to 24,999" 8 "25,000 to 29,999" 9 "30,000 to 34,999" 10 "35,000 to 39,999" 11 "40,000 to 49,999" 12 "50,000 to 59,999" 13 "60,000 to 74,999" 14 "75,000 to 99,999" 15 "100,000 to 149,999" 16 "150,000 and over" -7 "not applicable/not asked" -8 "missing" -9 "could not be created" /educa 1 "grades 0-8 only" 2 "grades 9-11 - not hs graduate" 3 "high school graduate" 4 "some college" 5 "college graduate" 6 "postgraduate" -7 "not applicable/not asked" -8 "missing" -9 "could not be created". save outfile='F:\evrim\AHTUS\2010\tempb\backtemp.sav'. ******************************************************** *quality checks of background variables and corrections* ********************************************************. *********************** *1* hhtype and famstat* ***********************. cro hhtype by famstat. *There are no cases of (famstat=0 or famstat=3) and hhtype=3. *However in some cases diarist can be living in both parents. *find out diarist who live both of their parents. compute test=0. If parntid1>0 and parntid2>parntid1 test=1. freq test. cro hhtype by test. temp. select if test=1 and hhtype=2. freq hhldsize parntid2 parntid1 famstat persid. *These 5 cases are wrongly coded as hhtype 2, they should be hhtype 3. cro famstat by test by hhtype. *There are 479 people who live with their parents but 357 of them coded as other hhold types. *They should be coded as hhtype=3 (married/cohabiting couple + others). *And 5 coded as married couple alone. Since those respondents actually live their parents *they should be coded as hhtype=3 (married/cohabiting couple + others). *If both parents are living in the same household, it is reasonable *assumption that the parents are a couple. *Recode these cases as hhtype3(married couple +others). If test=1 hhtype=3. cro hhtype by famstat test. ************************ *2* hhtype and hhldsize* ************************. cro hhldsize by hhtype hhtypeo. *there are 24 cases where hhtype is other but hhldsize is 1. *examine those cases. temp. select if hhldsize=1 and hhtype=4. freq persid age hhtypeo empsp under18. *Visually examined those cases in CPS, roster and respondent files. *In both roster and respondent files they are reported to be one person hholds. *In CPS the hhold type is either husband/wife primary *family or group quarters without family, *but in the respondent/roster filse they don't report any spouse. *The roster files is the more recent one. Recode these cases as hhtype1. If hhldsize=1 and hhtype=4 hhtype=1. cro hhldsize by hhtype. *Also in some surveys there are cases where number of children under18 *+ number of couple (2 individuals) is more than hholdsize. compute test=under18+1. cro test by under18. *This is not the case in 2010. temp. select if hhtype=3 and hhldsize=test. freq persid. *If true this will give warning. compute test=0. If hhtype=2 and hhldsize>2 test=1. freq test. *If true all test will be 0. *If hhold size is more than 2 the hhtype should be married + others. If hhtype=2 and hhldsize>2 hhtype=3. cro hhldsize by hhtype hhtypeo. *Examine in detail to check whether there is any inconsistencies. cro under18 by hhtype by hhldsize. ************ *3* relrefp* ************. *relrefp variables is derived from CPS file which is two months before the diary collection. *as a result of this time lag and/or coding/measurement errors there are some inconsitencies *between relrefp variable and some background variables. *We check ALL the cases in all three files and make corrections with respect to the most recent file. cro civstat by relrefp. *All diarists with relrefp values of 2(spouse of ref person) should have civstat=1 (in couple). cro relrefp by hhtype. *hhtype=1 only should correspond with relrefp=1 and in 2010 20 cases do not match this condition. *hhtype=2 should correspond with relrefp values of 1 or 2, and 19 cases do not match this condition. compute test=0. if hhtype=1 and relrefp>1 test=1. freq test. temp. select if test=1. freq persid hhtypeo under18 under5 age sex famstat civstat cohab own18 hhtype hhldsize nchild singpar cphome parntid1 parntid2 HRNUMHOU relrefp empsp partid badcase parpres agekid2 agekidx. *checked the cases in roster/respondent file. In respondent file they are all reported as *being a single person house. No husband/child and hhldsize is 1. *In roster file all but one case are recorded as single house. The only exception is *case 20100302102340 who is a 44 year old male and who reported two own non household children *at home. Because the children are non hhold children and were not reported to be hhold members *in roster file either we report this case as single person hhold. *Change the relrefp for all. If test=1 relrefp=1. compute test2=0. If hhtype=2 and relrefp>2 test2=1. freq test2. temp. select if test2=1. freq persid hhtypeo under18 under5 age sex famstat civstat cohab own18 hhtype hhldsize nchild singpar cphome parntid1 parntid2 HRNUMHOU relrefp empsp partid badcase parpres agekid2 agekidx. *Visually checked all cases in roster and resp files. *Only one case, 20100303100662, reports non hhold child in roster file. But *no hhold children, and the hhold size is reported as 2 in roster file. *All those cases are couple only hholds. if test2=1 relrefp=2. cro relrefp by hhtype. ************************************* *4* rest of the background variables* *************************************. desc all. *check the % of missing cases *and the # of cases. freq sex hhtype nchild civstat cohab empstat emp unemp student retired edcat agekid2 agekidx singpar disab workhrs educa. temp. select if empstat=-8. freq persid empinclm. *We checked other variables to figure out the employment status of this *respondent. She is reported to be full time employed in two other vars. If persid=20100302102508 empstat=1. If persid=20100302102508 emp=1. *Her monthly labout income is system missing. If persid=20100302102508 empinclm=-8. freq cphome. means age by cphome /cells min max median. means age nchild hhldsize by famstat /cells min max. *right age min and max. *no child in categ with no child. means age hhldsize by nchild /cells min max. *number of chil< than #of hhold size. means age by retired /cells min max median. *median age of ret> of not retired. freq age. *cross-tabs of famstat*. cro famstat by agekidx. *famstat 0,3 should match to agekidx=-7 or 4* *other famstat values should not have agekidx=-7* *famstat=1 should match to agekidx=1 only* *famstat=2 should match to agekidx=2 or 3 only* *for adult files there should not be famstat 4 or 5*. cro famstat by nchild. *Other than famstat 0,3 there should be no nchild=0 values. cro famstat by civstat cphome. cro famstat by under18 under5. cro agekidx by nchild under18 under5. cro famstat by hhldsize hhtype singpar. *famstat=1,2,4 should not be in single person or couple alone households (hhtype=1,2)*. cro nchild by under18. freq hhtype famstat singpar civstat. cro civstat by partid. cro civstat by cohab. *All people with cohab=1 or cohab=0 should have a civstat=1. cro hhtype by singpar. temp. select if singpar=1 and hhtype=3. freq cphome persid. *Visually examine those 19 cases. select if tucaseid=20100112091870 or tucaseid=20100302101021 or tucaseid=20100302101607 or tucaseid=20100403102311 or tucaseid=20100504102195 or tucaseid=20100605102237 or tucaseid=20100706101728 or tucaseid=20100806100960 or tucaseid=20100806102304 or tucaseid=20100807100909 or tucaseid=20100908100717 or tucaseid=20100908101916 or tucaseid=20101009102496 or tucaseid=20101109102179 or tucaseid=20101110100570 or tucaseid=20101110101931 or tucaseid=20101211100048 or tucaseid=20101211100686 or tucaseid=20101212100882. execute. *Checked those 19 cases both in respondent and roster files. *20101212100882,20101110101931,20101109102179,20100806100960, *20100706101728,20100302101607 or 20100605102237 not a single parent. *There are children under 18 in the hhold but not reported as own children. *They have neither hhold or non hhold own children. *They are all unmarried young adults living with their parents so hhold code is correct. *change singpar. If persid=20101212100882 or persid=20101110101931 or persid=20101109102179 or persid=20100806100960 or persid=20100706101728 or persid=20100302101607 or persid=20100605102237 singpar=0. *In roster file 20100403102311 is a parent living with both her parents but *she is reported to be 30 year old while one of her parents is 39 and the other 45. *I chekced the CPS and she is coded as non-relative while child is coded as grandchild. *I will use to the information in CPS since. temp. select if persid=20100403102311. freq all. If persid=20100403102311 own18=0. If persid=20100403102311 singpar=0. If persid=20100403102311 cphome=0. If persid=20100403102311 parntid1=-7. If persid=20100403102311 parntid2=-7. cro hhtype by civstat. *should produce no cases of person with civstat=1 and hhtype=4. *No hhtype=2 should match with civstat=2. *Few civstat=1 should match to hhtype=1. cro hhldsize by cphome. *cphome=1 should match hhldsize >1. cro cphome by parntid1 parntid2. cro hhtypeo by hhtype. *15 cases reported as male hhold in htypeo but married couple+ others in hhtype. temp. select if hhtypeo=5 and hhtype=3. freq hhldsize civstat famstat. *Hhldsize is bigger than 3 so hhtype must be correct. cro under18 by hhtype. cro incomeqt by income. cro educ by edcat. cro age by civstat. means agekid2 by agekidx /cells min max. cro agekid2 by famstat. cro empsp by civstat relrefp. cro empstat by emp unemp student retired disab. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\USA2010backadult.sav' /keep hldid persid parntid1 parntid2 partid badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab. ***************************************************** *compute diary, survey and case info for child files* *****************************************************. ************************************* *compute diary, survey and case info* *************************************. GET FILE='F:\evrim\AHTUS\2010\Harmonised Files\USA2010youthep.SAV'. rename variables (hhid pid diaryday origwght recwght survey = hldid persid day ocombwt propwt surveyo). compute countrya = 38. compute survey = 2003. compute swave = 0. compute msamp = 0. compute diary = 1. compute id = 1. execute. *note this dataset already contains the variables *month and year in mtus format. apply dictionary from 'F:\evrim\AHTUS\mtusw58schema.sav'. ********************************************* *harmonised time use variables (av1 ro av41)* *from version 1 through 5.8 for child files * *********************************************. vector av(41). loop i=1 to 41. compute av(i)=0. end loop. do if main=8 or main=10 or main=13 or main=14 or main=15. compute av1=time. else if main=11. compute av2=time. else if main=12. compute av3=time. else if main=16 or main=18 or main=19. compute av4=time. else if main=92 or main=93 or main=94. compute av5=time. else if main=20 or main=21. compute av6=time. else if main=22 or main=23. compute av7=time. else if main=24 or main=25 or main=40 or main=68. compute av8=time. else if main=67. compute av9=time. else if main=26 or main=27 or main=30 or main=31. compute av10=time. else if main=65 or (main>32 and main<40). compute av11=time. else if main=91 or (main>94 and main<98). compute av12=time. else if main=1 or main=2 or main=6. compute av13=time. else if main=7 or main=28 or main=29 or main=32. compute av14=time. else if main=9 and eloc~=6. compute av15=time. else if main=3 or main=4 or main=5. compute av16=time. else if main=90 or main=98. compute av17=time. else if main=50 or main=54 or main=55 or main=64. compute av18=time. else if main=60 or main=63 or main=66. compute av19=time. else if main=51. compute av20=time. else if main=62. compute av21=time. else if main=49. compute av22=time. else if (main>40 and main<47) or main=48. compute av23=time. else if main=52 or main=53. compute av24=time. else if main=57. compute av25=time. else if main=56 or (main=9 and eloc=6). compute av28=time. else if (main=71 or main=72) and eloc>1. compute av29=time. else if main=85. compute av30=time. else if main=86. compute av31=time. else if main=84. compute av32=time. else if main=17 or main=89. compute av33=time. else if main=81. compute av34=time. else if main=82 or main=83. compute av35=time. else if main=70 or main=78. compute av36=time. else if main=88. compute av37=time. else if (main=71 or main=72) and eloc<2. compute av38=time. else if main=76. compute av39=time. else if main=73 or main=74 or main=75 or main=77 or main=87. compute av40=time. else if main=-8 or main=58. compute av41=time. end if. desc av1 to av41. *Three categories have no reported instance: av26(social clubs), av27(pubs)and av35 (read papers, magazines). *Reading books, periodicals or newspapers were not coded seperately *after 2001. All forms of reading were collapsed to reading for personal *interest (original code 120312). Therefore it is not possible to create *av35 for the files after 2003. We coded "reading for personal interest" as av34 (reading books). compute av26=-9. compute av27=-9. compute av35=-9. execute. sort cases by persid. aggregate /outfile='F:\evrim\AHTUS\2010\USA2010W553child.sav' /break=countrya survey swave msamp hldid persid id /day= max(day) /month= max(month) /year= max(year) /diary= max(diary) /av1= sum(av1) /av2= sum(av2) /av3= sum(av3) /av4= sum(av4) /av5= sum(av5) /av6= sum(av6) /av7= sum(av7) /av8= sum(av8) /av9= sum(av9) /av10= sum(av10) /av11= sum(av11) /av12= sum(av12) /av13= sum(av13) /av14= sum(av14) /av15= sum(av15) /av16= sum(av16) /av17= sum(av17) /av18= sum(av18) /av19= sum(av19) /av20= sum(av20) /av21= sum(av21) /av22= sum(av22) /av23= sum(av23) /av24= sum(av24) /av25= sum(av25) /av26= max(av26) /av27= max(av27) /av28= sum(av28) /av29= sum(av29) /av30= sum(av30) /av31= sum(av31) /av32= sum(av32) /av33= sum(av33) /av34= sum(av34) /av35= max(av35) /av36= sum(av36) /av37= sum(av37) /av38= sum(av38) /av39= sum(av39) /av40= sum(av40) /av41= sum(av41) /ocombwt= max(ocombwt) /propwt= max(propwt). aggregate /outfile='F:\evrim\AHTUS\2010\USA2010W58avchild.sav' /break=countrya survey swave msamp hldid persid id /day= max(day) /month= max(month) /year= max(year) /diary = max(diary) /av1= sum(av1) /av2= sum(av2) /av3= sum(av3) /av4= sum(av4) /av5= sum(av5) /av6= sum(av6) /av7= sum(av7) /av8= sum(av8) /av9= sum(av9) /av10= sum(av10) /av11= sum(av11) /av12= sum(av12) /av13= sum(av13) /av14= sum(av14) /av15= sum(av15) /av16= sum(av16) /av17= sum(av17) /av18= sum(av18) /av19= sum(av19) /av20= sum(av20) /av21= sum(av21) /av22= sum(av22) /av23= sum(av23) /av24= sum(av24) /av25= sum(av25) /av26= max(av26) /av27= max(av27) /av28= sum(av28) /av29= sum(av29) /av30= sum(av30) /av31= sum(av31) /av32= sum(av32) /av33= sum(av33) /av34= sum(av34) /av35= max(av35) /av36= sum(av36) /av37= sum(av37) /av38= sum(av38) /av39= sum(av39) /av40= sum(av40) /av41= sum(av41) /ocombwt= max(ocombwt) /propwt= max(propwt). ***************************************** *av variable for child files version 6.0* *****************************************. compute av=999. execute. do if main=8 or main=10 or main=13 or main=14 or main=15. compute av=1. else if main=11. compute av=2. else if main=12. compute av=3. else if main=16 or main=18 or main=19. compute av=4. else if main=92 or main=93 or main=94. compute av=5. else if main=20 or main=21. compute av=6. else if main=22 or main=23. compute av=7. else if main=24 or main=25 or main=40 or main=68. compute av=8. else if main=67. compute av=9. else if main=26 or main=27 or main=30 or main=31. compute av=10. else if main=65 or (main>32 and main<40). compute av=11. else if main=91 or (main>94 and main<98). compute av=12. else if main=1 or main=2 or main=6. compute av=13. else if main=7 or main=28 or main=29 or main=32. compute av=14. else if main=9 and eloc~=6. compute av=15. else if main=3 or main=4 or main=5. compute av=16. else if main=90 or main=98. compute av=17. else if main=50 or main=54 or main=55 or main=64. compute av=18. else if main=60 or main=63 or main=66. compute av=19. else if main=51. compute av=20. else if main=62. compute av=21. else if main=49. compute av=22. else if (main>40 and main<47) or main=48. compute av=23. else if main=52 or main=53. compute av=24. else if main=57. compute av=25. else if main=56 or (main=9 and eloc=6). compute av=28. else if (main=71 or main=72) and eloc>1. compute av=29. else if main=85. compute av=30. else if main=86. compute av=31. else if main=84. compute av=32. else if main=17 or main=89. compute av=33. else if main=81. compute av=34. else if main=82 or main=83. compute av=35. else if main=70 or main=78. compute av=36. else if main=88. compute av=37. else if (main=71 or main=72) and eloc<2. compute av=38. else if main=76. compute av=39. else if main=73 or main=74 or main=75 or main=77 or main=87. compute av=40. else if main=-8 or main=58. compute av=41. end if. variable labels av "main activity 41 category list". value labels av 1 'paid work' 2 'paid work at home' 3 'paid work, second job' 4 'school, classes' 5 'travel to/from work' 6 'cook/ wash up' 7 'housework' 8 'odd jobs' 9 'gardening' 10 'shopping' 11 'childcare' 12 'domestic travel' 13 'dress/personal care' 14 'consume personal services' 15 'meals and snacks' 16 'sleep' 17 'free time travel' 18 'excursions' 19 'active sports participation' 20 'passive sports participation' 21 'walking' 22 'religious activities' 23 'civic activities ' 24 'cinema or theatre' 25 'dances or parties' 26 'social clubs' 27 'pubs' 28 'restaurants' 29 'visit friends at their homes' 30 'listen to radio' 31 'watch television or video' 32 'listen to records, tapes, cds' 33 'study, homework' 34 'read books' 35 'read papers, magazines' 36 'relax' 37 'conversation' 38 'entertain friends at home' 39 'knit, sew' 40 'other leisure' 41 'unclassified or missing activities'. freq av. temp. select if av<10. cro main by av. temp. select if av>10 and av<20. cro main by av. temp. select if av>19 and av<29. cro main by av. temp. select if av>28 and av<35. cro main by av. temp. select if av>34 and av<42. cro main by av. sort cases by survey swave persid epnum. save outfile='F:\evrim\AHTUS\2010\USA2010W60avchild.sav' /keep countrya survey swave msamp hldid persid id epnum av. ***************************************** *create badcase variable for CHILD files* *****************************************. GET FILE='F:\evrim\AHTUS\2010\Harmonised Files\USA2010youthep.sav'. *compute misbasic variable*. compute tmiss=0. compute aeatdr=0. compute asleep=0. compute apcare=0. compute atrav=0. compute anycare=0. execute. If main=-8 tmiss=time. desc tmiss. *include the diaries with food preparation activities *but no eating. If main=8 or main=9 or main=20 or main=21 or main=56 or sec=2 or sec=8 or sec=9 or sec=20 or sec=21 or sec=56 or eloc=6 aeatdr=1. *includes do nothing, think, time out or work break. If main=3 or main=4 or main=5 or main=13 or main=78 or sec=3 or sec=4 or sec=5 or sec=13 or sec=78 asleep=1. *includes purchase of per'l care and imputed p'l or hhold care. If main=1 or main=2 or main=6 or main=7 or main=28 or sec=1 or sec=6 or sec=7 or sec=28 apcare=1. *includes sports/exercise, walking, cycling, outdoor recreation, *gardening, petcare, hunting. If (main>89 and main<99) or main=60 or main=62 or main=63 or main=64 or main=65 or main=66 or main=67 or main=68 or (sec>89 and sec<99) or sec=60 or sec=62 or sec=63 or sec=64 or sec=65 or sec=66 or sec=67 or sec=68 atrav=1. *to create carer flag. If (main>32 and main<41) or (sec>32 and sec<41) anycare=1. execute. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=survey wave hhid pid /eatdr=MAX(aeatdr) /sleep=MAX(asleep) /pcare=MAX(apcare) /trav=MAX(atrav). freq eatdr sleep pcare trav. *compute test variable to figure the diarists who stayed at home all day. compute test=0. if eloc~=lag(eloc) and (hhid=lag(hhid) and pid=lag(pid)) and trav=0 test=1. freq test. compute test2=0. if (hhid=lag(hhid) and pid=lag(pid)) and lag(asleep)=1 and (atrav=1 or (main>9 and main<70) or main>89) and pcare=0 test2=1. freq test2. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=survey wave hhid pid /pcarex=MAX(test2) /travx=MAX(test). if pcare=0 and pcarex=1 pcare=1. if trav=0 and travx=1 trav=1. freq eatdr sleep pcare trav. compute test=0. if eloc=1 or eloc=2 test=time. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=survey wave hhid pid /athome=SUM(test) /maxep=MAX(epnum). desc athome maxep. *Diaries including only 2 of the basic act but have at least *12 episodes where the diarist reports being at home all day *but otherwise meet the other 4 good diary criteria count as *good diaries. if trav=0 and maxep>11 and athome>1000 trav=1. freq trav. AGGREGATE /OUTFILE=* /BREAK=survey wave hhid pid /eatdr=SUM(eatdr) /sleep=SUM(sleep) /pcare=SUM(pcare) /tmiss=SUM(tmiss) /trav=SUM(trav) /anycare=MAX(anycare) /epnum=MAX(epnum) /day=MAX(diaryday). compute misbasic=0. execute. If trav=0 misbasic=misbasic+1. If sleep=0 misbasic=misbasic+1. If pcare=0 misbasic=misbasic+1. If eatdr=0 misbasic=misbasic+1. execute. var lab misbasic number basic activites not recorded. freq misbasic. cro anycare by misbasic. *diaries of carers who otherwise meet the 4 good diary criteria count as good diaries. if (epnum>7 or anycare=1) and misbasic=2 misbasic=1. freq misbasic. temp. select if misbasic>1. freq epnum tmiss. sort cases by hhid pid. match files file=* file="F:\evrim\AHTUS\2010\Harmonised Files\usa10questch.sav" /by hhid pid. execute. compute baddiary=0. execute. if tmiss>90 or epnum<7 or misbasic>1 baddiary=1. freq baddiary. *30 - 5.2% bad diaries.-551 good ones. recode tmiss (0 thru 90=0) (91 thru hi=1). recode epnum (0 thru 6=1) (7 thru hi=0) into nep. recode misbasic (0,1=0) (2,3,4=1). execute. freq tmiss nep misbasic age sex. *As no sex or age missing, only the diary quality variables *determine bad case in this case. cro tmiss by nep by misbasic. *551 diaries of quality; * no diary is bad on all three criteria * 5 diary bad on 2 criteria (6 or fewer episodes and 12 missing 2+ basic acts) * 5 missing 2+basic acts and 6 or fewer episodes. * 30 bad on 1 criteria * 19 missing 91+ minutes, * 6 have 6 or fewer episodes. *compute badcase*. Do If baddiary=0 and sex>-8 and age>-8 and day>-8. compute badcase=0. Else if baddiary=0 and (sex=-8 or age=-8) and day>-8. compute badcase=1. Else if baddiary=0 and sex>-8 and age>-8 and day=-8. compute badcase=2. Else if sex>-8 and age>-8 and day>-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=3. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=4. Else if sex>-8 and age>-8 and day>-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=5. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=0 and misbasic=0. compute badcase=6. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=7. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=8. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=9. Else if sex>-8 and age>-8 and day=-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=10. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=11. Else if sex>-8 and age>-8 and day=-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=12. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=13. Else if sex>-8 and age>-8 and day>-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=14. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=15. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=1 and misbasic=0. compute badcase=16. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and tmiss=0 and misbasic=0. compute badcase=17. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=0 and misbasic=1. compute badcase=18. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=19. Else if (sex=-8 or age=-8) and day>-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=20. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=21. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=22. Else if sex>-8 and age>-8 and day=-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=23. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=24. Else if sex>-8 and age>-8 and day>-8 and nep=1 and tmiss=1 and misbasic=1. compute badcase=25. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and tmiss=1 and misbasic=0. compute badcase=26. Else if (sex=-8 or age=-8) and day=-8 and nep=0 and tmiss=1 and misbasic=1. compute badcase=27. Else if (sex=-8 or age=-8) and day=-8 and nep=1 and tmiss=0 and misbasic=1. compute badcase=28. Else if (sex=-8 or age=-8) and day>-8 and nep=1 and tmiss=1 and misbasic=1. compute badcase=29. Else if sex>-8 and age>-8 and day=-8 and nep=1 and tmiss=1 and misbasic=1. compute badcase=30. Else. compute badcase=31. End if. val lab badcase 0 good case 1 miss age or sex only 2 miss day of week only 3 "miss 91+ minutes only" 4 "<7 episodes only" 5 "miss 2+ basic acts only" 6 "miss age/sex + day of week" 7 "miss age/sex + 91+ min" 8 "miss age/sex + <7 episodes" 9 "miss age/sex + 2+ basic acts" 10 "miss day of week + 91+ min" 11 "miss day of week + <7 episodes" 12 "miss day of week + 2+ basic acts" 13 "miss 91+ min + <7 episodes" 14 "miss 91+ min + 2+ basic acts" 15 "<7 ep & miss 2+ basic acts" 16 "miss age/sex + day or week + 91+ min" 17 "miss age/sex + day or week + <7 episodes" 18 "miss age/sex + day or week + 2+ basic acts" 19 "miss age/sex + 91+ min + <7 eps" 20 "miss age/sex + 91+ min + 2+ basic acts" 21 "miss age/sex + 2+ basic acts + <7 eps" 22 "miss day or week + 91+ min + <7 eps" 23 "miss day or week + 91+ min + 2+ basic acts" 24 "miss day or week + 2+ basic acts + <7 eps" 25 "miss 91+ min + 2+ basic acts + <7 eps" 26 "miss age/sex + day or week + 91+ min + <7 episodes" 27 "miss age/sex + day or week + 91+ min + 2+ basic acts" 28 "miss age/sex + day or week + <7 episodes + 2+ basic acts" 29 "miss age/sex + 91+ min + <7 episodes + 2+ basic acts" 30 "day or week + 91+ min + <7 episodes + 2+ basic acts" 31 bad on all five points. *check that all cases have a code. freq badcase. *double check that all correctly coded. cro badcase by sex day nep tmiss misbasic. rename variables (pid hhid =persid hlid ). sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\badcasech.sav' /keep hlid persid epnum badcase. ********************************************* *create background variables for child files* *********************************************. ******** *ownchi* ********. *This variable will be used to create single parent variable. *young file. get file ='F:\evrim\AHTUS\2010\tempb\own18.sav'. select if age<18. execute. freq age. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\tempb\own18kid.sav' /keep persid own18 prcowpg prcitshp. get file='F:\evrim\AHTUS\2010\usa10questch.sav' /drop occup. *AHTUS and MTUS have different categories for occup variable. *We drop this variable to replace it with the MTUS version. rename variables (hhid pid hhtype urban wagelm income03 empstat = hldid persid hhtypeo urbano empinclm incorig empstat1). sort cases by persid. MATCH FILES /FILE=* /FILE='F:\evrim\AHTUS\2010\tempb\own18kid.sav' /BY persid. ******** *hhtype* ********. do if hhtypeo=2. compute hhtype = 2. else if hhtypeo=1. compute hhtype = 3. else if under18<1 and (hhtypeo=6 or hhtypeo=7). compute hhtype = 1. else if hhtypeo>0. compute hhtype = 4. else. compute hhtype = -8. end if. execute. cro hhtypeo by hhtype. ********** *hhldsize* **********. compute hhldsize = nadult + under18. execute. cro hhldsize by hhtypeo hhtype. *hhytpe=4 is other. All the cases hhldsize=1 must be coded as hhtype=1. temp. select if hhtype=4 and hhldsize=1. freq persid. *If correct this gives a warning. *If hhldsize=1 and hhtype=4 hhtype=1. ******** *nchild* ********. compute nchild = under18. execute. freq nchild. freq under18. ******** *income* ********. Recode incomeqt (-8=-8) (1=1) (2,3=2) (4=3) into income. execute. cro incomeqt by income. ******* *urban* *******. recode urbano (1=1) (0=2) (else=-8) into urban. execute. cro urbano by urban. ********* *singpar* *********. cro hhtype by hhtypeo civstat. cro civstat by own18. compute singpar=0. If own18=1 and civstat=2 singpar=1. execute. freq singpar. ********* *civstat* *********. recode civstat (1=1) (2 thru high=2) (else=-8). execute. ***** *emp* *****. freq empstat1. recode empstat1 (1=1) (2=1) (3=0) (else=-8) into emp. execute. recode empstat1 (1=1) (2=2) (3=4) (else=-8) into empstat. execute. cro empstat by emp unemp. ********* *workhrs* *********. compute workhrs=wkhrs. freq wkhrs. cro wkhrs by unemp empstat. ******* *educa* *******. compute educa=educ. if (educa >0 and educa <3) edcat = 1. if educa=3 edcat = 2. if educa>3 edcat = 3. if educa<0 edcat = -8. ******* *cohab* *******. *In AHTUS we code cohab as 0 (for those who are not cohabiting, married or single), *and as 1 for cohabiting couples. In MTUS however married and single couples *are coded separetely. cro civstat by cohab. If civstat=2 and cohab=0 cohab=-7. cro civstat by cohab. apply dictionary from 'F:\evrim\AHTUS\mtusw58schema.sav'. *sex, cohab, unemp, disab & student *already have the values/names for the MTUS. sort cases by persid. match files files=* files='F:\evrim\AHTUS\2010\tempb\extra1.sav' files='F:\evrim\AHTUS\2010\tempb\extra2.sav' files='F:\evrim\AHTUS\2010\tempb\partid.sav' files='F:\evrim\AHTUS\2010\tempb\occup.sav' files='F:\evrim\AHTUS\2010\tempb\badcasech.sav' files='F:\evrim\AHTUS\2010\tempb\nu5e.sav' /by persid. execute. select if age<18. execute. *this filters out the adult diarists. ******* *empsp* *******. freq empsp. cro relrefp by empsp. *there is no case of relrefp=2 and empsp=-7 *all relrefp=2 should have an empsp value *temp. *select if relrefp=2 and empsp=-7. *freq persid. ******** *cphome* ********. cro cphome by civstat famstat. *cphome is an unmarried child at parents home. *so all values of cphome=1 should have a civstat=2. temp. select if cphome=1 and civstat=1. freq persid. *If true gives warning. temp. select if persid=20100201101693 or persid=20100605101966. cro persid by civstat cphome famstat. *Checked those cases in roster file. *They have unmarried partner living at the same house. If persid=20100605101966 or persid=20100201101693 cphome=0. *There are quite a few cases who are not living under parental quidance. *check those cases. temp. select if cphome=0 and civstat=2. freq persid. *With the two exceptions (20100403100656 and 20100807102096) in all those *cases the diarists live with adult relative and/or siblings>18. Code those as cphome=1. *Those two cases live with other non-relatives so leave them as cphome=0. *people coded as as an other related person counted for calculation of CPHOME as it is *likely that the other relative is the guardian of a dependent child, and *cphome aims to capture whether the unmarried child lives with a parent or guardian. *So we will code these cases as cphome=1. If cphome=0 and civstat=2 and persid~=20100403100656 and persid~=20100807102096 cphome=1. cro cphome by civstat famstat. *famstat=5 (child <18 in other arrangement)should always map to cphome=0. *(not a child living with parents or guardian). temp. select if cphome=1 and famstat=5. cro persid by hhtype civstat. *If true this will give warning. *If cphome=1 and famstat=5 famstat=4. ******** *partid* ********. freq partid. cro partid by civstat empsp. *There is no case where there is a partner id but the *respondent also reported to be single with no value for empsp. *Visually check if this is the case. *temp. *select if partid>0 and civstat=2. *freq persid. *Visually examined cases once again in roster file there is no married couple aged<18. cro cphome by civstat empsp. temp. select if cphome=0. cro persid by relrefp. temp. select if cphome=0 and civstat=2. freq persid parntid1 parntid2. *Already examined these 2 cases. cro cphome by parntid1 parntid2. temp. select if parntid1<0 and cphome=0. freq persid. temp. select if civstat=1 and cphome=1. freq persid. *If true will give warning. ********* *retired* *********. *people aged younger than 18 are coded as 0 by default *as they could not have been retired anyway. compute retired=0. freq retired. apply dictionary from 'F:\evrim\AHTUS\mtusw58schema.sav'. ********** *computer* **********. *computer, vehicle and rushed variables could not be created. compute computer=-9. var label computer "whether hhold have a computer". val lab computer -9 question not asked 1 yes 2 no. ********* *vehicle* *********. compute vehicle=-9. var label vehicle "whether hhold have an access to a private vehicle". val label vehicle -9 question not asked 0 no 1 animal only 2 non-motorised vehicle only 3 1 car 4 2+ cars. ******** *rushed* ********. compute rushed= -9. var label rushed "whether diarist usually feels rushed". val label rushed -9 question not asked 0 almost never 1 sometimes 2 often. ******** *health* ********. compute health= -9. val label health -9 question not asked -8 missing 0 poor 1 fair 2 good 3 very good. ******* *carer* *******. compute carer= -9. var label carer "whether diarist looks after disabled person". val laber carer -9 question not asked 1 yes 2 no. freq computer vehicle rushed health carer. ********* *citizen* *********. compute citizen=-9. recode prcitshp(1 thru 4 =1) (5=0)(else=-8) into citizen. var lab citizen "citizenship status". val lab citizen 0 no 1 yes. cro prcitshp by citizen. ******** *sector* ********. cro prcowpg by empstat. compute sector=99. Do if prcowpg=1. compute sector=2. else if prcowpg=2. compute sector=1. else if empstat=4 and prcowpg=-1. compute sector=-7. else. compute sector=-8. End if. var lab sector "sector of employment". val lab sector -8 missing -7 not applicable 1 public sector 2 private sector. cro sector by empstat. cro sector by prcowpg. ******************* *incorig and educa* *******************. *income and education variables as originally recorded *in the surveys. val lab incorig 1 "Less than $5,000" 2 "5,000 to 7,499" 3 "7,500 to 9,999" 4 "10,000 to 12,499" 5 "12,500 to 14,999" 6 "15,000 to 19,999" 7 "20,000 to 24,999" 8 "25,000 to 29,999" 9 "30,000 to 34,999" 10 "35,000 to 39,999" 11 "40,000 to 49,999" 12 "50,000 to 59,999" 13 "60,000 to 74,999" 14 "75,000 to 99,999" 15 "100,000 to 149,999" 16 "150,000 and over" -7 "not applicable/not asked" -8 "missing" -9 "could not be created" /educa 1 "grades 0-8 only" 2 "grades 9-11 - not hs graduate" 3 "high school graduate" 4 "some college" 5 "college graduate" 6 "postgraduate" -7 "not applicable/not asked" -8 "missing" -9 "could not be created". ******************************************* *check background variables of child files* *******************************************. *relrefp*. cro relrefp by civstat hhtype empsp partid cphome. *relrefp=2 and civstat=1 should not match with empsp or partid=-7. desc all. *check the % of missing cases *and the # of cases. freq sex hhtype nchild civstat cohab cphome empstat emp unemp student retired edcat agekid2 agekidx singpar disab workhrs educa. means age nchild hhldsize by famstat /cells min max. *right age min and max. *no child in categ with no child. *cross-tabs of famstat*. cro famstat by agekidx nchild civstat cphome. cro famstat by under18 under5. cro agekidx by nchild under18 under5. cro famstat by hhldsize hhtype singpar. *there should be only famstat 4 or 5. *famstat=4 should not be in single person or couple alone households (hhtype=1,2). cro civstat by hhtype partid cohab cphome. cro hhtype by civstat singpar. *should produce no cases of person with civstat1 and hhtype4. temp. select if civstat=1 and hhtype=4. freq persid cphome hhldsize civstat famstat. If persid=20100201101693 hhtype=3. cro hhldsize by cphome. cro hhtype by hhtypeo under18. cro incomeqt by income. cro educ by edcat. cro age by civstat. means agekid2 by agekidx /cells min max. cro agekid2 by famstat. cro empsp by civstat relrefp. cro empstat by emp unemp student retired disab. sort cases by persid. save outfile='F:\evrim\AHTUS\2010\USA2010backchild.sav' /keep hldid persid parntid1 parntid2 partid badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab. ******************************************* *put timeuse and background files together* *to create Versions 5.53, 5.8 and 6.0 * *******************************************. *make sure all covered in this order /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab 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. ********************* *Create Version 5.53* *********************. *combine adult and child files with time use variables. get file = 'F:\evrim\AHTUS\2010\USA2010W553adult.sav'. add files /file=* /file='F:\evrim\AHTUS\2010\USA2010W553child.sav'. execute. apply dictionary from 'F:\evrim\AHTUS\MTUSW553schema.sav'. sort cases by persid. *weight tests*. means table=propwt /cells mean sum min max. **mean of weight is precisely 1. *and it correctly sums up to 13260. save outfile = 'F:\evrim\AHTUS\2010\USA2010W553.sav' /keep countrya survey swave msamp hldid persid id day month year diary 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. *combine child and adult files with background variables. get file = 'F:\evrim\AHTUS\2010\USA2010backadult.sav'. add files files=* file ='F:\evrim\AHTUS\2010\USA2010backchild.sav'. execute. apply dictionary from 'F:\evrim\AHTUS\MTUSW553schema.sav'. val lab incorig 1 "Less than $5,000" 2 "5,000 to 7,499" 3 "7,500 to 9,999" 4 "10,000 to 12,499" 5 "12,500 to 14,999" 6 "15,000 to 19,999" 7 "20,000 to 24,999" 8 "25,000 to 29,999" 9 "30,000 to 34,999" 10 "35,000 to 39,999" 11 "40,000 to 49,999" 12 "50,000 to 59,999" 13 "60,000 to 74,999" 14 "75,000 to 99,999" 15 "100,000 to 149,999" 16 "150,000 and over" -7 "not applicable/not asked" -8 "missing" -9 "could not be created" /educa 1 "grades 0-8 only" 2 "grades 9-11 - not hs graduate" 3 "high school graduate" 4 "some college" 5 "college graduate" 6 "postgraduate" -7 "not applicable/not asked" -8 "missing" -9 "could not be created". sort cases by persid. save outfile='F:\evrim\AHTUS\2010\USA2010backall.sav' /keep hldid persid parntid1 parntid2 partid badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab. get file ='F:\evrim\AHTUS\2010\USA2010W553.sav'. sort cases by persid. match files files=* file ='F:\evrim\AHTUS\2010\USA2010backall.sav'/by persid. execute. ************************************** *last quality checks for version 5.53* **************************************. desc all. freq famstat. freq countrya survey swave msamp partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs occup sector educa edcat rushed health carer disab. cro civstat by cphome. cro empsp by civstat. means age hhldsize nchild by famstat /cells min max. means age hhldsize by nchild retired /cells min max median. cro famstat by nchild civstat hhtype agekidx cphome. cro agekidx by nchild. cro empstat by emp unemp retired student. cro empsp by civstat relrefp. cro hhldsize by hhtype. *All hhldsize=1 must be hhtype=1. cro civstat by hhtype relrefp. *note no relrefp=2 should appear if civstat=2. means propwt /cells min max mean sum. *mean of propwt is correctly equal to 1 and sums to 13260. weight by propwt. freq badcase day sex age. freq health. ***************************** **Save USA 2010 Version 5.53* *****************************. apply dictionary from 'F:\evrim\AHTUS\MTUSW553schema.sav'. val lab incorig 1 "Less than $5,000" 2 "5,000 to 7,499" 3 "7,500 to 9,999" 4 "10,000 to 12,499" 5 "12,500 to 14,999" 6 "15,000 to 19,999" 7 "20,000 to 24,999" 8 "25,000 to 29,999" 9 "30,000 to 34,999" 10 "35,000 to 39,999" 11 "40,000 to 49,999" 12 "50,000 to 59,999" 13 "60,000 to 74,999" 14 "75,000 to 99,999" 15 "100,000 to 149,999" 16 "150,000 and over" -7 "not applicable/not asked" -8 "missing" -9 "could not be created" /educa 1 "grades 0-8 only" 2 "grades 9-11 - not hs graduate" 3 "high school graduate" 4 "some college" 5 "college graduate" 6 "postgraduate" -7 "not applicable/not asked" -8 "missing" -9 "could not be created". weight off. sort cases by swave msamp hldid persid id. save outfile='F:\evrim\AHTUS\2010\Harmonised Files\USA2010W553.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab 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. ******************** *Create Version 5.8* ********************. *combine adult and child files with "av" variables. get file ='F:\evrim\AHTUS\2010\USA2010W58avadult.sav'. add files files=* file ='F:\evrim\AHTUS\2010\USA2010W58avchild.sav'. execute. sort cases by persid. *combine it with the file that has "main" variables. match files files=* file ='F:\evrim\AHTUS\2010\USA2010W58main.sav'/by persid. execute. *now this file has all the time use variables *combine it with the file that has background variables. sort cases by persid. match files files=* file ='F:\evrim\AHTUS\2010\USA2010backall.sav'/by persid. execute. apply dictionary from 'F:\evrim\AHTUS\MTUSW58schema.sav'. val lab incorig 1 "Less than $5,000" 2 "5,000 to 7,499" 3 "7,500 to 9,999" 4 "10,000 to 12,499" 5 "12,500 to 14,999" 6 "15,000 to 19,999" 7 "20,000 to 24,999" 8 "25,000 to 29,999" 9 "30,000 to 34,999" 10 "35,000 to 39,999" 11 "40,000 to 49,999" 12 "50,000 to 59,999" 13 "60,000 to 74,999" 14 "75,000 to 99,999" 15 "100,000 to 149,999" 16 "150,000 and over" -7 "not applicable/not asked" -8 "missing" -9 "could not be created" /educa 1 "grades 0-8 only" 2 "grades 9-11 - not hs graduate" 3 "high school graduate" 4 "some college" 5 "college graduate" 6 "postgraduate" -7 "not applicable/not asked" -8 "missing" -9 "could not be created". weight off. sort cases by swave msamp hldid persid id. save outfile='F:\evrim\AHTUS\2010\USA2010W58all.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab 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. ************************************* *last quality checks for version 58* *************************************. desc all. freq countrya survey swave msamp partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs occup sector educa edcat rushed health carer disab. *av26 27 35 could not be created for this survey. compute testav= SUM (av1 to av25)+ SUM(av28 to av34) + SUM(av36 to av41). freq testav. *correctly sums to 1440 for all cases. *main45, main51 and main60 could not be created for this survey. compute testmain=SUM(main1 to main44)+ SUM (main46 to main50) + SUM (main52 to main59)+ SUM (main61 to main69). freq testmain. *correctly sums to 1440 for all cases. cro empsp by civstat. means age hhldsize nchild by famstat /cells min max. means age hhldsize by nchild retired /cells min max median. cro famstat by nchild civstat hhtype agekidx cphome. cro agekidx by nchild. cro empstat by emp unemp retired student. cro empsp by civstat relrefp. cro civstat by hhtype relrefp. *note no relrefp=2 should appear if civstat=2. means propwt /cells min max mean sum. *mean of propwt is correctly equal to 1. weight by propwt. freq badcase day sex age. ************************************** *Save USA 2010 Version 5.8 adult file* **************************************. weight off. select if age>17. sort cases by swave msamp hldid persid id. save outfile='F:\evrim\AHTUS\2010\Harmonised Files\USA2010W58.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab 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. ************************************** *Save USA 2010 Version 5.8 child file* **************************************. get file='F:\evrim\AHTUS\2010\USA2010W58all.sav'. weight off. select if age<18. sort cases by swave msamp hldid persid id. save outfile='F:\evrim\AHTUS\2010\Harmonised Files\USA2010W58kid.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary badcase hhtype hhldsize nchild agekidx agekid2 incorig income ownhome urban computer vehicle sex age famstat cphome singpar relrefp civstat cohab citizen empstat emp unemp student retired empsp workhrs empinclm occup sector educa edcat rushed health carer disab 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. ******************** *Create Version 6.0* ********************. ********* *av file* *********. *add adult and child files with av variable in a single file*. get file = 'F:\evrim\AHTUS\2010\USA2010W60avadult.sav'. add files /file=* /file='F:\evrim\AHTUS\2010\USA2010W60avchild.sav'. execute. apply dictionary from 'F:\evrim\AHTUS\mtusw60schema.sav'. sort cases by survey swave persid epnum. save outfile='F:\evrim\AHTUS\2010\USA2010W60av.sav' /keep countrya survey swave msamp hldid persid id epnum av. *********** *main file* ***********. *main file includes both adult and child data. *combine it with av file. get file = 'F:\evrim\AHTUS\2010\USA2010W60main.sav'. sort cases by persid epnum. apply dictionary from 'F:\evrim\AHTUS\mtusw60schema.sav'. match files files=* file = 'F:\evrim\AHTUS\2010\usa2010W60av.sav' /by persid epnum. freq survey. ******************************************* *add badcase variable and divide the files* *******************************************. match files files=* table ='F:\evrim\AHTUS\2010\usa2010backall.sav' /by persid. freq survey. apply dictionary from 'F:\evrim\AHTUS\mtusw60schema.sav'. sort cases by swave msamp hldid persid id epnum. save outfile= 'F:\evrim\AHTUS\2010\usa2010W60all.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. ************************************** *Save USA 2010 Version 6.0 adult file* **************************************. get file= 'F:\evrim\AHTUS\2010\usa2010W60all.sav'. weight off. select if age>17. sort cases by swave msamp hldid persid id epnum. Save outfile='F:\evrim\AHTUS\2010\Harmonised Files\USA2010W6.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. ************************************** *Save USA 2010 Version 6.0 child file* **************************************. get file='F:\evrim\AHTUS\2010\USA2010W60all.sav'. weight off. select if age<18. sort cases by swave msamp hldid persid id epnum. Save outfile='F:\evrim\AHTUS\2010\Harmonised Files\USA2010W6kid.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. ******************************************************* ** The end of syntax producing the 5.53, 5.8 and 6.0 ** ** MTUS versions of USA 2010 (ATUS) ** *******************************************************.