************************************************************ **Syntax producing the USA heritage time use files 1994-95** **written by Roger Patulny, SPRC, Univ of New South Wales ** **Australia, 20 January 2005 ** **Upgraded by Kimberly Fisher, CTUR, University of Oxford ** **United Kingdom, 10 December 2009 ** ************************************************************. GET FILE='C:\Documents and Settings\All Users\Documents\time-use-library\USA\1995\main95.sav' /keep respid day rsex date p1 area hhwt adwt. freq p1. desc hhwt adwt. recode area (41=40)(42=41)(43=42)(44=43)(45=44) (46=45)(47=46)(49=47)(50=48)(51=49)(52=50) (53=51) (else=copy) into state. val lab state -9 data not available 1 ALABAMA 2 ALASKA 3 ARIZONA 4 ARKANSAS 5 CALIFORNIA 6 COLORADO 7 CONNECTICUT 8 DELAWARE 9 DISTRICT OF COLUMBIA 10 FLORIDA 11 GEORGIA 12 HAWAII 13 IDAHO 14 ILLINOIS 15 INDIANA 16 IOWA 17 KANSAS 18 KENTUCKY 19 LOUISIANA 20 MAINE 21 MARYLAND 22 MASSACHUSETTS 23 MICHIGAN 24 MINNESOTA 25 MISSISSIPPI 26 MISSOURI 27 MONTANA 28 NEBRASKA 29 NEVADA 30 NEW HAMPSHIRE 31 NEW JERSEY 32 NEW MEXICO 33 NEW YORK 34 NORTH CAROLINA 35 NORTH DAKOTA 36 OHIO 37 OKLAHOMA 38 OREGON 39 PENNSYLVANIA 40 RHODE ISLAND 41 SOUTH CAROLINA 42 SOUTH DAKOTA 43 TENNESSEE 44 TEXAS 45 UTAH 46 VERMONT 47 VIRGINIA 48 WASHINGTON 49 WEST VIRGINIA 50 WISCONSIN 51 WYOMING. temp. select if state<21. cro area by state. temp. select if state>20 and state<31. cro area by state. temp. select if state>30 and state<41. cro area by state. temp. select if state>40. cro area by state. compute exclude=0. if any (state,2,8,12,13,17,27,29,30,32,35,40,46,51) exclude=1. var lab exclude states to exclude in xtimewt. val lab exclude 0 states in all samples 1 states only in most recent samples. cro exclude by state. sort cases by respid. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995addsex.sav' /drop area. GET FILE='C:\Documents and Settings\All Users\Documents\time-use-library\USA\1995\diary95.sav'. missing values all (). *this dataset does not contain a code for eating at work, only for eating. The next steps *create a variable for whether the respondent was at work on the diary day, if the diarist *is away from home working, and then eats, the code for eating at work can be contructed. compute atwkd=0. If actcode=1 or actcode=5 or actcode=8 atwkd=1. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=respid /atwrkdd 'at work on diary day'= MAX(atwkd). freq atwrkdd. *this step adds in the sex of the respondent for initial *data checks and also adds in the new at work on the diary *day variable. match files files=* table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995addsex.sav' /BY respid. execute. freq end start. rename variables (start=clockst). *start time range 0:00 to 23:59; end range 0:01 to 24:00. *create start and end minute variables in minute order of the day. sort cases by respid clockst. *there are 51 diaries (55 episodes) with problems in the start and end time variables. Fix these. compute test=0. if respid=lag(respid) and clockst~=lag(end) test=1. freq test. if respid=4914 and clockst=0 end=40. if respid=4914 and end=2200 clockst=2110. if respid=6216 and clockst=1200 end=1230. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 8907 end of diary missing an episode, add a final episode of sleep* *************************************************************************. if respid=9010 and end=2100 clockst=2030. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 9806 middle of day missing an episode, unknown away from home (0) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 9809 end of day missing an episode, unknown away from home (0) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 10208 middle of day missing an episode, general housework (19) * *************************************************************************. if respid=10611 and end=710 clockst=635. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 10706 middle of day missing an episode, walking (49-306) * *************************************************************************. if respid=10904 and end=635 clockst=620. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 10906 middle of day missing an episode, driving (79-301) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 11107 middle of day missing an episode,unknown away from home (0) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 11107 middle of day missing an episode,unknown away from home (0) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 11210 middle of day missing an episode, shopping (31/404) * *************************************************************************. if respid=20402 and clockst=1115 end=1315. if respid=20603 and clockst=1405 end=1540. if respid=22005 and clockst=900 end=1200. if respid=22553 and end=2100 clockst=2000. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 24407 middle of day missing an episode, travel (69/301) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 24466 middle of day missing an episode,unknown away from home (0) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 24656 morning missing an episode, personal care at home (40/105) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 24703 middle of day missing an episode, travel (39/301) * *************************************************************************. if respid=24866 and clockst=630 end=900. if respid=24911 and end=2145 clockst=2105. if respid=25113 and end=2400 clockst=2010. if respid=25207 and clockst=2030 end=2200. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 25215 two night travel episodes missing (49/306) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 25406 day travel episode missing (39/302) * *************************************************************************. if respid=25406 and end=2100 clockst=945. if respid=25412 and clockst=1500 end=1700. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 25605 day shopping episode missing (31/404) * *************************************************************************. if respid=25605 and end=1905 where=301. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 26202 middle of day missing an episode,unknown away from home (0) * *************************************************************************. if respid=26407 and clockst=1120 end=1500. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 27002 middle of day missing an episode,unknown away from home (0) * *************************************************************************. if respid=27004 and end=2020 clockst=2000. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 27205 middle of day missing an episode, travel (79/300) * *************************************************************************. if respid=27606 and end=2300 clockst=2045. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 27805 middle of day missing an episode, travel (79/300) * *************************************************************************. if respid=27905 and clockst=1525 end=1601. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 27951 middle of day missing an episode, travel (47/416) * *************************************************************************. if respid=28050 and clockst=845 end=1015. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 28205 two night travel episodes missing (68/520 69/301) * *************************************************************************. if respid=28392 and clockst=550 end=620. if respid=28606 and clockst=2030 end=2130. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 29004 two night travel episodes missing (68/520 69/301) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 29056 middle of day shopping episode missing (31/403) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 29402 middle of day shopping travel episode missing (39/301) * *************************************************************************. if respid=30403 and clockst=945 end=1345. if respid=30953 and end=800 clockst=720. if respid=30953 and end=1940 clockst=1910. if respid=30953 and end=2200 clockst=1940. if respid=31213 and end=1815 clockst=1800. execute. ************************************************************************* *MANUAL ACTION REQUIRED * *case 31603 evening personal care episode missing (47/105) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 32104 morning housework episode missing (12/100) * *************************************************************************. ************************************************************************* *MANUAL ACTION REQUIRED * *case 34252 middle of day shopping travel episode missing (39/301) * *************************************************************************. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995interim.sav'. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995interim.sav'. missing values all (). Compute start=trunc(clockst/100)*60+(clockst-(trunc(clockst/100))*100). Compute end2=trunc(end/100)*60+(end-(trunc(end/100))*100). Execute. temp. select if clockst>60 and clockst<180. cro clockst by start. temp. select if end>60 and end<180. cro end by end2. desc end2 start. compute epnum=1. Do If $casenum>1 and respid=lag(respid). compute epnum=lag(epnum)+1. end if. var lab epnum episode number. freq epnum. recode day (1=2) (2=3) (3=4) (4=5) (5=6) (6=7) (7=1) INTO diaryday. compute month=trunc(date/10000). compute year=(date-trunc(date/100)*100)+1900. compute wave=1. compute survey=5. compute hhid=respid. compute cday=trunc(date/100) - trunc(date/10000)*100. freq month diaryday cday year. *the 1996 value is an error in one episode in the same diary. recode year (1996=1995). *check for related year inconsistencies. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=respid /minyear = MIN(year) /maxyear=MAX(year). cro minyear by maxyear. *fortunately this case was the only error. *Convert var p1 - year of birth, into age. Do if p1<88 and year=1995. compute age=95-p1. Else if p1<88 and year=1994. compute age=94-p1. Else. compute age=-8. End if. rename variables (respid rsex=pid sex). freq sex age. *create duration variable. compute time=end2-start. var lab time duration of activity in minutes. desc time. *freq dist of activities when walking. temp. select if where=306. freq actcode. *create time use variables. compute main=-5. compute sec=-9. compute inout=-5. compute eloc=-5. compute mtrav=-7. compute alone=-9. compute infant=0. compute child=0. compute sppart=-9. compute clsfam=-9. compute hhadult=-9. compute animal=0. compute shoprof=0. compute cowork=-9. compute wellknw=0. compute otherp=0. compute unknwp=-9. compute athom=-5. apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\History of harmonisation - Diary\schema\schema1.sav'. cro day by diaryday. *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, and residual set to -8. Do if where=111 or where=112 or where=114 or where=211 or where=212 or where=214 or where=307 or where=313 or where>499 or actcode=13 or actcode=25 or actcode=81 or ((actcode=3 or actcode=9 or actcode=29 or actcode=39 or actcode=49 or actcode=59 or actcode=69 or actcode=79 or actcode=89 or actcode=99) and (where>305 and where<309) ). compute inout=1. Else if (where>300 and where<306) or (where>309 and where<313) or ((actcode=3 or actcode=9 or actcode=29 or actcode=39 or actcode=49 or actcode=59 or actcode=69 or actcode=79 or actcode=89 or actcode=99) and where~=313 and where~=314). compute inout=3. Else if (where>100 and where<109) or where=110 or where=113 or (where>200 and where<209) or where=210 or where=213 or where=314 or (where>399 and where<412) or (where>412 and where<421) or where=499 or actcode=12 or actcode=24. compute inout=2. Else. compute inout=-8. End if. freq inout. temp. select if inout=1. freq actcode where. *some apparent location and activity conflicts, but these left without adjustment. temp. select if inout=2. freq actcode where. temp. select if inout=3. freq actcode where. *note also a number of cases where location is listed as in a vehicle and the *activity is something that one would not typically perform inside a vehicle, but *these conflicts also left unchanged. temp. select if inout=-8. freq actcode where. Do If where>99 and where<200. compute eloc=1. Else If where>199 and where<300. compute eloc=2. Else If where=413. compute eloc=4. Else If where=412 or where=402 or where=504 or actcode=1. compute eloc=3. Else If where>299 and where<400. compute eloc=8. Else If where=415. compute eloc=7. Else If where=405 or where=414 or where=510. compute eloc=6. Else If actcode>1 and actcode<9. compute eloc=3. Else if where=401 or where=403 or where=404 or (where>405 and where<412) or where=417 or where=418 or where=503. compute eloc=5. Else. compute eloc=9. End if. cro where by eloc. If actcode=20 infant=1. If (actcode>19 and actcode<28) child=1. If actcode=18 animal=1. If ((actcode>29 and actcode<38) and where>299) shoprof=1. If (actcode>69 and actcode<75) or actcode=77 shoprof=1. If actcode=41 or actcode=42 or actcode=63 or actcode=75 or actcode=76 wellknw=1. If actcode=50 or actcode=51 or (actcode>59 and actcode<69) or actcode=75 or actcode=76 or actcode=77 or actcode=78 otherp=1. freq infant child animal shoprof wellknw otherp. *check if walking and cycling can be coded as activities. temp. select if where=306 or where=307. freq actcode. *a limited amount of secondary walking can be coded. *code main activities. compute residual=0. Do if actcode=48. Compute main=1. Else if actcode=45. Compute main=3. Else if actcode=40 or actcode=44 or actcode=47. Compute main=6. Else if actcode=41. Compute main=7. Else if actcode=43 and atwrkdd=1 and (where=401 or where=402 or where=412). Compute main=8. Else if actcode=43. Compute main=9. Else if actcode=1 and where>199. Compute main=10. Else if actcode=1 and where<200. Compute main=11. Else if actcode=5. Compute main=12. Else if actcode=8. Compute main=13. Else if (actcode~=3 and actcode~=9 and (actcode<31 or actcode>39)) and atwrkdd=1 and (where=401 or where=402 or where=412). Compute main=14. Else if actcode=2. Compute main=15. Else if actcode=50. Compute main=16. Else if actcode=54. Compute main=17. Else if actcode=51. Compute main=18. Else if actcode=55 or actcode=52. Compute main=19. Else if actcode=10. Compute main=20. Else if actcode=11. Compute main=21. Else if actcode=12 or actcode=13. Compute main=22. Else if actcode=14. Compute main=23. Else if actcode=15 or actcode=16. Compute main=24. Else if actcode=19 or actcode=38. Compute main=25. Else if actcode=30. Compute main=26. Else if actcode=31. Compute main=27. Else if actcode=32. Compute main=28. Else if actcode=33. Compute main=29. Else if actcode=28 or actcode=35 or actcode=36. Compute main=30. Else if actcode=34. Compute main=31. Else if actcode=37. Compute main=32. Else if actcode=20. Compute main=33. Else if actcode=21. Compute main=34. Else if actcode=26. Compute main=35. Else if actcode=24. Compute main=36. Else if actcode=22. Compute main=37. Else if actcode=23. Compute main=38. Else if actcode=27. Compute main=39. Else if actcode=42. Compute main=40. Else if actcode=63. Compute main=41. Else if actcode=62. Compute main=42. Else if actcode=60. Compute main=43. Else if actcode=67. Compute main=44. Else if actcode=66. Compute main=45. Else if actcode=61 or actcode=68. Compute main=46. Else if actcode=64. Compute main=48. Else if actcode=65. Compute main=49. Else if actcode=70. Compute main=51. Else if actcode=72. Compute main=52. Else if actcode=73. Compute main=53. Else if actcode=74. Compute main=54. Else if actcode=71. Compute main=55. Else if actcode=77. Compute main=56. Else if actcode=76 or actcode=78. Compute main=57. Else if actcode=80 or actcode=82. Compute main=60. Else if (actcode~=3 and actcode~=9 and actcode~=29 and actcode~=39 and actcode~=49 and actcode~=59 and actcode~=69 and actcode~=79 and actcode~=89 and actcode~=99 and actcode~=18) and where=306. Compute main=62. Else if (actcode~=3 and actcode~=9 and actcode~=29 and actcode~=39 and actcode~=49 and actcode~=59 and actcode~=69 and actcode~=79 and actcode~=89 and actcode~=99) and where=307. Compute main=63. Else if actcode=81. Compute main=64. Else if actcode=25. Compute main=65. Else if actcode=17. Compute main=67. Else if actcode=18. Compute main=68. Else if actcode=75. Compute main=72. Else if actcode=87. Compute main=73. Else if actcode=86. Compute main=74. Else if actcode=85. Compute main=75. Else if actcode=84. Compute main=76. Else if actcode=83. Compute main=77. Else if actcode=98. Compute main=78. Else if actcode=93. Compute main=81. Else if actcode=94. Compute main=82. Else if actcode=95. Compute main=83. Else if actcode=92. Compute main=84. Else if actcode=90. Compute main=85. Else if actcode=91. Compute main=86. Else if actcode=97. Compute main=87. Else if actcode=96. Compute main=88. Else if actcode=88 or actcode=56 or actcode=57 or actcode=58. Compute main=89. Else if actcode=49. Compute main=91. Else if actcode=3. Compute main=92. Else if actcode=9. Compute main=93. Else if actcode=59. Compute main=94. Else if actcode=39. Compute main=95. Else if actcode=29. Compute main=96. Else if actcode=69. Compute main=97. Else if actcode=79 or actcode=89 or actcode=99. Compute main=98. Else if actcode=0. Compute main=58. Else. compute residual=actcode. End if. *make a marker of pcgames to for the MTUS files. compute pcgame=0. if actcode=57 pcgame=1. freq main residual pcgame. *only one case of pc games reported. temp. select if main<15. cro actcode by main. temp. select if main>14 and main<28. cro actcode by main. temp. select if main>27 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<70. cro actcode by main. temp. select if main>69 and main<84. cro actcode by main. temp. select if main>83. cro actcode by main. Do if where<200. compute athom=1. Else if where>199 or (actcode=50 or (actcode>31 and actcode<36) or actcode=50 or actcode=55 or actcode=70 or actcode=73 or actcode=74 or actcode=77). compute athom=0. Else. compute athom=-8. end if. freq athom. cro where by athom. sort cases by pid. compute bf=0. compute eat=0. if main=20 or main=21 or main=56 bf=1. if main=8 or main=9 eat=1. compute mt=0. compute prevloc=-7. if epnum>1 prevloc=lag(eloc). cro eloc by prevloc. if ((eloc=1 or eloc=2) and (prevloc>2 and prevloc<8)) or ((eloc>2 and eloc<8) and (prevloc=1 or prevloc=2)) sec=90. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=pid /byfood 'worked with food'= MAX(bf) /ate=max(eat). cro byfood by ate. If byfood=1 and ate=0 sec=2. Do If where>300 and where<305. compute mtrav=1. Else If where=305 or (where>309 and where<313). compute mtrav=2. Else If where=306 or where=308. compute mtrav=3. Else If where=307. compute mtrav=4. Else If where=300 or where=320 or where=399. compute mtrav=5. Else if ((main>89 and main<99) or sec=90) and mtrav=-7. compute mtrav=5. end if. freq mtrav. cro where by mtrav. if main<90 and mtrav=3 sec=62. if main<90 and mtrav=4 sec=63. freq sec. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfep.SAV' /KEEP survey wave hhid pid diaryday cday month year time clockst start end2 epnum main sec inout eloc mtrav alone infant child sppart clsfam hhadult animal shoprof cowork wellknw otherp unknwp athom sex age state exclude hhwt adwt. Get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfep.SAV'. *note that as no missing time left in the 1994-95 data file, the *missing time variables are include simply to hold the place *of this variable for comparison with later files. Compute t0pcare=0. Compute t1paidw=0. Compute t2ed=0. compute t3unpaid=0. compute t4acvol=0. compute t5outhm=0. compute t6exerc=0. compute t7inhm=0. compute t8media=0. compute t9trav=0. compute tmiss=0. compute eatdr=0. compute sleep=0. compute perscare=0. compute ccare=0. compute acare=0. compute petcare=0. compute outside=0. compute inveh=0. compute inside=0. compute athome=0. compute atwrksc=0. compute elsewhr=0. compute locunk=0. compute walone=-9. compute wchild=0. compute wsppart=-9. compute wclsfam=-9. compute wother=0. compute withunk=-9. If main>-1 and main<10 t0pcare =time. If main>9 and main<16 t1paidw =time. If main>15 and main<20 t2ed =time. If main>19 and main<40 t3unpaid =time. If main>39 and main<50 t4acvol =time. If main>49 and main<60 t5outhm =time. If main>59 and main<70 t6exerc =time. If main>69 and main<80 t7inhm =time. If main>79 and main<90 t8media =time. If main>89 and main<100 t9trav =time. If main=8 or main=9 or main=20 or main=21 or main=56 or sec=2 eatdr=time. If main=3 or main=4 or main=5 or main=78 sleep=time. If main=1 or main=2 or main=6 or main=7 or main=28 or main=29 or main=91 perscare=time. If main>32 and main<40 ccare =time. If main=40 acare =time. If inout=1 outside =time. if inout=2 inside =time. if inout=3 inveh =time. if eloc=1 athome =time. if eloc=3 or eloc=4 atwrksc =time. if eloc=2 or eloc>4 elsewhr =time. If eloc=-8 locunk =time. If child=1 wchild =time. If shoprof=1 or otherp=1 or wellknw=1 wother=time. Compute tcare=acare+ccare + petcare. var lab tcare total care time. desc t0pcare t1paidw t2ed t3unpaid t4acvol t5outhm t6exerc t7inhm t8media t9trav eatdr sleep perscare ccare acare petcare tcare tmiss outside inside inveh athome atwrksc elsewhr locunk walone wchild wsppart wclsfam wother withunk. AGGREGATE /OUTFILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995testag.SAV' /BREAK=pid /tottime 'total minutes recorded' = SUM(time) /misstime=SUM(tmiss) /numep "# episodes in original data"=MAX(epnum) /t0pcare = SUM(t0pcare) /t1paid = SUM(t1paidw) /t2ed = SUM(t2ed) /t3unpaid = SUM(t3unpaid) /t4acvol = SUM(t4acvol) /t5outhm = SUM(t5outhm) /t6exerc = SUM(t6exerc) /t7inhm = SUM(t7inhm) /t8media = SUM(t8media) /t9trav = SUM(t9trav) /eatdr = SUM(eatdr) /sleep = SUM(sleep) /perscare = SUM(perscare) /ccare = SUM(ccare) /acare = SUM(acare) /petcare = SUM(petcare) /tcare = SUM(tcare) /day = MAX(diaryday) /sex = MAX(sex) /age=max(age) /imptrav=max(sec) /state=MAX(state) /exclude=MAX(exclude) /athome=sum(athome) /hhwt=MAX(hhwt) /adwt=MAX(adwt). vector tmain(98) tsc(98). Do repeat a=tmain1 to tmain98 /b=tsc1 to tsc98 /i=1 to 98. compute a=0. compute b=-9. If main=i a=time. End repeat. compute t1dig = SUM(t0pcare to tmiss). compute t2dig = SUM (tmain1 to tmain98). compute t2dig = t2dig + tmiss. *set all variable codes which could not be constructed to -9 for missing. recode tmain2 tmain4 tmain5 tmain18 tmain43 tmain50 tmain62 tmain63 tmain66 tmain70 tmain71 tmain75 (0=-9). AGGREGATE /OUTFILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfsum.sav' /BREAK=survey wave hhid pid /diaryday = MAX(diaryday) /cday = MAX(cday) /month = MAX(month) /year = MAX(year) /tottime "total minutes recorded in diary" = SUM(time) /numep 'total original episodes recorded' = MAX(epnum) /t0pcare = SUM(t0pcare) /t1paid = SUM(t1paidw) /t2ed = SUM(t2ed) /t3unpaid = SUM(t3unpaid) /t4acvol = SUM(t4acvol) /t5outhm = SUM(t5outhm) /t6exerc = SUM(t6exerc) /t7inhm = SUM(t7inhm) /t8media = SUM(t8media) /t9trav = SUM(t9trav) /tmiss = SUM(tmiss) /tmain1 = SUM(tmain1) /tmain2 =MAX(tmain2) /tmain3 = SUM(tmain3) /tmain4 =MAX(tmain4) /tmain5 =MAX(tmain5) /tmain6 = SUM(tmain6) /tmain7 =SUM(tmain7) /tmain8 =SUM(tmain8) /tmain9 = SUM(tmain9) /tmain10 =SUM(tmain10) /tmain11 =SUM(tmain11) /tmain12 = SUM(tmain12) /tmain13 =SUM(tmain13) /tmain14 =SUM(tmain14) /tmain15 = SUM(tmain15) /tmain16 =SUM(tmain16) /tmain17 =SUM(tmain17) /tmain18 = MAX(tmain18) /tmain19 =SUM(tmain19) /tmain20 =SUM(tmain20) /tmain21 = SUM(tmain21) /tmain22 =SUM(tmain22) /tmain23 =SUM(tmain23) /tmain24 = SUM(tmain24) /tmain25 =SUM(tmain25) /tmain26 =SUM(tmain26) /tmain27 = SUM(tmain27) /tmain28 =SUM(tmain28) /tmain29 =SUM(tmain29) /tmain30 = SUM(tmain30) /tmain31 =SUM(tmain31) /tmain32 =SUM(tmain32) /tmain33 = SUM(tmain33) /tmain34 =SUM(tmain34) /tmain35 =SUM(tmain35) /tmain36 = SUM(tmain36) /tmain37 =SUM(tmain37) /tmain38 =SUM(tmain38) /tmain39 = SUM(tmain39) /tmain40 =SUM(tmain40) /tmain41 =SUM(tmain41) /tmain42 = SUM(tmain42) /tmain43 =MAX(tmain43) /tmain44 =SUM(tmain44) /tmain45 = SUM(tmain45) /tmain46 =SUM(tmain46) /tmain48 =SUM(tmain48) /tmain49 = SUM(tmain49) /tmain50 =MAX(tmain50) /tmain51 =SUM(tmain51) /tmain52 = SUM(tmain52) /tmain53 =SUM(tmain53) /tmain54 =SUM(tmain54) /tmain55 = SUM(tmain55) /tmain56 =SUM(tmain56) /tmain57 =SUM(tmain57) /tmain58 =SUM(tmain58) /tmain60 = SUM(tmain60) /tmain62 =MAX(tmain62) /tmain63 =MAX(tmain63) /tmain64 = SUM(tmain64) /tmain65 =SUM(tmain65) /tmain66 =MAX(tmain66) /tmain67 = SUM(tmain67) /tmain68 =SUM(tmain68) /tmain70 =MAX(tmain70) /tmain71 = MAX(tmain71) /tmain72 =SUM(tmain72) /tmain73 =SUM(tmain73) /tmain74 = SUM(tmain74) /tmain75 =MAX(tmain75) /tmain76 =SUM(tmain76) /tmain77 = SUM(tmain77) /tmain78 =SUM(tmain78) /tmain81 =SUM(tmain81) /tmain82 = SUM(tmain82) /tmain83 =SUM(tmain83) /tmain84 =SUM(tmain84) /tmain85 = SUM(tmain85) /tmain86 =SUM(tmain86) /tmain87 =SUM(tmain87) /tmain88 = SUM(tmain88) /tmain89 =SUM(tmain89) /tmain90 =SUM(tmain90) /tmain91 = SUM(tmain91) /tmain92 =SUM(tmain92) /tmain93 =SUM(tmain93) /tmain94 = SUM(tmain94) /tmain95 =SUM(tmain95) /tmain96 =SUM(tmain96) /tmain97 = SUM(tmain97) /tmain98 =SUM(tmain98) /tsc1 = MAX(tsc1) /tsc2 = MAX(tsc2) /tsc3 = MAX(tsc3) /tsc4 = MAX(tsc4) /tsc5 = MAX(tsc5) /tsc6 = MAX(tsc6) /tsc7 = MAX(tsc7) /tsc8 = MAX(tsc8) /tsc9 = MAX(tsc9) /tsc10 = MAX(tsc10) /tsc11 = MAX(tsc11) /tsc12 = MAX(tsc12) /tsc13 = MAX(tsc13) /tsc14 = MAX(tsc14) /tsc15 = MAX(tsc15) /tsc16 = MAX(tsc16) /tsc17 = MAX(tsc17) /tsc18 = MAX(tsc18) /tsc19 = MAX(tsc19) /tsc20 = MAX(tsc20) /tsc21 = MAX(tsc21) /tsc22 = MAX(tsc22) /tsc23 = MAX(tsc23) /tsc24 = MAX(tsc24) /tsc25 = MAX(tsc25) /tsc26 = MAX(tsc26) /tsc27 = MAX(tsc27) /tsc28 = MAX(tsc28) /tsc29 = MAX(tsc29) /tsc30 = MAX(tsc30) /tsc31 = MAX(tsc31) /tsc32 = MAX(tsc32) /tsc33 = MAX(tsc33) /tsc34 = MAX(tsc34) /tsc35 = MAX(tsc35) /tsc36 = MAX(tsc36) /tsc37 = MAX(tsc37) /tsc38 = MAX(tsc38) /tsc39 = MAX(tsc39) /tsc40 = MAX(tsc40) /tsc41 = MAX(tsc41) /tsc42 = MAX(tsc42) /tsc43 = MAX(tsc43) /tsc44 = MAX(tsc44) /tsc45 = MAX(tsc45) /tsc46 = MAX(tsc46) /tsc48 = MAX(tsc48) /tsc49 = MAX(tsc49) /tsc50 = MAX(tsc50) /tsc51 = MAX(tsc51) /tsc52 = MAX(tsc52) /tsc53 = MAX(tsc53) /tsc54 = MAX(tsc54) /tsc55 = MAX(tsc55) /tsc56 = MAX(tsc56) /tsc57 = MAX(tsc57) /tsc58 = MAX(tsc58) /tsc60 = MAX(tsc60) /tsc62 = MAX(tsc62) /tsc63 = MAX(tsc63) /tsc64 = MAX(tsc64) /tsc65 = MAX(tsc65) /tsc66 = MAX(tsc66) /tsc67 = MAX(tsc67) /tsc68 = MAX(tsc68) /tsc70 = MAX(tsc70) /tsc71 = MAX(tsc71) /tsc72 = MAX(tsc72) /tsc73 = MAX(tsc73) /tsc74 = MAX(tsc74) /tsc75 = MAX(tsc75) /tsc76 = MAX(tsc76) /tsc77 = MAX(tsc77) /tsc78 = MAX(tsc78) /tsc81 = MAX(tsc81) /tsc82 = MAX(tsc82) /tsc83 = MAX(tsc83) /tsc84 = MAX(tsc84) /tsc85 = MAX(tsc85) /tsc86 = MAX(tsc86) /tsc87 = MAX(tsc87) /tsc88 = MAX(tsc88) /tsc89 = MAX(tsc89) /tsc90 = MAX(tsc90) /tsc91 = MAX(tsc91) /tsc92 = MAX(tsc92) /tsc93 = MAX(tsc93) /tsc94 = MAX(tsc94) /tsc95 = MAX(tsc95) /tsc96 = MAX(tsc96) /tsc97 = MAX(tsc97) /tsc98 = MAX(tsc98) /outside = SUM(outside) /inveh = SUM(inveh) /inside = SUM(inside) /athome = SUM(athome) /atwrksc = SUM(atwrksc) /elsewhr = SUM(elsewhr) /locunk=SUM(locunk) /walone=MAX(walone) /wchild=SUM(wchild) /wsppart=MAX(wsppart) /wclsfam=MAX(wclsfam) /wother=SUM(wother) /withunk=MAX(withunk) /tcare=SUM(tcare) /t1dig = SUM(t1dig) /t2dig = SUM(t2dig). Get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfep.SAV'. rename variables (end2=end). apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\History of harmonisation - Diary\schema\schema1.sav'. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfep.SAV' /drop sex age state exclude hhwt adwt athom. Get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfsum.sav'. apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\History of harmonisation - Diary\schema\schema2.sav'. *check that variables sum to 1440 in aggregated file. freq t1dig t2dig tottime. Save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfsum.sav' /drop t1dig t2dig. Get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995testag.SAV'. *initial diary quality checks. freq day sex age. desc misstime numep. compute muchmiss=0. If misstime>90 muchmiss=1. var lab muchmiss missing more than 90 minutes. val lab muchmiss 0 no more than 90 minutes missing 1 more than 90 minutes missing. freq muchmiss. *no missing time in this survey. compute lowep=0. If numep<7 lowep=1. var lab lowep "<7 episodes". freq lowep. *23 low episode diaries. compute misbasic=0. If t9trav=0 and t6exerc=0 and imptrav<90 misbasic=misbasic+1. If eatdr=0 misbasic=misbasic+1. If sleep=0 misbasic=misbasic+1. If perscare=0 misbasic=misbasic+1. var lab misbasic number basic activites not recorded. freq misbasic /FORMAT=DVALUE. *55 diaries missing basic activities at this point. temp. select if misbasic>1. freq tcare athome numep. *exclude diaries of carers, people with higher activity counts, *at home and moderate activity counts to not missing basic. compute caremflg=0. if misbasic>1 and tcare>0 caremflg=1. if misbasic>1 and (tcare>0 or numep>14 or (athome>999 and numep>11)) misbasic=0. freq misbasic /FORMAT=DVALUE. *37 diaries missing basic activities at this point. compute lowqual=0. If muchmiss=1 or lowep=1 or misbasic>1 lowqual=1. cro lowqual by muchmiss lowep misbasic. freq lowqual. compute baddem=0. if sex<0 or day<1 or age<1 baddem=1. cro baddem by lowqual. weight by hhwt. cro day by sex /cells=col. freq day. weight by adwt. cro day by sex /cells=col. freq day. weight off. *neither weight balances the days of the week. compute owghtflg=2. compute origwght=adwt. compute xtimewt=0. compute infltwt=0. compute recwght=0. apply dictionary from 'C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\History of harmonisation - Diary\schema\schema2.sav'. recode age (18 thru 24=1)(25 thru 34=2)(35 thru 44=3) (45 thru 54=4)(55 thru 64=5)(65 thru high=6) (else=8) into agegp. If lowqual=1 or baddem=1 or day=-8 agegp=8. freq agegp. compute agesexgp=agegp+ 10*(sex-1). val lab agesexgp 1 "men 18 thru 24" 2 "men 25 thru 34" 3 "men 35 thru 44" 4 "men 45 thru 54" 5 "men 55 thru 64" 6 "men 65+" 8 "men age missing or bad diary" 11 "women 18 thru 24" 12 "women 25 thru 34" 13 "women 35 thru 44" 14 "women 45 thru 54" 15 "women 55 thru 64" 16 "women 65+" 18 "women age missing or bad diary". fre agesexgp. compute agesexwt=adwt. if agesexgp=8 or agesexgp=18 agesexwt=0. compute agesexw2=adwt. if agesexgp=8 or agesexgp=18 or exclude=1 agesexw2=0. desc agesexwt agesexw2. sort cases by agesexgp day. aggregate outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\group.sav' /break=agesexgp /grouptot=sum(agesexwt) /group2=sum(agesexw2). aggregate outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\day.sav' /break= agesexgp day /daytot=sum(agesexwt) /dayn=nu. match files file=* /table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\group.sav' /by agesexgp. execute. match files file=* /table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\day.sav' /by agesexgp day. execute. compute agesexg2=agesexgp. if exclude=1 and agesexgp<8 agesexg2=8. if exclude=1 and (agesexgp>8 and agesexgp<18) agesexg2=18. freq agesexg2. sort cases by agesexg2 day. aggregate outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\day2.sav' /break= agesexg2 day /daytot2=sum(agesexw2) /dayn2=nu. execute. match files file=* /table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\day2.sav' /by agesexg2 day. execute. compute exptot=(grouptot/7). compute exptot2=(group2/7). compute recwght=0. if lowqual=0 and baddem=0 recwght=(exptot/daytot)/(dayn/daytot). compute xtimewt=0. if lowqual=0 and baddem=0 and exclude=0 xtimewt=(exptot2/daytot2)/(dayn2/daytot2). desc recwght xtimewt. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK= tottime /recsum = SUM(recwght) /xtsum = SUM(xtimewt). freq recsum xtsum. compute recwght=recwght*1199/1134.73. compute xtimewt=xtimewt*1199/1067.97. desc recwght xtimewt. weight by recwght. fre day. cro agesexgp by day /cell=row. fre agesexgp. weight by xtimewt. fre day. cro agesexgp by day /cell=row. fre agesexgp. weight off. compute agegp2=-8. if sex=1 and (age>17 and age<30) agegp2=0. if sex=1 and (age>29 and age<40) agegp2=1. if sex=1 and (age>39 and age<50) agegp2=2. if sex=1 and (age>49 and age<60) agegp2=3. if sex=1 and (age>59 and age<70) agegp2=4. if sex=1 and age>69 agegp2=5. if sex=2 and (age>17 and age<30) agegp2=6. if sex=2 and (age>29 and age<40) agegp2=7. if sex=2 and (age>39 and age<50) agegp2=8. if sex=2 and (age>49 and age<60) agegp2=9. if sex=2 and (age>59 and age<70) agegp2=10. if sex=2 and age>69 agegp2=11. val lab agegp2 -8 missing 0 men aged 18-29 1 men aged 30-39 2 men aged 40-49 3 men aged 50-59 4 men aged 60-69 5 "men aged 70+" 6 women aged 18-29 7 women aged 30-39 8 women aged 40-49 9 women aged 50-59 10 women aged 60-69 11 "women aged 70+". weight by recwght. freq agegp2. weight off. ***************************************** * CPS age distributions * * population 18-65 * * diary * * MEN frequency % frequency * * age 18-29 11496 22.7 124 * * age 30-39 11951 23.6 133 * * age 40-49 10229 20.2 109 * * age 50-59 6735 13.3 49 * * age 60-69 5216 10.3 39 * * age 70+ 5013 9.9 37 * * total 50641 * * * * WOMEN frequency % * * age 18-29 12481 21.8 142 * * age 30-39 12825 22.4 180 * * age 40-49 10936 19.1 180 * * age 50-59 7386 12.9 69 * * age 60-69 5954 10.4 61 * * age 70+ 7672 13.4 78 * * total 57254 * * * * total 107895 1199 * *****************************************. *produce a weight which inflates to the CPS *population size. Do if agegp2=0. compute infltwt=recwght*(11496/124). Else if agegp2=1. compute infltwt=recwght*(11951/133). Else if agegp2=2. compute infltwt=recwght*(10229/109). Else if agegp2=3. compute infltwt=recwght*(6735/49). Else if agegp2=4. compute infltwt=recwght*(5216/39). Else if agegp2=5. compute infltwt=recwght*(5013/37). Else if agegp2=6. compute infltwt=recwght*(12481/142). Else if agegp2=7. compute infltwt=recwght*(12825/180). Else if agegp2=8. compute infltwt=recwght*(10936/180). Else if agegp2=9. compute infltwt=recwght*(7386/69). Else if agegp2=10. compute infltwt=recwght*(5954/61). Else if agegp2=11. compute infltwt=recwght*(7672/78). End if. execute. weight by infltwt. freq agegp2 day. weight off. sort cases by pid. save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\weight.sav' /keep pid lowqual baddem caremflg origwght owghtflg xtimewt infltwt recwght. *test labels and variables. match files files='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfep.SAV' table='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\weight.sav' /by pid. desc survey wave hhid pid diaryday cday month year time clockst start end epnum main sec inout eloc mtrav alone infant child sppart clsfam hhadult animal shoprof cowork wellknw otherp unknwp origwght xtimewt infltwt recwght. freq survey wave diaryday cday month year epnum main sec inout eloc mtrav alone infant child sppart clsfam hhadult animal shoprof cowork wellknw otherp unknwp lowqual baddem caremflg. SAVE OUTFILE='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\Harmonised files\Diary\diary 1994-95\USA1995hfep.SAV'. match files file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\USA1995hfsum.sav' file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\1995\weight.sav' /BY pid. execute. recode locunk (0=-9). save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\Harmonised files\Diary\diary 1994-95\USA1995hfsum.sav'. get file='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\Harmonised files\Diary\diary 1994-95\USA1995hfsum.sav' /keep survey wave hhid pid diaryday cday month year tottime numep t0pcare t1paid t2ed t3unpaid t4acvol t5outhm t6exerc t7inhm t8media t9trav tmiss tmain1 tmain2 tmain3 tmain4 tmain5 tmain6 tmain7 tmain8 tmain9 tmain10 tmain11 tmain12 tmain13 tmain14 tmain15 tmain16 tmain17 tmain18 tmain19 tmain20 tmain21 tmain22 tmain23 tmain24 tmain25 tmain26 tmain27 tmain28 tmain29 tmain30 tmain31 tmain32 tmain33 tmain34 tmain35 tmain36 tmain37 tmain38 tmain39 tmain40 tmain41 tmain42 tmain43 tmain44 tmain45 tmain46 tmain48 tmain49 tmain50 tmain51 tmain52 tmain53 tmain54 tmain55 tmain56 tmain57 tmain58 tmain60 tmain62 tmain63 tmain64 tmain65 tmain66 tmain67 tmain68 tmain70 tmain71 tmain72 tmain73 tmain74 tmain75 tmain76 tmain77 tmain78 tmain81 tmain82 tmain83 tmain84 tmain85 tmain86 tmain87 tmain88 tmain89 tmain90 tmain91 tmain92 tmain93 tmain94 tmain95 tmain96 tmain97 tmain98 tsc1 tsc2 tsc3 tsc4 tsc5 tsc6 tsc7 tsc8 tsc9 tsc10 tsc11 tsc12 tsc13 tsc14 tsc15 tsc16 tsc17 tsc18 tsc19 tsc20 tsc21 tsc22 tsc23 tsc24 tsc25 tsc26 tsc27 tsc28 tsc29 tsc30 tsc31 tsc32 tsc33 tsc34 tsc35 tsc36 tsc37 tsc38 tsc39 tsc40 tsc41 tsc42 tsc43 tsc44 tsc45 tsc46 tsc48 tsc49 tsc50 tsc51 tsc52 tsc53 tsc54 tsc55 tsc56 tsc57 tsc58 tsc60 tsc62 tsc63 tsc64 tsc65 tsc66 tsc67 tsc68 tsc70 tsc71 tsc72 tsc73 tsc74 tsc75 tsc76 tsc77 tsc78 tsc81 tsc82 tsc83 tsc84 tsc85 tsc86 tsc87 tsc88 tsc89 tsc90 tsc91 tsc92 tsc93 tsc94 tsc95 tsc96 tsc97 tsc98 outside inside inveh locunk athome atwrksc elsewhr locunk walone wchild wsppart wclsfam wother withunk lowqual baddem caremflg origwght owghtflg xtimewt infltwt recwght. recode tmain90 (0=-9). save outfile='C:\Documents and Settings\Kimberly Fisher\My Documents\Kimberly\time\ATUS\AHTUS final files\Harmonised files\Diary\diary 1994-95\USA1995hfsum.sav'. desc survey wave hhid pid diaryday cday month year tottime numep t0pcare t1paid t2ed t3unpaid t4acvol t5outhm t6exerc t7inhm t8media t9trav tmiss tmain1 to tsc98 outside inveh inside locunk athome atwrksc elsewhr locunk walone wchild wsppart wclsfam wother withunk origwght xtimewt infltwt recwght. freq survey wave diaryday cday month year tottime numep lowqual baddem caremflg. temp. select if recwght=0. cro lowqual by baddem. temp. select if recwght~=0. freq diaryday. weight by recwght. freq diaryday.