***************************************************** **Syntax producing the 5.53, 5.8 and 6.0 version of** **USA 2006 (ATUS) written by Dr. Kimberly Fisher & ** **Evrim Altintas, Centre for Time Use Research, ** **University of Oxford, Department of Sociology, ** **Manor Road Oxford OX1 3UQ United Kingdom ** **04 August 2009 ** **Updated by Evrim Altintas ** **Centre for Time Use Research, ** **University of Oxford, Department of Sociology, ** **Manor Road Oxford OX1 3UQ United Kingdom ** **21 July 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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusrost_2006.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra1.sav' /keep persid cphome parntid1 parntid2. ******************************************** *create person identifier of spouse/partner* ********************************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusrost_2006.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/partid.sav' /keep persid tulineno partid. ************************* *create a diarist marker* *************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusrost_2006.sav'. rename variables (terrp tucaseid = drstmark persid). select if drstmark=18 or drstmark=19. execute. sort cases by persid tulineno. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra2b.sav' /keep persid tulineno drstmark. *************************************************** *create relrefp variable "rel to hhold ref person"* ***************************************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atuscps_2006.sav' /keep tucaseid tulineno perrp hrnumhou. rename variables (tucaseid=persid). sort cases by persid tulineno. match files files=* files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra2.sav' /keep persid hrnumhou relrefp. **************************************************** *create the time use variables for the 18+ diarists* ****************************************************. ************************************* *compute diary, survey and case info* *************************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006hfep.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 '/Volumes/FreeAgent GoFlex Drive/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553adult.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58avadult.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). *check whether the total time equals 1440. get file= '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553adult.sav'. freq total. *all diaries add up to the correct 1440 minutes. sort cases by persid. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553adult.sav' /drop total. ************************************************* *create time use and who else present variables* *for versions 5.8 and 6.0 * *************************************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusresp_2006.sav' /keep tucaseid tuyear tumonth tudidate tudiday tufinwgt. freq tuyear tumonth tudidate tudiday. rename variables (tucaseid tuyear tumonth tudiday = pid year month diaryday). *tudidate must be numeric. compute cday= tudidate - trunc(tudidate/100)*100. freq cday. sort cases by pid. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/datewght.sav' /keep pid diaryday cday month year tufinwgt. *extract sex and age to check weights - also to refine closefamily code. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusrost_2006.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusrost_2006.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/kidflag.sav'. **************************** *who else present variables* ****************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atuswho_2006.sav'. rename variables (tucaseid tuact_n=pid epnum). sort cases by pid tulineno. match files files=* table='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusact_2006.sav' /keep tucaseid tuact_n tustart tustop. sort cases by tucaseid tuact_n. SAVE TRANSLATE OUTFILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 12943 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="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/sstime.sav" /keep pid epnum clockst start end time maxep lastep. ***************************************************************** *create variables inout, mtrav, eloc, survey, wave, main and sec* *****************************************************************. Get file='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusact_2006.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=1. apply dictionary from '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/MTUSW58schema_main.sav'. freq survey wave. match files files=* files="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/sstime.sav" /BY pid epnum. execute. match files files=* table='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/datewght.sav' /BY pid. match files files=* files="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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=40112 or actcode=40507 or actcode=40508 or actcode=100103 or actcode=130131 or actcode=500105 or actcode=500106. freq actcode. *all instances of sleep (10101); sleeplessnes (10102); washing & dressing (10201); *grooming nec (10299); personal care (10401); personal care nec(10499); *500105 (do not remember), and 500106(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 12943 diaries (we know this as the frequency *of epnum=1 is 12943) 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 12943 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, 47033 (17.9% of cases)=-1; 530 (0.2%) = 89. 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. *19057 (7.3% of cases)=-1; 530 (0.2%)=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 62.2% are the first episode; *8.3% 2nd episode; 15.7% last episode; 3.6% 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 6418 (2.4% of cases)=-1; 550 (0.2%)=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 5257 (2.0% of cases)=-1; 530 (0.2%)=89. temp. select if where=-1 or where=89. freq eptest. *more now at beginning of diary- 39.3% first episode; 26.8% 2nd *episode; 3.0% last episode; 6.3% 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 2461 cases (0.9%) have location=-1 and 530 (0.2%) 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 2171 cases (0.8%) have location=-1 and 530 (0.2%) 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 2044 cases (0.8%) have location=-1 and 530 (0.2%) location not remembered. temp. select if where=89. freq eptest. *none of 530 don't remember cases at the beginning or end 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 2044 cases (0.8%) have location=-1 and 23 (0.0%)=89 location not remembered. temp. select if where=89. freq prevact actcode nextact prevloc nextloc. *these remaining 23 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. *1 string of 5 to 10 acts, 3 strings of 4 acts, 54 strings of 3 acts, *241 strings of two acts. Visually examine those more than three. TEMPORARY. select if test>3. freq pid. *It is not clear whether 20061211061850 was at his home or someone else's home. *20061010061823 and 20061110060112 report complex days of transitions between work and outdoors. *The location right before and after the missing is respondent's home and *activity is sleep. Code these cases as home. Do if (pid=20061010061823 or pid= 20061110060112) 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 1168 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. *191 (147+44) of these 345 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 862 cases (0.3%) have location=-1. compute test=0. if (actcode=10101 or actcode=10102) and where=-1 test=1. freq test. *now only 39 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). * 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. 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 371 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 = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/mid1.sav'. get file = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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<20000 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. cro tewhere where by inout. *walking should never be in a vehicle. temp. select if where=14 and inout=3. freq actcode. 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. *probably cutting the grass. Still code as in a vehicle. If (where=12 or where=13)and actcode=20501 and inout=2 where=17. 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. *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. *There are 39 cases where the actcode is NOT travel or walk, but *where=14 (walking) and inout=1. *Code these aswhere=1(other place) and eloc=9(other). compute temp=0. If inout=1 and eloc=8 and where=14 temp=1. freq temp. If temp=1 where=11. If temp=1 eloc=9. temp. select if inout=1 and eloc=8 and where=11. freq actcode. *All cases are travel. So I recode them as: * where=unspecificed more of transp, inout= in a vehicle and eloc= travelling. 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. *Checked this case. The individual is at home all the time. If pid=20060505060990 and actcode=130131 inout=1. If pid=20060505060990 and actcode=130131 where=1. If pid=20060505060990 and actcode=130131 eloc=1. temp. select if mtrav=5 and inout=2. freq actcode where eloc. *where is either 9(outdoors) or 21(other mode of transportation). *leave equestrian (3 cases),hiking, run activities as inout=2(outside). If mtrav=5 and inout=2 inout=3. cro mtrav by inout. delete variables temp. *final corrections to fix the inconsistencies. *If mtrav=3 and inout=3 inout=1 (We don't need this for 2005). temp. select if mtrav=1 and inout=2. freq actcode eloc. *if true this will give warning. temp. select if mtrav=3 or mtrav=4. freq actcode. ******* *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 '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/MTUSW58schema_main.sav'. save outfile = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/mid2.sav'. get file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 or actcode=160104. 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=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. 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=100201 or actcode=100299 or actcode=100303. Compute main=33. Else if (actcode>140100 and actcode<140105) 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=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) or actcode=181002. 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<181002) or (actcode>181002 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. *47 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/10 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 9 or more activities, and 39 of them *have no or an acceptable amount of missing time (except one). 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 7 such cases, all at home. compute test2=0. if test=1 test2=lag(main). freq test2. *4 wash/dress, 1 other meals, 1 other dom work, 1 watch TV. *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. *3 such cases, all at own home. compute test2=0. if lag(test)=1 test2=main. freq test2. cro test2 by eloc. *1 asleep, 1 food prep, 1 child/adult care. 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. *115 such cases (112 at home, 2 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. *335 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. 65% 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, 1200 of the 2337 cases coded with missing codes *in the original data are still coded as missing - 508 now imputed personal *or household care, 3 imputed sleep; 360 imputed time away from home; *43 walking; 236 imputed travel. temp. select if main=69. freq time eloc. *remaining gaps range from 1 minute to 14 hours. 57.6% *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, 2.9% 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. sort cases by pid epnum. save outfile ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/mid3.sav'. *********************************************** ****** THE EATING AND HEALTH MODULE FILE ****** ***********************************************. *ehact06 file is created in AHTUS conversion syntax. get file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/mid3.sav'. sort cases by pid epnum. match files /file=* /table="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempa/ehact06.sav" /by pid epnum. execute. desc temped EUEDUR24 EUDDUR24. temp. select if temped>1440. freq pid. *There are two cases where temped>1440. *20060101061074 and 20060504062317. compute temp3=0. If euddur24>0 and euedur24>0 temp3=1. freq temp3. freq sec. *for our purposes, here sysmiss means *no time reported in this act by this diarist. recode euedur24 euddur24 (sysmis=0) (else=copy). execute. ***NEW CODE STARTS HERE* ************************. compute test=0. Do if sec=0 and (EUEDUR24>0 or EUDDUR24>0). compute test=1. Else if sec=31 and (EUEDUR24>0 or EUDDUR24>0). compute test=3. Else if sec>0 and (EUEDUR24>0 or EUDDUR24>0). compute test=5. Else if sec=31 and EUEDUR24=0 and EUDDUR24=0. compute test=2. Else if sec>0 and EUEDUR24=0 and EUDDUR24=0. compute test=4. End if. val lab test 0 'no secondary activity' 1 'only secondary eating/drinking' 2 'secondary care only' 3 'secondary care and eating/drinking' 4 'other CTUR secondary code only' 5 'other CTUR secondary code and eating/drinking'. freq test. *78.2% cases have no sec activity. *15.5% have only sec ccare. *4.7% have only sec eating/drinking. *762 have other CTUR sec code and 67 have both other CTUR sec and eat/drink. *3241 sec ccare and eating. cro test by sec. *of the cases where CTUR has imputed a code, 30 have imputed secondary *eating and reported secondary eating - in these cases we will remove *the CTUR imputed eating and replace it with the secondary eating *reported by the participant. In 41 cases, we have imputed travel. Check *these cases at a future point in the code. compute seatdr=-5. Do if euddur24=0 and euedur24=0. compute seatdr=0. Else if euddur24>0 and euedur24=0. compute seatdr=1. Else if euddur24=0 and euedur24>0. compute seatdr=2. Else if euddur24>0 and euedur24>0. compute seatdr=3. End if. val lab seatdr 0 'neither sec eat nor sec drinking' 1 'only sec drinking' 2 'only sec eating' 3 'both sec eating and sec drinking'. freq seatdr. cro euedur24 by seatdr. cro euddur24 by seatdr. cro test by seatdr. *reset variable names for final AHTUS variables - these variables will be *reconstructed to include the secondary eating and drinking. rename variables (start end main sec inout eloc mtrav alone child sppart oad hhadult infant= ostart oend omain osec oinout oeloc omtrav oalone ochild osppart ooad ohhadult oinfant). *as some secondary eating and drinking does not equal the total time of the episode, *we will put this time in the middle of the episode. vector start(3) end(3) main(3) sec(3) inout(3) eloc(3) mtrav(3) alone(3) child(3) infant(3) sppart(3) oad(3) . do repeat a=start1 to oad3. compute a=-5. end repeat. execute. *set current episode to the first in the set of three in the new episode data range. *nothing will change where there is no secondary eating/drinking or the secondary *eating/drinking is the only secondary activity and has the same duration of the *main activity episode. compute start1=ostart. compute end1=oend. compute main1=omain. compute sec1=osec. compute inout1=oinout. compute eloc1=oeloc. compute mtrav1=omtrav. compute alone1=oalone. compute child1=ochild. compute infant1=oinfant. compute sppart1=osppart. compute oad1=ooad. execute. ***** **A** *****. *check cases where main is missing but there is eat/drink only* ***************************************************************. temp. select if omain=69 and osec=0. freq seatdr. *40 cases where main is missing but seceatdr>0. *17 cases with drinking only *14 cases eating only *9 both eat and drink. temp. select if omain=69 and osec=0 and seatdr>0. freq oalone ochild osppart time oeloc prevact nextact. *Missing time varies between 5 min to 480. *All the missings are at home. *Most of previous next act is personal care or travel. *If previous or next act is in home social code missing main *as main=51(imputed in home social), and sec=6 eating. Do if omain=69 and osec=0 and seatdr>0 and (oeloc=1 or oeloc=2) and ((prevact>119999 and prevact<130000) or (nextact>119999 and nextact<130000)). compute main1=51. compute sec1=6. End if. execute. temp. select if omain=69 and osec=0 and seatdr>0. freq time oeloc oalone ochild osppart prevact nextact. **All the cases are at home. Mostly preceeded/ followed by personal care. freq sec1. *Code the remaining 23 as imputed personal or hhold care. Do if omain=69 and osec=0 and seatdr>0 and (oeloc=1 or oeloc=2). compute main1=1. compute sec1=6. end if. freq sec1. *this makes 40 cases of secondary eating. ***** **B** *****. *Deal with cases with only secondary eating/drinking* *including addressing replacing imputed eating with * *actually reported secondary eating * *****************************************************. *There are 12460 episodes with only reported secondary eating/drinking. freq test seatdr. cro test by seatdr. compute sectemp=0. Do if seatdr=1. compute sectemp=euddur24. Else if seatdr=2. compute sectemp=euedur24. Else if seatdr=3. compute sectemp=euedur24 + euddur24. End if. *note that where the sum of eating and drinking time is larger *than the epsiode time, we will not exceed the total episode time. temp. select if sectemp>time. freq pid. *1300 cases where sectemp>time. This creates problems later - reset sectemp to be no more than ther duration of the episode. if sectemp>time sectemp=time. var lab sectemp 'secondary eating or drinking'. cro sectemp by seatdr. temp. select if test=1 and sectemp2 and osec=1)) and sectemp2 and osec=1)) and sectemp-5 and end1~=start2. freq pid. *ok so far - end1=start2, no cases of deviation. *also check that start1 not = start2. compute check=0. if start1=start2 check=1. freq check. *as long as check=0, there will be no 0 time episodes. *add in secondary eating in the middle. *as main adjusted, copy over main1 values, but other codes not *changed, hence new episodes retain original reported values. Do if test=1 and sectemp-5 and end3~=oend. freq pid. *ok so far - end3=oend, no cases of deviation. *check for 0 time episodes, start1 should not = start2, and start2 should not = start3. compute check=0. if start1=start2 check=1. if start2=start3 and start2>-5 check=1. freq check. *as long as check=0, there will be no 0 time episodes. *still all ok. ***** **C** *****. *Deal with 41 cases with secondary eating/drinking * *and imputed travel * *****************************************************. temp. select if test=5 and osec=62. cro sectemp by remain. temp. select if test=5 and osec=62. freq pid. *in all these 37 cases, the reported secondary eating and drinking is *the same or more than the total episode time. In 12 cases, the time *slot is <20 minutes (in one case only 3 minutes); all other cases are *20-364 minutes. For the 12 shorter episodes, make secondary travel *2 minutes; if other cases, make secondary travel 10 minutes. Do if test=5 and osec=62 and sectemp<20. compute start2=oend-2. compute end1=oend-2. compute end2=oend. compute main2=main1. compute sec1=6. compute sec2=osec. compute inout2=oinout. compute eloc2=oeloc. compute mtrav2=omtrav. compute alone2=oalone. compute child2=ochild. compute infant2=oinfant. compute sppart2=osppart. compute oad2=ooad. Else if test=5 and osec=62. compute start2=oend-10. compute end1=end1-10. compute end2=oend. compute main2=main1. compute sec1=6. compute sec2=osec. compute inout2=oinout. compute eloc2=oeloc. compute mtrav2=omtrav. compute alone2=oalone. compute child2=ochild. compute infant2=oinfant. compute sppart2=osppart. compute oad2=ooad. End if. execute. *visually check some cases - these look ok. Check that sec2 now has 37 sec=62 cases, *but sec3 remains all 0 or -5. freq sec1 sec2 sec3. *now 4780 cases of secondary eating (code 6) in sec1. ***** **D** *****. *Deal with cases with secondary eating/drinking and * *child being in your care * *****************************************************. temp. select if test=3 and osec=31. cro sectemp by remain. temp. select if test=3 and osec=31. freq pid. Do if test=3 and sectemp>5. compute kideatr1=rnd(sectemp/2). compute kideatr2=trunc(sectemp/2). End if. cro test by kideatr1. temp. select if sectemp>30. freq kideatr1 kideatr2. Do if test=3 and (sectemp>5 and sectemp<31). compute start2=oend-kideatr2. compute end1=oend-kideatr2. compute end2=oend. compute main2=main1. compute sec1=6. compute sec2=osec. compute inout2=oinout. compute eloc2=oeloc. compute mtrav2=omtrav. compute alone2=oalone. compute child2=ochild. compute infant2=oinfant. compute sppart2=osppart. compute oad2=ooad. Else if test=3 and sectemp>30 and (kideatr2=16 or kideatr2=18 or kideatr2=20 or kideatr2=22 or kideatr2=24 or kideatr2=26 or kideatr2=28 or kideatr2=30 or kideatr2=32 or kideatr2=34 or kideatr2=36 or kideatr2=38 or kideatr2=40 or kideatr2=42 or kideatr2=44 or kideatr2=46 or kideatr2=48 or kideatr2=50 or kideatr2=52 or kideatr2=54 or kideatr2=56 or kideatr2=58 or kideatr2=60 or kideatr2=62 or kideatr2=64 or kideatr2=66 or kideatr2=68 or kideatr2=70 or kideatr2=72 or kideatr2=74 or kideatr2=76 or kideatr2=78 or kideatr2=80 or kideatr2=82 or kideatr2=84 or kideatr2=86 or kideatr2=88 or kideatr2=90 or kideatr2=92 or kideatr2=94 or kideatr2=96 or kideatr2=98 or kideatr2=100 or kideatr2=102 or kideatr2=108 or kideatr2=110 or kideatr2=112 or kideatr2=116 or kideatr2=120 or kideatr2=122 or kideatr2=124 or kideatr2=130 or kideatr2=142 or kideatr2=146 or kideatr2=150 or kideatr2=152 or kideatr2=154 or kideatr2=160 or kideatr2=170 or kideatr2=172 or kideatr2=174 or kideatr2=180 or kideatr2=182 or kideatr2=190 or kideatr2=210 or kideatr2=220 or kideatr2=240 or kideatr2=242 or kideatr2=266). compute start2=start1+(kideatr2/2). compute end1=start1+(kideatr2/2). compute start3=oend-(kideatr2/2). compute end2=oend-(kideatr2/2). compute end3=oend. compute main2=main1. compute main3=main1. compute sec2=6. compute sec3=osec. compute inout2=oinout. compute inout3=oinout. compute eloc2=oeloc. compute eloc3=oeloc. compute mtrav2=omtrav. compute mtrav3=omtrav. compute alone2=oalone. compute alone3=oalone. compute child2=ochild. compute child3=ochild. compute infant2=oinfant. compute infant3=oinfant. compute sppart2=osppart. compute sppart3=osppart. compute oad2=ooad. compute oad3=ooad. Else if test=3 and sectemp>30. compute start2=start1+((kideatr2-1)/2). compute end1=start1+((kideatr2-1)/2). compute start3=oend-((kideatr2-1)/2). compute end2=oend-((kideatr2-1)/2). compute end3=oend. compute main2=main1. compute main3=main1. compute sec2=6. compute sec3=osec. compute inout2=oinout. compute inout3=oinout. compute eloc2=oeloc. compute eloc3=oeloc. compute mtrav2=omtrav. compute mtrav3=omtrav. compute alone2=oalone. compute alone3=oalone. compute child2=ochild. compute child3=ochild. compute infant2=oinfant. compute infant3=oinfant. compute sppart2=osppart. compute sppart3=osppart. compute oad2=ooad. compute oad3=ooad. End if. execute. *visually check some cases - these look ok. Sec3 remains all 31 or 0 or -5 . freq sec1 sec2 sec3. *now 6438 cases of secondary eating in sec1 (code 6). *check for 0 time episodes, start1 should not = start2, and start2 should not = start3. compute check=0. if start1=start2 check=1. freq check. *no cases or start1=start2. compute check=0. if start2=start3 and start2>-5 check2=1. freq check. *all still ok. ************ *create ict* ************. compute ict=0. execute. If actcode=20904 or actcode=120308 ict=1. freq ict. sort cases by pid. vector start=start1 to start3 /end=end1 to end3 /main=main1 to main3 /sec=sec1 to sec3 /inout=inout1 to inout3 /eloc=eloc1 to eloc3 /mtrav=mtrav1 to mtrav3 /alone=alone1 to alone3 /child= child1 to child3 /infant=infant1 to infant3 /sppart=sppart1 to sppart3 /oad=oad1 to oad3. loop i=1 to 3. compute start=start(i). compute end=end(i). compute main=main(i). compute sec=sec(i). compute inout=inout(i). compute eloc=eloc(i). compute mtrav=mtrav(i). compute alone=alone(i). compute child=child(i). compute infant=infant(i). compute sppart=sppart(i). compute oad=oad(i). xsave outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/revised-diary.sav' /keep = survey wave pid diaryday cday month year start end main sec inout eloc ict mtrav alone child infant sppart oad actcode tewhere. end loop. execute. get file '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempa/usa06sexage_all.sav'. sort cases by pid. save outfile '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/usa06sexage_all2.sav' /keep pid hhid age sex. get file='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/revised-diary.sav'. sort cases by pid. match files /file=* /table='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/usa06sexage_all2.sav' /by pid. execute. freq main. *-5 cases are slots that are not needed as there was no secondary activity during that slot. *remove these rows. select if main~=-5. freq main. *reconstruct time following addition of new episodes. compute time=end-start. desc time. temp. select if time=0. freq pid. *problematic cases=20060111050621, 20060504061313, 20060504061736, 20060504061769 *20060706060676, 20060707062288, 20060908061646,20061110060008. select if time>0. execute. Do if sec=6. Do if ((main>14 and main<18) or main=33) and eloc=4. compute sec=5. Else if ((main>11 and main<15) or (main>49 and main<62)) and eloc=3. compute sec=5. Else if ((main>11 and main<18) or main=7 or main=9 or main=24 or (main>28 and main<36) or main=40 or main=48 or main=49) and eloc=6. compute sec=39. End if. End if. freq sec. Do if start=0. compute clockst = 400. Else if start<60. compute clockst = 400 + start. Else if start<120. compute clockst = 500 + start-60. Else if start<180. compute clockst = 600 + start-120. Else if start<240. compute clockst = 700 + start-180. Else if start<300. compute clockst = 800 + start-240. Else if start<360. compute clockst = 900 + start-300. Else if start<420. compute clockst = 1000 + start-360. Else if start<480. compute clockst = 1100 + start-420. Else if start<540. compute clockst = 1200 + start-480. Else if start<600. compute clockst = 1300 + start-540. Else if start<660. compute clockst = 1400 + start-600. Else if start<720. compute clockst = 1500 + start-660. Else if start<780. compute clockst = 1600 + start-720. Else if start<840. compute clockst = 1700 + start-780. Else if start<900. compute clockst = 1800 + start-840. Else if start<960. compute clockst = 1900 + start-900. Else if start<1020. compute clockst = 2000 + start-960. Else if start<1080. compute clockst = 2100 + start-1020. Else if start<1140. compute clockst = 2200 + start-1080. Else if start<1200. compute clockst = 2300 + start-1140. Else if start<1260. compute clockst = 0 + start-1200. Else if start<1320. compute clockst = 100 + start-1260. Else if start<1380. compute clockst = 200 + start-1320. Else if start<1440. compute clockst = 300 + start-1380. End if. freq clockst. *check that all diaries contain 1440 minutes. aggregate outfile=* mode=addvariables /break=pid /tottime=sum(time). freq tottime. *they do - good outcome. *reconstruct epnum following addition of new episodes. Do if start=0. compute epnum=1. Else if pid=lag(pid). compute epnum=lag(epnum)+1. End if. freq epnum. compute clockst=clockst/100. freq main. *0.4% 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. *main60(play computer games) could not be created for this survey. *change and change max/sum accordingly. recode 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. *********************** *RECREATE AV VARIABLES* ***********************. *We have to recreate av variables because we inflated the nubmer of episodes *by inserting sec eating/drinking. *At this stage the easiss way is to go through already mapped AHTUSmain to av. *First create AHTUS codes temporarily and then map them to av. *use this if find a problem in activity code before rerunning code. compute mainahtus=-5. freq mainahtus. Do if actcode=500105 or actcode=10401 or actcode=10499 or actcode=10599 or actcode=19999. Compute mainahtus=1. Else if actcode=10101 or actcode=10102. Compute mainahtus=3. Else if actcode=10199. Compute mainahtus=5. Else if actcode=10201 or actcode=10299. Compute mainahtus=6. Else if actcode=10301 or actcode=10399 or actcode=10501. Compute mainahtus=7. Else if actcode=50202. Compute mainahtus=8. 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 mainahtus=9. Else if tewhere~=1 and (actcode=50101 or actcode=50199 or actcode=50205 or actcode=50299 or actcode=59999). Compute mainahtus=10. Else if tewhere=1 and (actcode=50101 or actcode=50199 or actcode=50299 or actcode=59999). Compute mainahtus=11. Else if actcode=50102 or actcode=50301 or actcode=50302 or actcode=50303 or actcode=50304 or actcode=50399 or actcode=50305. Compute mainahtus=12. Else if actcode=50201 or actcode=50203. Compute mainahtus=13. Else if actcode=50103 or actcode=50204 or actcode=50104. Compute mainahtus=14. Else if (actcode>50400 and actcode<50406) or actcode=50499 or actcode=180504. Compute mainahtus=15. Else if actcode=60101 or actcode=60103 or actcode=60104 or actcode=60199. Compute mainahtus=16. Else if actcode=60301 or actcode=60302 or actcode=60303 or actcode=60399. Compute mainahtus=17. Else if actcode=60102 or actcode=60299. Compute mainahtus=18. Else if 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 mainahtus=19. Else if actcode=20201 or actcode=20202. Compute mainahtus=20. Else if actcode=20203 or actcode=20299. Compute mainahtus=21. Else if actcode=20101 or actcode=20301 or actcode=20399 or actcode=20401. Compute mainahtus=22. Else if actcode=20102 or actcode=20103. Compute mainahtus=23. 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 mainahtus=24. Else if actcode=20104 or actcode=20199 or actcode=20901 or actcode=20902 or actcode=20905 or actcode=20999 or actcode=29999. Compute mainahtus=25. Else if actcode=70101 or actcode=70103 or actcode=70104 or actcode=70105 or actcode=90102. Compute mainahtus=26. Else if actcode=70102 or actcode=70199 or actcode=70201 or actcode=70299 or actcode=70301 or actcode=70399 or actcode=79999 or actcode=160104. Compute mainahtus=27. Else if actcode=80501 or actcode=80502 or actcode=80599 or actcode=160105. Compute mainahtus=28. Else if actcode=80401 or actcode=80402 or actcode=80403 or actcode=80499 or actcode=80701 or actcode=80702 or actcode=80799. Compute mainahtus=29. 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. Compute mainahtus=30. Else if actcode=80201 or actcode=80202 or actcode=80203 or actcode=80299 or actcode=100101 or actcode=100102 or actcode=100103 or actcode=100199 or actcode=100301 or actcode=100302 or actcode=100399 or actcode=100401 or actcode=100499 or actcode=109999 or actcode=160108. Compute mainahtus=31. Else if 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. Compute mainahtus=32. 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 mainahtus=33. 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=160107 or actcode=80199. Compute mainahtus=34. Else if actcode=30108. compute mainahtus=34. Else if actcode=30301 or actcode=30302 or actcode=30303 or actcode=30399. Compute mainahtus=35. Else if actcode=30103. Compute mainahtus=36. Else if actcode=30104 or actcode=30107 or actcode=30201 or actcode=30202 or actcode=30203 or actcode=30204 or actcode=30299. Compute mainahtus=37. Else if actcode=30102 or actcode=30106. Compute mainahtus=38. Else if actcode=30110 or actcode=30111 or actcode=30112 or actcode=39999. Compute mainahtus=39. Else if (actcode>30400 and actcode<30406) or actcode=30499 or (actcode>30500 and actcode<30505) or actcode=30599 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 mainahtus=40. 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. Compute mainahtus=41. Else if actcode=100201 or actcode=100299 or actcode=100303. Compute mainahtus=42. Else if (actcode>140100 and actcode<140105) or actcode=149999. Compute mainahtus=49. Else if actcode=120405 or actcode=120499 or actcode=120504. Compute mainahtus=50. Else if (actcode>130200 and actcode<130300) or actcode=130302 or actcode=130399 or actcode=130402 or actcode=130499. Compute mainahtus=51. Else if actcode=120403. Compute mainahtus=52. Else if actcode=120401. Compute mainahtus=53. Else if actcode=120402. Compute mainahtus=54. Else if actcode=110202 or actcode=110101 or actcode=110199 or actcode=120404 or actcode=110299. Compute mainahtus=56. Else if actcode=120201 or actcode=120202 or actcode=120299. Compute mainahtus=57. 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 mainahtus=60. Else if actcode=130131 or (actcode>500000 and tewhere=14). Compute mainahtus=62. Else if actcode=130104. Compute mainahtus=63. Else if actcode=130108. Compute mainahtus=64. Else if actcode=30105 or actcode=40105. Compute mainahtus=65. Else if actcode=130106 or actcode=130112 or actcode=130116 or actcode=130118. Compute mainahtus=66. Else if actcode=20501 or actcode=20599. Compute mainahtus=67. Else if actcode=20601 or actcode=20699. Compute mainahtus=68. Else if actcode=120101 or actcode=120199. Compute mainahtus=72. Else if actcode=120307 or actcode=129999. Compute mainahtus=73. Else if actcode=120313. Compute mainahtus=75. Else if actcode=120309. Compute mainahtus=76. Else if actcode=120310 or actcode=120311. Compute mainahtus=77. Else if actcode=120301 or actcode=120302 or actcode=120399 or actcode=120501 or actcode=120502 or actcode=120503 or actcode=120599. Compute mainahtus=78. Else if actcode=120312. Compute mainahtus=81. Else if actcode=120306. Compute mainahtus=84. Else if actcode=120305. Compute mainahtus=85. Else if actcode=120303 or actcode=120304. Compute mainahtus=86. Else if actcode=20903. Compute mainahtus=87. Else if actcode=160101 or actcode=160102 or actcode=169999 or actcode=160199 or actcode=160201 or actcode=160299. Compute mainahtus=88. Else if actcode=20904 or actcode=120308. Compute mainahtus=89. Else if actcode=500103. Compute mainahtus=90. Else if actcode=180101 or actcode=180199 or (actcode>181100 and actcode< 181200) or actcode=180302 or actcode=180304 or actcode=180305 or (actcode>180400 and actcode<180500). Compute mainahtus=91. Else if actcode=180502. Compute mainahtus=92. Else if actcode=180501 or actcode=180599 or actcode=180503. Compute mainahtus=93. Else if actcode=180601 or actcode=180602 or actcode=180699 or actcode=180603 or actcode=180604. Compute mainahtus=94. Else if (actcode>180200 and actcode<180300) or (actcode>180700 and actcode<180800) or (actcode>180800 and actcode<180900) or (actcode>180900 and actcode<181002) or (actcode>181002 and actcode<181100). Compute mainahtus=95. Else if actcode=180301 or actcode=180303 or actcode=180399. Compute mainahtus=96. Else if (actcode>181400 and actcode<181500) or actcode=181002 or (actcode>181500 and actcode<181600). Compute mainahtus=97. Else if actcode=189999 or (actcode>181200 and actcode<181400) or (actcode>181600 and actcode<181700) or (actcode>181800 and actcode<181900). Compute mainahtus=98. Else if actcode=500101 or actcode=500102 or actcode=500104 or actcode=500106 or actcode=500107 or actcode=509999. Compute mainahtus=-8. end if. freq mainahtus. *any -5 codes will be cases of new codes that were not assigned to *a location. temp. select if mainahtus=-5. freq actcode. *if all ok, this will produce a warning that there are no such case compute av=999. execute. do if mainahtus=8 or mainahtus=10 or mainahtus=13 or mainahtus=14 or mainahtus=15. compute av=1. else if mainahtus=11. compute av=2. else if mainahtus=12. compute av=3. else if mainahtus=16 or mainahtus=18 or mainahtus=19. compute av=4. else if mainahtus=92 or mainahtus=93 or mainahtus=94. compute av=5. else if mainahtus=20 or mainahtus=21. compute av=6. else if mainahtus=22 or mainahtus=23. compute av=7. else if mainahtus=24 or mainahtus=25 or mainahtus=40 or mainahtus=68. compute av=8. else if mainahtus=67. compute av=9. else if mainahtus=26 or mainahtus=27 or mainahtus=30 or mainahtus=31. compute av=10. else if mainahtus=65 or (mainahtus>32 and mainahtus<40). compute av=11. else if mainahtus=91 or (mainahtus>94 and mainahtus<98). compute av=12. else if mainahtus=1 or mainahtus=2 or mainahtus=6. compute av=13. else if mainahtus=7 or mainahtus=28 or mainahtus=29 or mainahtus=32. compute av=14. else if mainahtus=9 and eloc~=6. compute av=15. else if mainahtus=3 or mainahtus=4 or mainahtus=5. compute av=16. else if mainahtus=90 or mainahtus=98. compute av=17. else if mainahtus=50 or mainahtus=54 or mainahtus=55 or mainahtus=64. compute av=18. else if mainahtus=60 or mainahtus=63 or mainahtus=66. compute av=19. else if mainahtus=51. compute av=20. else if mainahtus=62. compute av=21. else if mainahtus=49. compute av=22. else if (mainahtus>40 and mainahtus<47) or mainahtus=48. compute av=23. else if mainahtus=52 or mainahtus=53. compute av=24. else if mainahtus=57. compute av=25. else if mainahtus=56 or (mainahtus=9 and eloc=6). compute av=28. else if (mainahtus=71 or mainahtus=72) and eloc>1. compute av=29. else if mainahtus=85. compute av=30. else if mainahtus=86. compute av=31. else if mainahtus=84. compute av=32. else if mainahtus=17 or mainahtus=89. compute av=33. else if mainahtus=81. compute av=34. else if mainahtus=82 or mainahtus=83. compute av=35. else if mainahtus=70 or mainahtus=78. compute av=36. else if mainahtus=88. compute av=37. else if (mainahtus=71 or mainahtus=72) and eloc<2. compute av=38. else if mainahtus=76. compute av=39. else if mainahtus=73 or mainahtus=74 or mainahtus=75 or mainahtus=77 or mainahtus=87. compute av=40. else if mainahtus=-8 or mainahtus=58. compute av=41. end if. variable labels av "mainahtus 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. compute pid=persid. sort cases by persid epnum. save outfile ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/mid5.sav'. get file '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/mid5.sav'. *These files include both adult and child diarists. compute countrya = 38. compute survey = 2003. compute swave = 0. compute msamp = 0. compute diary = 1. compute hldid=hhid. compute id = 1. execute. sort cases by survey swave persid epnum. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W60av.sav' /keep countrya survey swave msamp hldid persid id epnum av. aggregate /OUTFILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58main.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 = SUM(main45) /main46 = SUM(main46) /main47 = SUM(main47) /main48 = SUM(main48) /main49 = SUM(main49) /main50 = SUM(main50) /main51 = SUM(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). sort cases by persid epnum. Save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W60main.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58main.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 main59) + sum(main61 to main69). freq t. sort cases by persid. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58main.sav' /drop total t. ***************************************** *create badcase variable for ADULTS only* *****************************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006hfep.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="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/usa06quest.sav" /by hhid pid. execute. compute baddiary=0. execute. if tmiss>90 or epnum<7 or misbasic>1 baddiary=1. freq baddiary. *410 - 3.4% bad diaries.-11790 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. *11790 (96.7%) of diaries of quality; * 1 diaries bad on all three criteria * 30 diaries bad on 2 criteria *30 6 or fewer episodes and missing 2+ basic acts *0 6 or fewer episodes and missing 91+ minutes *0 missing 2+ basic acts and missing 91+ minutes * 379 bad on 1 criteria * 294 missing 91+ minutes, * 68 have 6 or fewer episodes, * 17 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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusresp_2006.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/occup.sav' /keep persid occup. ********* *agekid2* *********. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atusrost_2006.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 youngd: 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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 one case coded as -3. temp. select if agekid2=-3. freq persid. *20060201060073 Checked this case visually in roster and cps files. *In roster there are six people reported to live in thouse all refused to report their age, *with the exception of the first two. These two respondents reported only 2 people living in the *household in CPS file. So CPS as a reference, and code as not applicable. If agekid2=-3 agekid2=-7. fre agekid2. *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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/atuscps_2006.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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. cro trohhch by trhhchld TRCHLDNM TRYHHCHD. *In 48 cases number of own hhold child is bigger than presence *of own hhold children. 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 cases from roster file: *20060112052064 16 year old mother of a three year old. Living with her parents. *20060201062533 17 year old mmother of a 0 year old and arried to 21 year old male *20060807060039 17 year old mother of a 3 year old living with a sibling. *20060908061800 17 year old mother of a 2 year old living with her parents. *20061008061624 17 year old mother of a 0 year old living with her family. *In roster file 20060807062494 is a 36 year old mother of 5 children. *In CPS file the age is stated as 15, must be a mistake. temp. select if persid=20060807062494. freq all. *code it as 36 year old. If persid=20060807062494 prtage=36. *This file will also be used to create citizen and sector variables. sort cases by persid. save outfile ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/own18.sav' /keep persid own18 age prcitshp prcowpg. *adult file. get file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/own18.sav'. select if age>17. execute. freq age. sort cases by persid. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/own18ad.sav' /keep persid own18 prcitshp prcowpg. **************************** *other background variables* ****************************. Get File='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files\usa06quest.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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. ******* *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. ********* *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. ********* *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 '/Volumes/FreeAgent GoFlex Drive/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra1.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra2.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/partid.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/occup.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/badcase.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/nu5e.sav' /by persid. execute. select if age>17. execute. *this filters out the young diarists. apply dictionary from '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/MTUSW58schema.sav'. ******* *empsp* *******. freq empsp. cro empsp by partid civstat. cro empsp by relrefp. *50 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 50 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". *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. ******* *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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/backtemp.sav'. ******** *health* ********. *We can extract health variable from 2006, 2007 and 2008 E&H supplement. get file= '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/EH/ehresp_2006.sav' /keep tucaseid eugenhth. rename variables (tucaseid=persid). execute. compute health= -9. Do if eugenhth=-2 or eugenhth=-3. compute health=-8. Else if eugenhth=5. compute health=0. Else if eugenhth=4. compute health=1. Else if eugenhth= 3. compute health=2. Else if eugenhth=1 or eugenhth=2. compute health=3. End if. var label health "diarist's general health". val label health -9 question not asked -8 missing 0 poor 1 fair 2 good 3 very good. cro eugenhth by health. freq health. sort cases by persid. save outfile '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/health.sav'. get file='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/backtemp.sav'. sort cases by persid. match files files=* files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/health.sav' /by persid /drop eugenhth. execute. select if age>17. *This will remove child diarists. cro age by health. *There are 48 system missings in the health variable. recode health (sysmis=-8). freq health. ******************************************************** *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. cro famstat by test by hhtype. *There are 401 people who live with their parents but coded as other hhold types. *They should be coded as hhtype=3 (married/cohabiting couple + others). *And 2 coded as married couple alone. Since those respondents actually live their parents *Those six married couple alone cases 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 29 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. *In 13 cases the hhtypeo is other althoug hhold size is 1. *Visually examined those cases in CPS and respondent files. *20060101061080,20060112050069,20060112050639,20060201061460 *20060301062556,20060302060077,20060302061862,20060303060036 *20060402061524,20060403061946,20060403062035,20060403062404 *20060504060117,20060504061250,20060604062105,20060605061026 *20060706060910,20060706061624,20060707061351,20060707061869 *20060807060859,20060908061869,20060909061332,20061008061647 *20061008062239,20061009062446,20061110061496,20061111061945 *20061211060641. *The confusion stems from the change of information between CPS *and respondent files. In CPS the hhold type is either husband/wife primary *family or group quarters without family, *but in the respondent file they don't report any spouse. *The respondent files is the more recent one. Recode these cases as hhtype1. If hhldsize=1 and hhtype=4 hhtype=1. cro hhldsize by hhtype. cro under18 by hhtype by hhldsize. *Examine in detail to check whether there is any inconsistencies. cro hhtype by hhldsize. *Also in some surveys there are cases where number of children under18 *+ number of couple (2 individuals) is more than hholdsize. *This is not the case in 2006. compute test=under18+1. cro test by under18. 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. ************ *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 codong/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. *Diarists with relref 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 16 cases do not match this condition. *hhtype=2 should correspond with relrefp values of 1 and 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. They are reported as being a *single person house. Change the relrefp. 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. *checked roster and resp files too. All those cases are couple only hholds. *Only 20061211062317 reported to have an own non hhold child at the age of 13 *in roster file. But in respondent file the diarist reports no child. *So, we ll code this as couple only hhold. temp. select if persid=20061211062317. 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. 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. 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)*. 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. *They are all single parents living with their parents so hhold code is correct. 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. 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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backadult.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006youthep.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 '/Volumes/FreeAgent GoFlex Drive/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553child.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58avchild.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). ***************************************** *create badcase variable for CHILD files* *****************************************. GET FILE='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006youthep.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="/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/usa06questch.sav" /by hhid pid. execute. compute baddiary=0. execute. if tmiss>90 or epnum<7 or misbasic>1 baddiary=1. freq baddiary. *16 - 2.2% bad diaries.-727 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. *727 (98.1%) of diaries of quality; * none of the diaries is bad on all three criteria * 1 diary bad on 2 criteria (6 or fewer episodes and 12 missing 2+ basic acts) * 15 bad on 1 criteria * 11 missing 91+ minutes, * 3 have 6 or fewer episodes, * 1 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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/own18.sav'. select if age<18. execute. freq age. sort cases by persid. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/own18kid.sav' /keep persid own18 prcowpg prcitshp. get file='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/usa06questch.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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 '/Volumes/FreeAgent GoFlex Drive/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra1.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/extra2.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/partid.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/occup.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/badcasech.sav' files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/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 one 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. *visually checked this case in resp and roster file, and the diarist is coded as living *with parents and siblings not spouse. change the relrefp to child. If persid=20060807061941 relrefp=3. cro relrefp by empsp. ******** *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. *There is one exception: 20060112050723. Checked this case in roster file: *this person lives with her unmarried partner and her parents. If persid=20060112050723 cphome=0. *famstat=5 (child <18 in other arrangement)should always map to cphome=0. *(not a child living with parents or guardian). ******** *partid* ********. freq partid. cro partid by civstat empsp. *There is one case where there is a partner id but the *respondent also reported to be single with no value for empsp. *Visually check this case below. temp. select if partid>0 and civstat=2. freq persid. temp. select if persid=20060503061180. cro persid by parntid1 parntid2. *Visually examined this case in roster, respondent and CPS files. *20050101051250 is 15 year old female who is reported to have 38 year oldfe male as a spouse in roster file. *That person is coded as her mother in CPS, which is more plausible *We Code this young mawon as single (civstat=2 cohab=-7), living with one parent (cphome=1). If persid=20060503061180 civstat=2. If persid=20060503061180 cohab=-7. If persid=20060503061180 cphome=1. If persid=20060503061180 empsp=-7. If persid=20060503061180 hhtype=4. If persid=20060503061180 partid=-7. cro cphome by civstat. temp. select if cphome=0. cro persid by relrefp. temp. select if cphome=0 and civstat=2. freq persid parntid1 parntid2. *Visually examined these 30 cases. In roster file:. **************************************************************** select if tucaseid=20060111051391 or tucaseid=20060112051529 or tucaseid=20060112051715 or tucaseid=20060201060028 or tucaseid=20060201061630 or tucaseid=20060403061034 or tucaseid=20060404061614 or tucaseid=20060503060599 or tucaseid=20060503061679 or tucaseid=20060504060714 or tucaseid=20060504060918 or tucaseid=20060504061373 or tucaseid=20060504062014 or tucaseid=20060504062528 or tucaseid=20060603060962 or tucaseid=20060706060983 or tucaseid=20060806060661 or tucaseid=20060806062458 or tucaseid=20060807060039 or tucaseid=20060807061125 or tucaseid=20060807061589 or tucaseid=20060807061806 or tucaseid=20060807062531 or tucaseid=20060907060880 or tucaseid=20060908061709 or tucaseid=20060909061421 or tucaseid=20061008062488 or tucaseid=20061110061424 or tucaseid=20061210061455 or tucaseid=20061211061480. *execute. ******************************************************************. *20060201060028 is a 16 year old living with 17 old sibling. *20060807060039 is a 17 year old living with a 16 year old brother and 3 year old young child. *20060504062014 is a 15 year old living with other 10 people the rel unknown. *In other cases another relative older than 18 years old living with the diarist. *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 (persid~=20060112051529 and persid~=20060504062528 and persid~=20060201060028 and persid~=20060807060039 and persid~=20060504062014) cphome=1. *20060503061679 16 year old foster child. temp. select if persid=20060503061679. freq all. cro civstat by cphome. cro cphome by famstat. temp. select if famstat=5 and cphome=1. freq all. *20060201062533 is a 17 year old living with her 21 year old spouse and child. *no parents at home so code him as cphome=0. IF persid=20060201062533 cphome=0. 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. *20060112050723 is a 15 year old living with her 20 year old unmarried *partner in a parental house. WE will code her as cphome=0. If persid=20060112050723 cphome=0. ********* *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 '/Volumes/FreeAgent GoFlex Drive/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* ********. match files files=* files='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/tempb/health.sav' /by persid /drop eugenhth. execute. select if age<18. *This will filter out adult diarists. cro age by health. *There are 4 system missings in the health variable. recode health (sysmis=-8). freq health. ******* *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. 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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backchild.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 = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553adult.sav'. add files /file=* /file='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553child.sav'. execute. apply dictionary from '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/MTUSW553schema.sav'. sort cases by persid. *weight tests*. means table=propwt. compute test=sum(propwt). desc test. **mean of weight is precisely 1. *and it correctly sums up to 12943. save outfile = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553.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 = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backadult.sav'. add files files=* file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backchild.sav'. execute. apply dictionary from '/Volumes/FreeAgent GoFlex Drive/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backall.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 ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W553.sav'. sort cases by persid. match files files=* file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backall.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. freq edcat. means propwt /cells min max mean. *mean of propwt is correctly equal to 1. weight by propwt. freq badcase day sex age. ***************************** **Save USA 2006 Version 5.53* *****************************. apply dictionary from '/Volumes/FreeAgent GoFlex Drive/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006W553.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 ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58avadult.sav'. add files files=* file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58avchild.sav'. execute. sort cases by persid. *combine it with the file that has "main" variables. match files files=* file ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58main.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 ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backall.sav'/by persid. execute. apply dictionary from '/Users/evrim/Dropbox/CTUR/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='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58all.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. *main10, 60 could not be created for this survey. compute testmain=SUM(main1 to main59) + SUM (main61 to main69). freq testmain. *correctly sums to 1440 for all cases. cro empsp by civstat. freq edcat. 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. *mean of propwt is correctly equal to 1. weight by propwt. freq badcase day sex age. ************************************** *Save USA 2006 Version 5.8 adult file* **************************************. weight off. select if age>17. sort cases by swave msamp hldid persid id. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006W58.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 2006 Version 5.8 child file* **************************************. get file='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W58all.sav'. weight off. select if age<18. sort cases by swave msamp hldid persid id. save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006W58kid.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* ********************. *********** *main file* ***********. *main file includes both adult and child data. *combine it with av file. get file = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W60main.sav'. desc all. sort cases by persid epnum. apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw60schema.sav'. match files files=* /file = '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006W60av.sav' /by persid epnum. freq survey. ******************************************* *add badcase variable and divide the files* *******************************************. match files /files=* /table ='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/USA2006backall.sav' /by persid. freq survey. apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw60schema.sav'. sort cases by swave msamp hldid persid id epnum. save outfile= '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/usa2006W60all.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 2006 Version 6.0 adult file* **************************************. get file= '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/usa2006W60all.sav'. weight off. select if age>17. sort cases by swave msamp hldid persid id epnum. Save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006W6.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 2006 Version 6.0 child file* **************************************. get file= '/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/usa2006W60all.sav'. weight off. select if age<18. sort cases by swave msamp hldid persid id epnum. Save outfile='/Volumes/FreeAgent GoFlex Drive/evrim/AHTUS/2006/Harmonised Files/USA2006W6kid.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 2006 (ATUS) ** *******************************************************.