**************************************************************** **The syntax written to create MTUS files. ** **This syntax uses a AHTUS data files which are created by ** **syntax titled ConvertUSA98TUV ** **Written by Evrim Altintas,CTUR. ** **Last update 5 July 2013 ** *****************************************************************. *Create a temprorary file to extract rushed and parpres vars. Get file "/Users/evrim/Dropbox/CTUR/USA/1998-2001/US_agg99.sav" /keep pide adult2_4 adult3_4 q1 p6. *freq adult2_4 adult3_4 adult4_4 adult5_4 adult6_4 adult7_4. *if there are parents, they show up in adult2_4 or adult3_. *parpres* *********. compute parpres=0. if adult2_4=3 or adult3_4=3 parpres=1. freq parpres. *rushed* ********. val label q1 1 always 2 sometimes 3 almost never 8 dk. recode q1 (3=0) (2=1) (1=2) (8=-8) into rushed. freq rushed. *computer* **********. compute computer=-7. *singpar* *********. freq p6. *not that the sample is composed of parents only. recode p6 (sysmis=-8). recode p6 (1=0) (2,3,4,5=1) (else=-8) into singpar. desc all. sort cases by pide. save outfile "/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/us99temp1.sav" /keep pide rushed parpres singpar computer. get file = "/Users/evrim/Dropbox/CTUR/USA/1998-2001/US_agg98.sav" /keep pide q1b q20d parent marstat. *rushed* ********. val label q1b 1 always 2 sometimes 3 almost never 8 dk. recode q1b (3=0) (2=1) (1=2) (8=-8) into rushed. freq rushed. *computer* **********. recode q20d (1=1) (2=0) (9=-8) (sysmis=-8) into computer. *parpres* *********. compute parpres=-7. *singpar* *********. compute singpar=-8. Do If parent=1 and (marstat>1 and marstat<6). compute singpar=1. Else if parent=0. compute singpar=0. else if parent=1 and (marstat=1 or marstat=6). compute singpar=0. end if. cro marstat by singpar. sort cases by pide. save outfile "/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/us98temp1.sav" /keep pide rushed parpres computer singpar. get file ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/USA1998-01hfsum2.sav" /keep pide month year diaryday. rename variables (diaryday=day). sort cases by pide. save outfile ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/us9899month.sav" /keep pide month year day. get file ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/Harmonised Files/usa98_01quest.sav". *ownhome urban sex famstat hhtype age civstat cohab empstat unemp student retired empsp occup are already created for AHTUS. compute pide=98000000+pid. If survey=8 pide=99000000+pid. desc pid pide. sort cases by pide. match files /file=* /file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/us98temp1.sav" /file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/us99temp1.sav" /file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/us9899month.sav"/by pide. freq rushed computer parpres singpar year month day. rename variables hhtype=hhtypea. compute countrya=38. compute swave=0. compute msamp=3. if survey=8 msamp=4. compute hldid=0. compute persid=pid. compute id=1. compute parntid1=-9. compute parntid2=-9. compute partid=-9. compute diary=1. compute relrefp=-9. compute empinclm=wagelm. compute workhrs=wkhrs. compute sector=-9. compute educa=educ. compute incorig=income98. compute agekid2=ageyngst. compute citizen=-9. compute vehicle=-9. compute carer=-9. compute health=-9. *12 cases with missing values are checked. recode civstat (2,3,4=2) (else=copy). recode empstat (3=4) (else=copy). recode empstat (1,2=1) (-8=-8) (else=0) into emp. compute survey=1998. *In MTUS survey is the 4-digit year in which data collection began. ******* *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 separately. cro civstat by cohab. If civstat=2 and cohab=0 cohab=-7. cro civstat by cohab. *EDCAT* ********. if (educa >0 and educa <3) edcat = 1. if educa=3 edcat = 2. if educa>3 edcat = 3. if educa<0 edcat = -8. cro educ by edcat. *INCOME* ********. freq incorig. recode incorig (1,2,3=1) (4,5=2) (6,7=3) (-8=-8) into income. freq income. ******** *nchild* ********. compute nchild = under18. execute. ********** *hhldsize* **********. freq nadult under18. compute hhldsize=-8. Do if nadult>0 and under18>-8. compute hhldsize= nadult+under18. End if. cro hhldsize by nadult under18. ********* *agekidx* *********. recode agekid2 (0 thru 4=1) (5 thru 12=2) (13 thru 17=3) (else=copy) into agekidx. cro agekid2 by agekidx. *hhtype* ********. temp. select if msamp=3. cro hhldsize by civstat. temp. select if hhldsize=1 and civstat=1. freq pide. *Get file "/Users/evrim/Dropbox/CTUR/USA/1998-2001/US_agg98.sav". *temp. *select if pide=98040391. *freq p6 q5 p1 p2 marstat. *temp. *select if pide=98012165. *freq age famstat hhtypea empsp. *temp. *select if pide=98021446. *freq age famstat hhtypea empsp. *temp. *select if pide=98040329. *freq age famstat hhtypea empsp. *temp. *select if pide=98040391. *freq age famstat hhtypea empsp. *check these cases both in current and original file. married with no child, hhdlsize likely to be 2. if pide=98040391 or pide=98012165 or pide=98021446 or pide=98040329 or pide=98040391 hhldsize=2. cro hhldsize by civstat. compute hhtype=-8. do if civstat=1 and hhldsize=2. compute hhtype=2. else if civstat=1 and hhldsize>2. compute hhtype=3. else if civstat=2 and hhldsize=1. compute hhtype=1. else if civstat=2 and hhldsize>1. compute hhtype=4. end if. val label hhtype 1 One person hhold 2 couple alone 3 couple+others 4 other hhold. cro hhtype by hhldsize civstat. cro famstat by hhtype. *cphome* ********. cro parpres by civstat. compute cphome=0. do if msamp=3. compute cphome=-7. else if civstat=2 and parpres=1. compute cphome=1. else if civstat<0 or parpres<0. compute cphome=-8. end if. cro cphome by parpres. cro cphome by civstat. sort cases by pide. save outfile="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/mtusback1.sav". *rename variables (origwght recwght survey = ocombwt propwt surveyo). desc hldid persid id. *time use vars, weights and badcase missing. else is fine. freq survey swave msamp. get file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/mtusback1.sav". sort cases by msamp persid. save outfile='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/USA1998W581.sav' /keep countrya survey swave msamp hldid persid id parntid1 parntid2 partid day month year diary 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 pide. *TIME USE VARIABLES* ********************. *OAD & ICT* ***********. *OAD and ICT are not in AHTUS, we ll create it here. get file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/US_ep98_99.sav'. temp. select if wave=1. freq who1 who2. *In wave=1, 1998 3490 cases system missing. *The codebook states that these cases are either alone or the question was not asked. recode who2 (sysmis=-8) (else=copy). temp. select if wave=2. cro who1 by who2. val label who1 who2 0 other 1 alone 2 spouse only 3 child only 4 spouse and child 5 coworkers 6 friends 7 relatives 8 strangers 9 "noone else/other". cro who1 by who2. compute oad=0. If who1=2 or (who1>3 and who1<9) or who2=2 or (who2>3 and who2<9) oad=1. freq oad. compute ict=0. if actcode=53 or actcode=56 or actcode=58 or actcode=57 or secact1=53 or secact1=56 or secact1=58 or secact1=57 ict=1. freq ict. *Now create vars to be able to match the files with the other file. cro surveye by wave. compute survey=8. If wave=1 survey=6. compute pide=98000000+pid. If survey=8 pide=99000000+pid. sort cases by surveye pide actno. compute epnum=1. Do If actno>1 and pide=lag(pide). compute epnum=lag(epnum)+1. end if. var lab epnum episode number. freq epnum. sort cases by survey pid epnum oad. save outfile ='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/oad.sav' /keep pid survey epnum oad ict. *get file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/US_ep98_99_3.sav". get file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/Harmonised Files/USA1998hfep.SAV". match files /file=* file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/oad.sav" /by survey pid epnum. freq oad ict. freq survey. rename variables (origwght recwght survey diaryday inout= ocombwt propwt surveyo day inouto). compute countrya=38. compute swave=0. compute msamp=3. if surveyo=8 msamp=4. compute hldid=0. compute persid=pid. compute id=1. compute diary=1. compute survey=1998. recode inouto (1=2)(2=1) (3=3) (sysmis=-8) into inout. val label inout 1 inside 2 outside 3 travelling. cro inout by inouto. recode inout (sysmis=-8). freq inout. ********************************************* *harmonised time use variables (av1 ro av41)* **********************************************. vector av(41). loop i=1 to 41. compute av(i)=0. end loop. freq main. 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. *note this dataset already contains the variables *month and year in mtus format. *Three categories have no reported instance: av26(social clubs), av27(pubs) and av41 (missing activities). compute av41=-9. compute av26=-9. compute av27=-9. execute. sort cases by msamp persid. aggregate /outfile='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usa1998haf1.sav' /break=msamp persid /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= sum(av35) /av36= sum(av36) /av37= sum(av37) /av38= sum(av38) /av39= sum(av39) /av40= sum(av40) /av41= max(av41) /total=sum(total) /sppart=sum(sppart) /ocombwt= max(ocombwt) /propwt= max(propwt). apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw60schema.sav'. ***************************** *av variable for version hef* *****************************. compute av=999. execute. do if main=8 or main=10 or main=13 or main=14 or main=15. compute av=1. else if main=11. compute av=2. else if main=12. compute av=3. else if main=16 or main=18 or main=19. compute av=4. else if main=92 or main=93 or main=94. compute av=5. else if main=20 or main=21. compute av=6. else if main=22 or main=23. compute av=7. else if main=24 or main=25 or main=40 or main=68. compute av=8. else if main=67. compute av=9. else if main=26 or main=27 or main=30 or main=31. compute av=10. else if main=65 or (main>32 and main<40). compute av=11. else if main=91 or (main>94 and main<98). compute av=12. else if main=1 or main=2 or main=6. compute av=13. else if main=7 or main=28 or main=29 or main=32. compute av=14. else if main=9 and eloc~=6. compute av=15. else if main=3 or main=4 or main=5. compute av=16. else if main=90 or main=98. compute av=17. else if main=50 or main=54 or main=55 or main=64. compute av=18. else if main=60 or main=63 or main=66. compute av=19. else if main=51. compute av=20. else if main=62. compute av=21. else if main=49. compute av=22. else if (main>40 and main<47) or main=48. compute av=23. else if main=52 or main=53. compute av=24. else if main=57. compute av=25. else if main=56 or (main=9 and eloc=6). compute av=28. else if (main=71 or main=72) and eloc>1. compute av=29. else if main=85. compute av=30. else if main=86. compute av=31. else if main=84. compute av=32. else if main=17 or main=89. compute av=33. else if main=81. compute av=34. else if main=82 or main=83. compute av=35. else if main=70 or main=78. compute av=36. else if main=88. compute av=37. else if (main=71 or main=72) and eloc<2. compute av=38. else if main=76. compute av=39. else if main=73 or main=74 or main=75 or main=77 or main=87. compute av=40. else if main=-8 or main=58. compute av=41. end if. variable labels av "main activity 41 category list". value labels av 1 'paid work' 2 'paid work at home' 3 'paid work, second job' 4 'school, classes' 5 'travel to/from work' 6 'cook/ wash up' 7 'housework' 8 'odd jobs' 9 'gardening' 10 'shopping' 11 'childcare' 12 'domestic travel' 13 'dress/personal care' 14 'consume personal services' 15 'meals and snacks' 16 'sleep' 17 'free time travel' 18 'excursions' 19 'active sports participation' 20 'passive sports participation' 21 'walking' 22 'religious activities' 23 'civic activities ' 24 'cinema or theatre' 25 'dances or parties' 26 'social clubs' 27 'pubs' 28 'restaurants' 29 'visit friends at their homes' 30 'listen to radio' 31 'watch television or video' 32 'listen to records, tapes, cds' 33 'study, homework' 34 'read books' 35 'read papers, magazines' 36 'relax' 37 'conversation' 38 'entertain friends at home' 39 'knit, sew' 40 'other leisure' 41 'unclassified or missing activities'. freq av. temp. select if av<10. cro main by av. temp. select if av>10 and av<20. cro main by av. temp. select if av>19 and av<29. cro main by av. temp. select if av>28 and av<35. cro main by av. temp. select if av>34 and av<42. cro main by av. rename variables (clockst=clocksto). compute clockst=clocksto/100. execute. formats clockst (f8.2). apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw60schema.sav'. sort cases by survey swave msamp persid epnum. save outfile='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usahef1.sav' /keep countrya survey swave msamp hldid persid id day cday month year diary time clockst start end epnum av eloc ict inout mtrav alone child infant sppart oad. *************** *MAIN AND SEC** ***************. get file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/US_ep98_99.sav'. freq surveye. val label where 0 other non travel 1 home 2 other home 3 outdoor not home 4 office building, factory 5 grocery store 6 other store, mall 7 school 8 restaurant, bar 10 other travel 11 car, truck, motor vehicle 12 bus, train, plane 13 walking 99 missing. freq where. temp. select if actcode=43. freq where. val label actcode secact1 1 Main job 2 Unemployment rel acts 3 Travel during work 5 Second Job 6 "Meals/snacks at work" 7 Work breaks in 99 8 Work breaks in 98 9 Travel to, from work 10 Food preparation 11 Food cleanup 12 Cleaning house 13 Outdoor cleaning 14 Clothes care 15 Car repair, maintenance 16 Other repair 17 Plant Care 18 Animal care 19 Other household work 20 Baby care 21 Child care 22 Helping, teaching 23 Talking, reading 24 Indoor playing 25 Outdoor playing 26 Medical care for child 27 Other child care 29 Travel, child care 30 Shopping for food 31 Shopping for clothes, household items 32 Personal care services 33 Medical appointments 34 Government, financial services 35 Car repair services 36 Other repair services 37 Other services 38 Errands 39 Travel, goods and services 40 Showering and bathing 41 Medical Care 42 Help and care 43 Eating 44 Personal hygiene, grooming 45 Sleeping, napping 46 Resting in 99 47 Dressing 48 N.A. activities 49 Travel, personal care 50 Attending fulltime school 51 Other classes 52 Other education 53 Email in 99 54 Homework 55 Using library 56 Using internet 57 PC games, video games 58 Other PC use 59 Travel, education 60 Professional union 61 Special interest org 62 political, civic particip 63 Volunteer, helping 64 Religious groups 65 Religious practices 67 Child, youth, family organizations 68 Work for other organizations 69 Travel, organizational 70 Sports event 71 Entertainment 72 Movies 73 Videos in 99, theather in 98 74 Attending arts events 75 Visiting, socializing 76 Parties, picnics 77 Bars, lounges, other social 78 Telephone conv in 1999, other social in 1998 79 Travel, social 80 Active sports 81 Outdoor 82 Exercise 83 Hobbies 84 Domestic crafts 85 Doing art 86 Music, drama, dance 87 Games 88 Walking, hiking in 99 89 Travel, recreational 90 Radio 91 TV 92 Records, tapes 93 read books 94 Reading magazines 95 Reading newspaper 96 Household conversations 97 Letters, writing 98 Thinking, relaxing 99 Travel, passive leisure 998 missing. execute. freq actcode secact1. compute main=-8. Do if actcode=45 or actcode=46. compute main=2. Else if actcode=40 or actcode=41 or actcode=44 or actcode=47 or actcode=48. compute main=4. Else if actcode=6 or (actcode=43 and (where=4 or where=7)). compute main=5. else if actcode=43 and where~=8. compute main=6. else if actcode=1 and where~=1. compute main=7. Else if (actcode=1 and where=1) or (actcode=5 and where=1). compute main=8. Else if actcode=5. compute main=9. else if actcode=3. compute main=11. Else if actcode=8. compute main=12. else if actcode=2. compute main=14. else if actcode=50. compute main=15. else if actcode=54. compute main=16. else if actcode=51 or actcode=52 or actcode=55. compute main=17. else if actcode=10. compute main=18. else if actcode=11. compute main=19. else if actcode=12 or actcode=13. compute main=20. else if actcode=14. compute main=21. else if actcode=15 or actcode=16. compute main=22. else if actcode=19. compute main=23. else if actcode=30 or actcode=31. compute main=24. else if actcode=32 or actcode=33. compute main=25. else if actcode>33 and actcode<39. compute main=26. else if actcode=18. compute main=27. else if actcode=20 or actcode=21 or actcode=26. compute main=28. else if actcode=22. compute main=29. else if actcode=23 or actcode=24 or actcode=25. compute main=30. else if actcode=27. compute main=31. else if actcode=42. compute main=32. else if (actcode>59 and actcode<64) or actcode=67 or actcode=68. compute main=33. else if actcode=64 or actcode=65. compute main=34. else if actcode=78 and surveye=1998. compute main=35. else if actcode=70. compute main=36. else if actcode=72 or (actcode=73 and surveye= 1998). compute main=37. else if actcode=74 or actcode=71. compute main=38. else if actcode=77 or (actcode=43 and where=8). compute main=39. else if actcode=76. compute main=40. else if actcode=80 or actcode=82. compute main=42. else if actcode=88. compute main=43. else if actcode=81. compute main=45. else if actcode=17. compute main=46. else if actcode=75. compute main=48. else if actcode=96 or (actcode=78 and surveye=1999). compute main=49. else if actcode=87. compute main=50. else if actcode=85 or actcode=86. compute main=52. else if actcode=97. compute main=53. else if actcode=83 or actcode=84. compute main=54. else if actcode=98. compute main=55. else if actcode>92 and actcode<96. compute main=56. else if actcode=92. compute main=57. else if actcode=90. compute main=58. else if actcode=91 or (actcode=73 and surveye=1999). compute main=59. else if actcode=57. compute main=60. else if actcode=53 or actcode=56 or actcode=58. compute main=61. else if actcode=9. compute main=63. else if actcode=59. compute main=64. else if actcode=69. compute main=65. else if actcode=29. compute main=66. else if actcode=39 or actcode=49. compute main=67. else if actcode=79 or actcode=89 or actcode=99. compute main=68. else if actcode=998. compute main=69. end if. temp. select if main=69. freq pide actno where. *Checked this case visually. good diary with missing time at the end of the day after dinner. *Code as imputed sleep. If main=69 main=3. apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw60schema.sav'. freq main. 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. recode secact1 (sysmis=0) (else =copy). compute sec=-8. Do If secact1 < 1 or secact1 > 99. Compute sec = 69. Else if secact1=45 or secact1=46. compute sec=2. Else if secact1=40 or secact1=41 or secact1=44 or secact1=47 or secact1=48. compute sec=4. Else if secact1=6 or (secact1=43 and (where=4 or where=7)). compute sec=5. else if secact1=43 and where~=8. compute sec=6. else if secact1=1 and where~=1. compute sec=7. Else if secact1=1 and where=1. compute sec=8. Else if secact1=5. compute sec=9. else if secact1=3. compute sec=11. Else if secact1=8. compute sec=12. else if secact1=2. compute sec=14. else if secact1=50. compute sec=15. else if secact1=54. compute sec=16. else if secact1=51 or secact1=52 or secact1=55. compute sec=17. else if secact1=10. compute sec=18. else if secact1=11. compute sec=19. else if secact1=12 or secact1=13. compute sec=20. else if secact1=14. compute sec=21. else if secact1=15 or secact1=16. compute sec=22. else if secact1=19. compute sec=23. else if secact1=30 or secact1=31. compute sec=24. else if secact1=32 or secact1=33. compute sec=25. else if secact1>33 and secact1<39. compute sec=26. else if secact1=18. compute sec=27. else if secact1=20 or secact1=21 or secact1=26. compute sec=28. else if secact1=22. compute sec=29. else if secact1=23 or secact1=24 or secact1=25. compute sec=30. else if secact1=27. compute sec=31. else if secact1=42. compute sec=32. else if (secact1>59 and secact1<64) or secact1=67 or secact1=68. compute sec=33. else if secact1=64 or secact1=65. compute sec=34. else if secact1=71. compute sec=35. else if secact1=70. compute sec=36. else if secact1=72 or (secact1=73 and surveye=1998). compute sec=37. else if secact1=74 or (secact1=78 and surveye=1998). compute sec=38. else if secact1=77 or (secact1=43 and where=8). compute sec=39. else if secact1=76. compute sec=40. else if secact1=80 or secact1=82. compute sec=42. else if secact1=88. compute sec=43. else if secact1=81. compute sec=45. else if secact1=17. compute sec=46. else if secact1=75. compute sec=48. else if secact1=96 or (secact1=78 and surveye=1999). compute sec=49. else if secact1=87. compute sec=50. else if secact1=85 or secact1=86. compute sec=52. else if secact1=97. compute sec=53. else if secact1=83 or secact1=84. compute sec=54. else if secact1=98. compute sec=55. else if secact1>92 and secact1<96. compute sec=56. else if secact1=92. compute sec=57. else if secact1=90. compute sec=58. else if secact1=91 or (secact1=73 and surveye=1999). compute sec=59. else if secact1=57. compute sec=60. else if secact1=53 or secact1=56 or secact1=58. compute sec=61. else if secact1=9. compute sec=63. else if secact1=59. compute sec=64. else if secact1=69. compute sec=65. else if secact1=29. compute sec=66. else if secact1=39 or secact1=49. compute sec=67. else if secact1=79 or secact1=89 or secact1=99. compute sec=68. end if. freq sec. freq main sec. compute msamp=4. if surveye=1998 msamp=3. cro surveye by msamp. compute pide=98000000+pid. If msamp=4 pide=99000000+pid. sort cases by surveye pide actno. compute epnum=1. Do If actno>1 and pide=lag(pide). compute epnum=lag(epnum)+1. end if. var lab epnum episode number. freq epnum. compute persid=pid. rename varables (start end=starto endo). sort cases by pide starto. Compute start=trunc(starto/100)*60+(starto-(trunc(starto/100))*100). Compute end=trunc(endo/100)*60+(endo-(trunc(endo/100))*100). Execute. compute time=end-start. var lab time duration of activity in minutes. desc time etoa. correlations /variables=etoa time. *time and etoa are identical as should be. freq time. 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 sec=i b=time. End repeat. execute. *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. recode main1 main10 main13 main41 main44 main47 main51 main62 main69 sec1 sec10 sec13 sec41 sec44 sec47 sec51 sec62 sec69 (0=-9). execute. aggregate /outfile= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/mainhaf.sav' /break=msamp persid /main1 = MAX(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 = MAX(main10) /main11 = SUM(main11) /main12 = SUM(main12) /main13 = MAX(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 = MAX(main41) /main42 = SUM(main42) /main43 = SUM(main43) /main44 = MAX(main44) /main45 = SUM(main45) /main46 = SUM(main46) /main47 = MAX(main47) /main48 = SUM(main48) /main49 = SUM(main49) /main50 = SUM(main50) /main51 = MAX(main51) /main52 = SUM(main52) /main53 = SUM(main53) /main54 = SUM(main54) /main55 = SUM(main55) /main56 = SUM(main56) /main57 = SUM(main57) /main58 = SUM(main58) /main59 = SUM(main59) /main60 = SUM(main60) /main61 = SUM(main61) /main62 = MAX(main62) /main63 = SUM(main63) /main64 = SUM(main64) /main65 = SUM(main65) /main66 = SUM(main66) /main67 = SUM(main67) /main68 = SUM(main68) /main69 = MAX(main69) /total = SUM(total). sort cases by msamp persid epnum. save outfile= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/mainsec.sav' /keep msamp persid epnum main sec. *BADCASE* *********. get file "/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/US_ep98_99_2.sav". freq day main wave. *No missing!. compute tmiss2=0. compute aeatdr=0. compute asleep=0. compute apcare=0. compute atrav=0. compute anycare=0. execute. If main=-8 tmiss2=time. desc tmiss2. *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= pide /xeatdr=MAX(aeatdr) /xsleep=MAX(asleep) /xpcare=MAX(apcare) /xtrav=MAX(atrav). freq xeatdr xsleep xpcare xtrav. *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 xtrav=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 xpcare=0 test2=1. freq test2. aggregate /outfile=* mode=addvariables /BREAK= pide /pcarex=MAX(test2) /travx=MAX(test). if xpcare=0 and pcarex=1 xpcare=1. if xtrav=0 and travx=1 xtrav=1. freq xeatdr xsleep xpcare xtrav. compute test=0. if eloc=1 or eloc=2 test=time. aggregate /outfile=* mode =addvariables /BREAK=pide /athome2=SUM(test) /maxep=MAX(epnum). desc athome2 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 xtrav=0 and maxep>11 and athome2>1000 xtrav=1. freq xtrav. AGGREGATE /OUTFILE=* /BREAK=pide /eatdr=SUM(xeatdr) /sleep=SUM(xsleep) /pcare=SUM(xpcare) /tmiss=SUM(tmiss2) /trav=SUM(xtrav) /anycare=MAX(anycare) /epnum=MAX(epnum) /day=MAX(day). 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. *we need sex and age information. sort cases by pide. match files files= * table="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/US_agg9899_sexage.sav" /by pide. execute. compute baddiary=0. execute. if tmiss>90 or epnum<7 or misbasic>1 baddiary=1. freq baddiary. *25 1.1% bad diaries.-2326 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. cro tmiss by nep by misbasic. *25 bad diaries. 0 diary low quality on all 3 counts. *4 bad on 2 counts. *4 missing basic acts and low episode. *21 bad on 1 count. *19 have low number of episodes; *2 missing 2+ basic acts only. desc sex age ageimp day. *No day or sex missing but many cases with age is gone. 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. *Create an alternative baddiary with imputed age* *************************************************. if ageimp=-9 ageimp=age. *note that 1998 survey has no imputed age var so it was coded as -9. freq ageimp. Do If baddiary=0 and sex>-8 and ageimp>-8 and day>-8. compute badcasei=0. Else if baddiary=0 and (sex=-8 or ageimp=-8) and day>-8. compute badcasei=1. Else if baddiary=0 and sex>-8 and ageimp>-8 and day=-8. compute badcasei=2. Else if sex>-8 and ageimp>-8 and day>-8 and nep=0 and tmiss=1 and misbasic=0. compute badcasei=3. Else if sex>-8 and ageimp>-8 and day>-8 and nep=1 and tmiss=0 and misbasic=0. compute badcasei=4. Else if sex>-8 and ageimp>-8 and day>-8 and nep=0 and tmiss=0 and misbasic=1. compute badcasei=5. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=0 and tmiss=0 and misbasic=0. compute badcasei=6. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=0 and tmiss=1 and misbasic=0. compute badcasei=7. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=1 and tmiss=0 and misbasic=0. compute badcasei=8. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=0 and tmiss=0 and misbasic=1. compute badcasei=9. Else if sex>-8 and ageimp>-8 and day=-8 and nep=0 and tmiss=1 and misbasic=0. compute badcasei=10. Else if sex>-8 and ageimp>-8 and day=-8 and nep=1 and tmiss=0 and misbasic=0. compute badcasei=11. Else if sex>-8 and ageimp>-8 and day=-8 and nep=0 and tmiss=0 and misbasic=1. compute badcasei=12. Else if sex>-8 and ageimp>-8 and day>-8 and nep=1 and tmiss=1 and misbasic=0. compute badcasei=13. Else if sex>-8 and ageimp>-8 and day>-8 and nep=0 and tmiss=1 and misbasic=1. compute badcasei=14. Else if sex>-8 and ageimp>-8 and day>-8 and nep=1 and tmiss=0 and misbasic=1. compute badcasei=15. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=0 and tmiss=1 and misbasic=0. compute badcasei=16. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=1 and tmiss=0 and misbasic=0. compute badcasei=17. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=0 and tmiss=0 and misbasic=1. compute badcasei=18. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=1 and tmiss=1 and misbasic=0. compute badcasei=19. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=0 and tmiss=1 and misbasic=1. compute badcasei=20. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=1 and tmiss=0 and misbasic=1. compute badcasei=21. Else if sex>-8 and ageimp>-8 and day=-8 and nep=1 and tmiss=1 and misbasic=0. compute badcasei=22. Else if sex>-8 and ageimp>-8 and day=-8 and nep=0 and tmiss=1 and misbasic=1. compute badcasei=23. Else if sex>-8 and ageimp>-8 and day=-8 and nep=1 and tmiss=0 and misbasic=1. compute badcasei=24. Else if sex>-8 and ageimp>-8 and day>-8 and nep=1 and tmiss=1 and misbasic=1. compute badcasei=25. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=1 and tmiss=1 and misbasic=0. compute badcasei=26. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=0 and tmiss=1 and misbasic=1. compute badcasei=27. Else if (sex=-8 or ageimp=-8) and day=-8 and nep=1 and tmiss=0 and misbasic=1. compute badcasei=28. Else if (sex=-8 or ageimp=-8) and day>-8 and nep=1 and tmiss=1 and misbasic=1. compute badcasei=29. Else if sex>-8 and ageimp>-8 and day=-8 and nep=1 and tmiss=1 and misbasic=1. compute badcasei=30. Else. compute badcasei=31. End if. val lab badcasei 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 badcasei. *double check that all correctly coded. cro badcase by sex day nep tmiss misbasic. compute msamp=4. if wave=1 msamp=3. cro msamp by wave. *Undo the pide-pid conversion. compute persid=-8. Do if msamp=4. compute persid=pide-99000000. else if msamp=3. compute persid=pide-98000000. end if. desc pide persid. *now we have the original pid. formats pide to persid (f8.0). sort cases by msamp persid. save outfile ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/badcase.sav" /keep msamp persid badcase. sort cases by msamp persid. save outfile ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/badcasei.sav" /keep msamp persid badcasei. *SEX, AGE for V6* *****************. get file="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/US_agg9899_sexage.sav". compute msamp=4. if wave=1 msamp=3. cro msamp by wave. *Undo the pide-pid conversion. compute persid=-8. Do if msamp=4. compute persid=pide-99000000. else if msamp=3. compute persid=pide-98000000. end if. desc pide persid. *now we have the original pid. formats wave to persid (f8.0). if age>80 age=80. rename variables (age ageimp=ageo ageimpo). compute age=ageo. compute ageimp=ageimpo. sort cases by msamp persid. save outfile="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/v6sexage.sav" /keep msamp persid sex age. **MERGE AND FINALISE THE FILES** ********************************. *HAF* *****. *Has all the background vars. get file='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/USA1998W581.sav'. sort cases by msamp persid. save outfile='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/USA1998W581.sav'. *has all the av codes and weights. get file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usa1998haf1.sav'. sort cases by msamp persid. save outfile= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usa1998haf1.sav'. *has badcase variable. get file ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/badcase.sav". sort cases by msamp persid. save outfile ="/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/badcase.sav". *This file has all the main69 codes. get file ='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/mainhaf.sav'. sort cases by msamp persid. match files /file=* /file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/USA1998W581.sav' /file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usa1998haf1.sav' /file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/badcase.sav' /by msamp persid. execute. if age>80 age=80. *get rid of extra digits. formats msamp to sppart (f8.0). apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw58schema.sav'. execute. val label educa 1 0 - 8th grade 2 9 - 11th grade 3 high school graduate 4 some college 5 college graduate 6 post college -7 not applicable -8 missing. var label edcat "Harmonised level of education". val label edcat 1 Uncompleted secondary or less 2 Completed secondary 3 Above secondary education -8 missing. val label incorig 1 "Less than $12,000" 2 "$12,001 to $20,000" 3 "$20,001 to $30,000" 4 "$30,001 to $50,000" 5 "$50,001 to $75,000" 6 "$75,001 to $100,000" 7 "$100,001 or more" -7 not applicable -8 missing. execute. *fix a small number of cases of working retired and unemployed people who *should be empstat=3. do if (retired=1 or student=1 or disab=1 or unemp=1) and workhrs>0. compute emp=1. compute empstat=3. end if. desc all. freq countrya survey swave msamp id parntid1 parntid2 partid day month year diary 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. sort cases by hldid persid id. save outfile='/Users/evrim/Dropbox/CTUR/USA/1998-2001/Harmonised Files/usa1998haf.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. get file='/Users/evrim/Dropbox/CTUR/USA/1998-2001/Harmonised Files/usa1998haf.sav'. *HEF* *****. get file '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usahef1.sav'. desc all. *cro year by msamp. *if msamp=4 and year=1998 year=1999. sort cases by msamp persid epnum. save outfile='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usahef1.sav' /keep countrya survey swave msamp hldid persid id day cday month year diary time clockst start end epnum av eloc ict inout mtrav alone child infant sppart oad. *this file has all the mains and secs. get file= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/mainsec.sav'. sort cases by msamp persid epnum. match files /file=* /table= "/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/badcase.sav" /table= "/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/v6sexage.sav" /by msamp persid. execute. freq age sex badcase. match files /file=* /file='/Users/evrim/Dropbox/CTUR/USA/1998-2001/temp/usahef1.sav' /by msamp persid epnum. execute. recode inout (sysmis=-8). formats msamp to oad (f8.0). apply dictionary from '/Users/evrim/Dropbox/CTUR/mtusw60schema.sav'. desc all. freq countrya survey swave msamp 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. sort cases by hldid persid id epnum. save outfile= '/Users/evrim/Dropbox/CTUR/USA/1998-2001/Harmonised Files/usa1998hef.sav' /keep countrya survey swave msamp hldid persid id day cday month year diary badcase sex age time clockst start end epnum main sec av inout eloc ict mtrav alone child sppart oad. *End of the syntax*.