****************************************************** ****************************************************** *Syntax producing 1998-2001 US Heritage Files and * *US MTUS files * *Created by Evrim Altintas, CTUR, Oxford * *with contributions from Roger Patulny and Kimberly * *Fisher. Last update 13 July 2013 * ****************************************************** ******************************************************. *The syntax produces AHTUS for 1998-1999 Family Interacton, Social Capital and *Trends in Time Use as well as 1999-2001 National Survey of Parents. *The original files were downloaded from ICPSR website, though John Robinson *also provided copies of these files to CTUR. *Previously it was discovered that some IDs in 98-99 data were the same with *those in 2000-1 data. Thats' why for now we create a temporary unique id for *each year. In the final files, the combination of the survey and pid makes the unique *identifier for each case. ************************************* **COMBINE SURVEYS AND PREPARE DATA** *************************************. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep98.sav". compute pide=98000000+pid. desc pid pide. compute wave=1. freq wave. sort cases by pide. save outfile ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep98.sav". get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep99.sav". sort cases by pid. compute pide=99000000+pid. desc pid pide. compute wave=2. freq wave. sort cases by pide. save outfile ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep99.sav". get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav". compute pide=98000000+pid. desc pid pide. compute wave=1. sort cases by pide. save outfile ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav". get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav". sort cases by pid. compute pide=99000000+pid. desc pid pide. compute wave=2. sort cases by pide. save outfile ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav". *Now all files have one unique personal identifier which is called pide. *add sex age variable which will be used to check matching and will be included in HEF file. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav" /keep wave pide rsex p3a. compute age=98-p3a. freq age rsex. add files /file=* /file= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav" /keep wave pide rsex age ageflag ageimp. execute. recode age (sysmis=-8) (-1=-8) (else=copy). desc all. *In 99-2001 survey there are 387 cases where age is missing (pg. 200). *The data producers created a variable, ageimp by using predicted values for age for the missing *cases. recode ageimp(sysmis=-11) (else=copy). compute ageimp2=rnd(ageimp). compute rage=age. If rage<0 and ageimp>0 rage=ageimp2. freq rage. *rage includes both imputed and actual values of age for 99-2001 data. sort cases by pide. compute test=0. if pide=lag(pide)test=1. freq test. *all identifiers unique. sort cases by pide. save outfile ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\98_99agesex.sav" /keep wave pide rage rsex. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\98_99agesex.sav". freq wave. *Combined original episode files with age/sex information. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep98.sav". rename variables (actbtime actetime location intdate intday=start end where date day). compute surveye=1998. add files /file=* /file= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep99.sav". execute. recode surveye (sysmis=1999) (else=copy). freq surveye. sort cases by surveye pide actno. match files /file=* /table= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\98_99agesex.sav" /by pide. execute. sort cases by pide. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep98_99.sav" /drop totkidt. sort cases by actcode. execute. temp. select if actcode<10. cro fact by actcode. ******************************************************************************************************** *There is a problem with dates variable in this survey, the code below is used to compare and *check out the inconsistencies between dates and actual calendar. ********************************************************************************************************. *MONTH* *******. *compute month=trunc(date/10000). *temp. *select if surveye=1999. *cro month by year. *CDAY* ******. *freq date. *compute cday=trunc(date/100)-trunc(date/10000)*100. *freq cday. *cro cday by month. *save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday_ep.sav" /keep pid pide wave cday year month day date. *get file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav". *rename variables (pday=day). *compute year=(date-trunc(date/100)*100)+1900. *if year=1900 year=2000. *freq year. *compute month=trunc(date/10000). *freq month. *compute cday=trunc(date/100)-trunc(date/10000)*100. *freq cday. *compute wave=1. *save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday_98.sav" /keep pid pide wave cday year month day date. *get file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav". *freq day. *compute year=(date-trunc(date/100)*100)+1900. *if year=1900 year=2000. *freq year. *compute month=trunc(date/10000). *freq month. *compute cday=trunc(date/100)-trunc(date/10000)*100. *freq cday. *compute wave=2. *save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday_99.sav" /keep pid pide wave cday year month day date. *get file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday_98.sav". *add files file=* /file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday_99.sav". *execute. *desc all. *rename variables (cday year month day date=cdaya yeara montha daya datea). *sort cases by pide. *save outfile = "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday9998a.sav" . *get file = "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday_ep.sav". *aggregate /outfile=* /break pide /cday=max(cday) /year=max(year) /month=max(month) /day=max(day) /date=max(date). *sort cases by pide. *match files /file=* /file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\cday9998a.sav" /by pide. *execute. *compute survey=6. *if wave=2 survey=8. *cro wave by survey. *In 38 cases in 99, aggregate file always says the first day *the ep file is 28,30 or 31. one day before.. *In 1999 the date and day on the episode file is correct. *save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\datest.sav". ************************************************* *** CREATE AHTUS DIARY VARIABLES **************** *************************************************. get file "/Users/evrim/Dropbox/CTUR/USA/1998-2001/US_ep98_99.sav". get file "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_ep98_99.sav". *DIARYDAY* **********. freq day. *YEAR/ MONTH /CDAY* *******************. compute year=(date-trunc(date/100)*100)+1900. if year=1900 year=2000. cro year by surveye wave. *There is one diary part of 1999-2001 survey but was coded as 1988 in the date. *We believe it's a typo and well code this one as 2000. temp. select if year=1998 and surveye=1999. freq pide rsex rage. if year=1998 and surveye=1999 year=2000. compute cday=-9. compute month=-9. *HHID* ******. compute hhid=pid. *SURVEY* ********. freq wave. *Wave will later be coded as 1 for all. compute survey=6. if wave=2 survey=8. var lab survey survey period. val lab survey 0 "1965-1966 USA Szalai Jackson sample" 1 "1965-1966 USA national sample" 2 "1975-1976 longitudinal survey" 3 "1985 Univ Michigan survey" 4 "1992-1994 NHAPS survey" 5 "1995 NHAPS extension survey" 6 "1998-1999 Family Interaction, Social Capital" 7 "2003-2012 ATUS" 8 "1999-2001 National Survey of Parents". freq survey. *WAVE* ******. freq wave. var lab wave diary wave. *START - END * *****************. *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. 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. temp. select if starto>60 and starto<180. cro starto by start. temp. select if endo>60 and endo<180. cro endo by end. *CLOCKST* *********. compute clockst=starto. *EPNUM* *******. 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. temp. select if surveye=1998. cro actno by epnum. *TIME* ******. 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. *DIARYDAY* **********. recode day (1=2) (2=3) (3=4) (4=5) (5=6) (6=7) (7=1) into diaryday. var lab diaryday day of week diary kept. val lab diaryday -8 missing 1 Sunday 2 Monday 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday. cro day by diaryday. *TIME USE ACTIVITY CATEGORIES* ******************************. val label actcode 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 conversations 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. *There are several differences in activity labelling between 98 and 99 files. *In 1999 file 46=resting, 53=email, 73=videos,78=telephone conversation,88=walking/hiking,7 work breaks *In 1998 file 46=not used, 53=not used, 73=theater, 78=other social, 88=not used, 7 not used compute main=-5. compute sec=-9. compute inout=-5. compute athom=-5. var lab main main activity. var lab sec secondary activity. var lab inout "inside, outside or in vehicle". val lab inout -9 not present in study -8 location unknown 1 outside 2 inside 3 in a vehicle. var lab athom activity at own home. val lab athom -8 location unknown 0 not at home 1 at own home. val lab main -7 NA -8 item missing 1 general or other personal care 2 imputed unknown personal care 3 sleep 4 imputed sleep 5 naps and rest 6 wash, dress, personal care 7 personal medical care 8 meals at work 9 other meals & snacks 10 "main paid work (not at home)" 11 paid work at home 12 second job, other paid work 13 work breaks 14 other time at workplace 15 time looking for work 16 regular schooling, education 17 homework 18 short course or training 19 oc lecture, other ed or train 20 food preparation, cooking 21 "set table, wash/put away dishes" 22 cleaning 23 laundry, ironing, clothing repair 24 home repairs, maintain vehicle 25 other domestic work 26 purchase routine goods 27 purchase consumer durables 28 purchase personal services 29 purchase medical services 30 purchase repair, laundry services 31 "financial/government services" 32 purchase other services 33 care of infants 34 general care of older children 35 medical care of children 36 play with children 37 "supervise/help with homework" 38 "read to, talk with child" 39 other child care 40 adult care 41 general voluntary acts 42 political and civic activity 43 union and professional activities 44 "volunteer child/family organization" 45 volunteer fraternal organization 46 other formal volunteering 48 acts for religious organisation 49 worship and religious acts 50 "general out-of-home leisure" 51 attend sporting event 52 go to cinema 53 theater, concert, opera 54 museums, exhibitions 55 attend other public event 56 cafe bar restaurant 57 parties or receptions 58 imputed time away form home 60 sports & exercise 62 walking 63 cycling 64 outdoor recreation 65 "phys act/sports with child" 66 hunting, fishing, boating, hiking 67 gardening 68 pet care, walk dogs 70 general indoor leisure 71 "imputed in-home social" 72 receive or visit friends 73 other in-home social, games 74 play musical instrument, sing, act 75 artistic activity 76 crafts 77 hobbies 78 relax, think, do nothing 81 read books 82 read periodicals 83 read newspapers 84 "listen to music (cd etc.)" 85 listen to radio 86 watch television, video 87 writing by hand 88 conversation, phone, texting 89 use computer 90 imputed travel 91 travel related to personal care 92 travel as part of paid work 93 "travel to/from work + oth work trav" 94 travel related to education 95 travel related to consumption 96 travel related to child care 97 travel for adult care, vol, worship 98 other travel. val lab sec -9 not present in study -7 NA -8 item missing 0 no secondary activity 1 general or other personal care 2 imputed unknown personal care 3 sleep 4 imputed sleep 5 naps and rest 6 wash, dress, personal care 7 personal medical care 8 meals at work 9 other meals & snacks 10 "main paid work (not at home)" 11 paid work at home 12 second job, other paid work 13 work breaks 14 other time at workplace 15 time looking for work 16 regular schooling, education 17 homework 18 short course or training 19 oc lecture, other ed or train 20 food preparation, cooking 21 "set table, wash/put away dishes" 22 cleaning 23 laundry, ironing, clothing repair 24 home repairs, maintain vehicle 25 other domestic work 26 purchase routine goods 27 purchase consumer durables 28 purchase personal services 29 purchase medical services 30 purchase repair, laundry services 31 "financial/government services" 32 purchase other services 33 care of infants 34 general care of older children 35 medical care of children 36 play with children 37 "supervise/help with homework" 38 "read to, talk with child" 39 other child care 40 adult care 41 general voluntary acts 42 political and civic activity 43 union and professional activities 44 "volunteer child/family organization" 45 volunteer fraternal organization 46 other formal volunteering 48 acts for religious organisation 49 worship and religious acts 50 "general out-of-home leisure" 51 attend sporting event 52 go to cinema 53 theater, concert, opera 54 museums, exhibitions 55 attend other public event 56 cafe bar 57 parties or receptions 60 sports & exercise 62 walking 63 cycling 64 outdoor recreation 65 "phys act/sports with child" 66 hunting, fishing, boating, hiking 67 gardening 68 pet care, walk dogs 70 general indoor leisure 71 "imputed in-home social" 72 receive or visit friends 73 other in-home social, games 74 play musical instrument, sing, act 75 artistic activity 76 crafts 77 hobbies 78 relax, think, do nothing 81 read books 82 read periodicals 83 read newspapers 84 "listen to music (cd etc.)" 85 listen to radio 86 watch television, video 87 writing by hand 88 conversation, phone, texting 89 use computer 90 imputed travel 91 travel related to personal care 92 travel as part of paid work 93 "travel to/from work + oth work trav" 94 travel related to education 95 travel related to consumption 96 travel related to child care 97 travel for adult care, vol, worship 98 other travel. freq main sec inout athom. *WHO ELSE WAS PRESENT* *********************. compute alone=0. compute infant=-9. compute child=0. compute sppart=0. compute clsfam=0. compute hhadult=0. compute cowork=0. compute wellknw=0. compute otherp=0. compute unknwp=0. compute shoprof=0. compute animal=0. 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. *There is no hhold grid so no information on the age of the people who were present *during the activity. So we cannot create infant. If who1=1 alone=1. If who1=3 or who2=3 or who1=4 or who2=4 child=1. If who1=2 or who1=4 or who2=2 or who2=4 sppart=1. if who1=2 or who1=3 or who1=4 or who2=2 or who2=3 or who2=4 clsfam=1. If who1=0 or (who1>4 and who1<8) or (who2>4 and who2<8) otherp=1. if who1=8 or who2=8 unknwp=1. If who1=5 or who2=4 cowork=1. if (who1>1 and who1<8) or (who2>1 and who2<8) wellknw=1. if actcode=18 or secact1=18 animal=1. freq animal. temp. select if where>4 and where<10 and who1=8. freq actcode. if where>4 and where<10 and who1=8 and ((actcode>29 and actcode<39) or (actcode>50 and actcode<53)) shoprof=1. freq shoprof. *ELOC* ******. 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. recode where (0,3=9) (4=3) (6=5) (7=4) (8=6) (10,11,12,13=8) (99=-8) (else=copy) into eloc. val label eloc 1 own home 2 other home 3 workplace 4 school 5 services or shops 6 restaurant, cafe, bar 7 place of worship 8 travelling 9 other. cro where by eloc. if eloc=-8 test=1. execute. *checked these cases visually. if pide=99021331 and eloc=-8 eloc=3. if pide=99061932 and eloc=-8 eloc=1. freq eloc. *No missings. temp. select if where<10 and (actcode=3 or actcode=9 or actcode=29 or actcode=39 or actcode=49 or actcode=59 or actcode=69 or actcode=89 or actcode=99). cro actcode by where. *In 163 cases the activity is travel but location is not. *if location is other and activity is religious activity, we code the loc as place of worship. if where =0 and actcode=65 eloc=7. *INOUT* *******. compute inout=-5. var lab inout "inside, outside or in vehicle". val lab inout -9 not present in study -8 location unknown 1 outside 2 inside 3 in a vehicle. *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 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=88 or actcode=89 or actcode=99 or secact1=3 or secact1=9 or secact1=29 or secact1=39 or secact1=49 or secact1=59 or secact1=69 or secact1=79 or secact1=88 or secact1=89 or secact1=99) and (where=13)). compute inout=1. Else if where=3. compute inout=1. Else if ((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=10 or where=11 or where=12)). compute inout=3. Else if actcode=10 or actcode=11 or actcode=12 or actcode=19 or actcode=24 or actcode=33 or actcode=40 or actcode=44 or actcode=45 or actcode=47 or actcode=55 or actcode=72 or (wave=1 and actcode=73) or actcode=74 or secact1=10 or secact1=11 or secact1=12 or secact1=19 or secact1=24 or secact1=33 or secact1=40 or secact1=44 or secact1=45 or secact2=47 or secact2=55 or secact1=72 or (wave=1 and secact1=73) or secact1=74. compute inout=2. Else if where=11 or where=12. compute inout=3. Else if (where=4 and actcode=1) or where=5 or where=6. compute inout=2. Else. compute inout=-8. End if. freq inout. temp. select if inout=-5. freq secact1 secact2. *The cases where al secacts are missing are not coded inout. Code them as -8. If inout=-5 inout=-8. execute. cro where by inout. temp. select if inout=1. freq actcode where. *minor 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. temp. select if inout=-8. freq actcode where. *MTRAV* *******. compute mtrav=-5. val labels mtrav -9 not present in the study -8 not answered -7 not traveling 1 car, truck, motorcycle 2 public, mass transport 3 walk 4 cycle 5 other or unspecified. Do if where=11. compute mtrav=1. else if where=12. compute mtrav=2. else if where=13 or actcode=88. compute mtrav=3. else if where=10 and (where<9 and (actcode=3 or actcode=9 or actcode=29 or actcode=39 or actcode=49 or actcode=59 or actcode=69 or actcode=89 or actcode=99)). compute mtrav=5. else if where=-8 or where>0 and where<8. compute mtrav=-7. End if. cro where by mtrav. If mtrav=-5 and (where=0 or where=8) mtrav=-7. if mtrav=-5 and where=10 mtrav=5. if mtrav=-5 mtrav=-8. cro eloc by mtrav. if mtrav=-8 and (eloc=1 or eloc=3) mtrav=-7. cro mtrav by inout. if mtrav=1 or mtrav=2 or mtrav=5 inout=3. cro eloc by inout. temp. select if inout=-8 and mtrav=3. cro actcode by eloc. if mtrav=3 and inout=3 inout=1. if mtrav=3 and inout=-8 inout=1. *************************** *mtrav and inout checklist* ***************************. * (1) most cases of mtrav=3(walk) should be inout=1(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) vast majority of cycling must be inout=1(outside). * (5) mtrav=5(travel by unknown means) should be inout=3(in a vehicle, almost all of it will be in a vehicle). temp. select if eloc=8 and inout=1. freq actcode. If eloc=8 and inout=1 and (actcode~=25 and actcode~=88) inout=3. cro eloc by mtrav. temp. select if eloc=9 and mtrav=3. freq actcode. if eloc=9 and mtrav=3 eloc=8. cro mtrav by inout. if inout=3 and mtrav=3 inout=1. cro eloc by mtrav inout. temp. select if eloc=8 and inout=2. cro mtrav by actcode where. if eloc=8 and inout=2 and actcode=47 test1=1. if eloc=8 and inout=2 and actcode=24 test2=1. execute. *checked these cases visually. If test1=1 or test2=1 mtrav=-7. If test1=1 or test2=1 eloc=1. execute. aggregate /outfile=* mode=addvariables /BREAK=pide /sumtot=sum(time). freq sumtot. *all adds to 1440!. sort cases by pide. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_1.sav". get file "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_1.sav". freq actcode. *Note that in two cases (73 and 78) activity labels are different for 1998 and 1999. *MAIN* ******. Do If actcode < 1 or actcode > 99. Compute main = -8. Else If actcode = 45. Compute main = 3. Else If actcode = 48 and where <> 4. Compute main = 1. Else If actcode = 46. Compute main = 5. Else If actcode = 40. Compute main = 6. Else If actcode = 44 and where <> 4. Compute main = 6. Else If actcode = 47. Compute main = 6. Else If actcode = 41. Compute main = 7. Else If actcode = 6. Compute main = 8. Else If actcode = 43. Compute main = 9. Else If actcode = 1 and where <> 1. Compute main = 10. Else If actcode = 1 and where = 1. Compute main = 11. Else If actcode = 5. Compute main = 12. Else If actcode = 8 or actcode=7. Compute main = 13. 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 = 52 or actcode=55. Compute main = 19. Else If actcode = 10. Compute main = 20. Else If actcode = 11. Compute main = 21. Else If actcode = 12. Compute main = 22. Else If actcode = 13. Compute main = 22. Else If actcode = 14. Compute main = 23. Else If actcode = 15. Compute main = 24. Else If actcode = 16. Compute main = 24. Else If actcode = 19. Compute main = 25. Else If 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 = 35. Compute main = 30. Else If 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. Compute main = 46. Else If actcode = 68. Compute main = 46. Else If actcode = 64. Compute main = 48. Else If actcode = 65. Compute main = 49. Else If actcode = 71. Compute main = 50. Else If actcode = 70. Compute main = 51. Else If actcode = 72 . Compute main = 52. Else If actcode = 73 and surveye=1998. Compute main = 53. Else If actcode = 74. Compute main = 54. Else if actcode=78 and surveye=1999. compute main=88. Else If actcode = 78 and where <> 4 and surveye=1998. Compute main = 55. Else If actcode = 77. Compute main = 56. Else If actcode = 76 and where <> 4. Compute main = 57. Else If actcode = 80. Compute main = 60. Else If actcode = 82. Compute main = 60. Else If actcode=88 or (actcode = -8 and where = 13). Compute main = 62. 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 or (actcode=73 and surveye=1999). Compute main = 86. Else If actcode = 97. Compute main = 87. Else If actcode = 96. Compute main = 88. Else if actcode = 53. Compute main = 89. Else if actcode = 56. Compute main = 89. Else if actcode = 57. Compute main = 89. Else if 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. Compute main = 98. Else If actcode = 89. Compute main = 98. Else If actcode = 99. Compute main = 98. Else If (actcode <> 1 or actcode<>5 or actcode<>8 or actcode<>2) and where = 4. Compute main = 14. End if. freq main. temp. select if main=-8. freq pide actno eloc. *Checked this case visually. good diary with missing time at the end of the day after dinner. *Code as imputed sleep. If pide=99061932 and epnum=46 and main=-8 main=4. *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. freq secact1 secact2. recode secact1 (sysmis=-8) (else=copy). recode secact2 (sysmis=-8) (else=copy). temp. select if secact2>19 and secact2<30. freq secact1 time. *In 159 cases first secondary act is no ccare but second is. Do If secact1 < 1 or secact1 > 99. Compute sec = 0. Else If secact1 = 45. Compute sec = 3. Else If secact1 = 48 and where <> 4. Compute sec = 1. Else If secact1 = 46. Compute sec = 5. Else If secact1 = 40. Compute sec = 6. Else If secact1 = 44 and where <> 4. Compute sec = 6. Else If secact1 = 47. Compute sec = 6. Else If secact1 = 41. Compute sec = 7. Else If secact1 = 6. Compute sec = 8. Else If secact1 = 43. Compute sec = 9. Else If secact1 = 1 and where <> 1. Compute sec = 10. Else If secact1 = 1 and where = 1. Compute sec = 11. Else If secact1 = 5. Compute sec = 12. Else If secact1 = 8. Compute sec = 13. Else If secact1 = 2. Compute sec = 15. Else If secact1 = 50. Compute sec = 16. Else If secact1 = 54. Compute sec = 17. Else If secact1 = 51. Compute sec = 18. Else If secact1 = 52 or secact1=55. Compute sec = 19. Else If secact1 = 10. Compute sec = 20. Else If secact1 = 11. Compute sec = 21. Else If secact1 = 12. Compute sec = 22. Else If secact1 = 13. Compute sec = 22. Else If secact1 = 14. Compute sec = 23. Else If secact1 = 15. Compute sec = 24. Else If secact1 = 16. Compute sec = 24. Else If secact1 = 19. Compute sec = 25. Else If secact1 = 38. Compute sec = 25. Else If secact1 = 30. Compute sec = 26. Else If secact1 = 31. Compute sec = 27. Else If secact1 = 32. Compute sec = 28. Else If secact1 = 33. Compute sec = 29. Else If secact1 = 35. Compute sec = 30. Else If secact1 = 36. Compute sec = 30. Else If secact1 = 34. Compute sec = 31. Else If secact1 = 37. Compute sec = 32. Else If secact1 = 20. Compute sec = 33. Else If secact1 = 21. Compute sec = 34. Else If secact1 = 26. Compute sec = 35. Else If secact1 = 24. Compute sec = 36. Else If secact1 = 22. Compute sec = 37. Else If secact1 = 23. Compute sec = 38. Else If secact1 = 27. Compute sec = 39. Else If secact1 = 42. Compute sec = 40. Else If secact1 = 63. Compute sec = 41. Else If secact1 = 62. Compute sec = 42. Else If secact1 = 60. Compute sec = 43. Else If secact1 = 67. Compute sec = 44. Else If secact1 = 66. Compute sec = 45. Else If secact1 = 61. Compute sec = 46. Else If secact1 = 68. Compute sec = 46. Else If secact1 = 64. Compute sec = 48. Else If secact1 = 65. Compute sec = 49. Else If secact1 = 71. Compute sec = 50. Else If secact1 = 70. Compute sec = 51. Else If secact1 = 72. Compute sec = 52. Else If secact1 = 73 and surveye=1998. Compute sec = 53. Else If secact1 = 74. Compute sec = 54. Else if secact1=78 and surveye=1999. compute sec=88. Else If secact1 = 78 and where <> 4. Compute sec = 55. Else If secact1 = 77. Compute sec = 56. Else If secact1 = 76 and where <> 4. Compute sec = 57. Else If secact1 = 80. Compute sec = 60. Else If secact1 = 82. Compute sec = 60. Else If secact1=88 or ((secact1 = 0 or secact1 = 9999) and where = 13). Compute sec = 62. Else If secact1 = 81. Compute sec = 64. Else If secact1 = 25. Compute sec = 65. Else If secact1 = 17. Compute sec = 67. Else If secact1 = 18. Compute sec = 68. Else If secact1 = 75. Compute sec = 72. Else If secact1 = 87. Compute sec = 73. Else If secact1 = 86. Compute sec = 74. Else If secact1 = 85. Compute sec = 75. Else If secact1 = 84. Compute sec = 76. Else If secact1 = 83. Compute sec = 77. Else If secact1 = 98. Compute sec = 78. Else If secact1 = 93. Compute sec = 81. Else If secact1 = 94. Compute sec = 82. Else If secact1 = 95. Compute sec = 83. Else If secact1 = 92. Compute sec = 84. Else If secact1 = 90. Compute sec = 85. Else If secact1 = 91 or (actcode=73 and surveye=1999). Compute sec = 86. Else If secact1 = 97. Compute sec = 87. Else If secact1 = 96. Compute sec = 88. Else if secact1 = 53. Compute sec = 89. Else if secact1 = 56. Compute sec = 89. Else if secact1 = 57. Compute sec = 89. Else if secact1= 58. Compute sec = 89. Else If secact1 = 49. Compute sec = 91. Else If secact1 = 3. Compute sec = 92. Else If secact1 = 9. Compute sec = 93. Else If secact1 = 59. Compute sec = 94. Else If secact1 = 39. Compute sec = 95. Else If secact1 = 29. Compute sec = 96. Else If secact1 = 69. Compute sec = 97. Else If secact1 = 79. Compute sec = 98. Else If secact1 = 89. Compute sec = 98. Else If secact1 = 99. Compute sec = 98. Else If (secact1 <> 1 or secact1<>5 or secact1<>8 or secact1<>2) and where = 4. Compute sec = 14. End if. freq sec. temp. select if sec<15. cro secact1 by sec. temp. select if sec>14 and sec<28. cro secact1 by sec. temp. select if sec>27 and sec<42. cro secact1 by sec. temp. select if sec>41 and sec<56. cro secact1 by sec. temp. select if sec>55 and sec<70. cro secact1 by sec. temp. select if sec>69 and sec<84. cro secact1 by sec. temp. select if sec>83. cro secact1 by sec. *Old code, create inconsistencies.We use eloc for location. *Do if where=1 or (actcode=11 or actcode=12 or actcode=19). *compute athom=1. *Else if where>1 or (actcode=50 or (actcode>31 and actcode<36) or actcode=8 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 eloc by athom. 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 locunk=0. compute inhome=0. compute away=0. compute homeunk=0. compute walone=0. compute wchild=0. compute wsppart=0. compute wclsfam=0. compute wother=0. compute withunk=0. compute athome=0. compute elsewhr=0. compute atwrksc=0. compute lunk=0. var lab t0pcare total minutes in personal care. var lab t1paidw total minutes in paid work. var lab t2ed total minutes in education. var lab t3unpaid total minutes unpaid work. var lab t4acvol total min adult care, relig or volunt. var lab t5outhm total minutes out of home activities. var lab t6exerc total minutes in sport and exercise. var lab t7inhm total minutes in home activities. var lab t8media total minutes use media & communication. var lab t9trav total minutes travelling. var lab tmiss "missing (no main activity recorded or imputed)". var lab eatdr total minutes eating & drinking. var lab sleep total minutes sleep and rest. var lab perscare total minutes personal care. var lab ccare total minutes child care. var lab acare total minutes adult care. var lab petcare total minutes pet care. var lab outside time outside. var lab inveh time in vehicle. var lab inside time inside. var lab locunk time outside or inside unknown. var lab inhome time at own home. var lab away time away from own home. var lab homeunk not know if at own home or away. var lab walone total minutes alone. var lab wchild total minuts with a child. var lab wsppart "total minutes with spouse/partner". var lab wclsfam total minutes with close family. var lab wother total minutes wth other people. var lab withunk total minutes unknown with whom. var lab athome total minutes at own home. var lab elsewhr total minutes at other location. var lab atwrksc total minutes at work. var lab lunk total minutes unknown location. *If actcode=45(sleeping) or actcode=40(bathing) no question on who else *present was asked. We code these cases as alone=0. 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 eatdr =time. If main=3 or main=5 sleep =time. If main=0 or main=6 or main=7 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 inout=-8 locunk =time. if eloc=1 athome =time. If child=1 wchild =time. If actcode=45 or actcode=4 alone=0. If alone=1 walone =time. If sppart=1 wsppart =time. If clsfam=1 wclsfam =time. If otherp=1 wother =time. if unknwp=1 withunk =time. if eloc=3 or eloc=4 atwrksc =time. if eloc=2 or eloc>4 elsewhr =time. If eloc=-8 lunk =time. execute. desc t0pcare t1paidw t2ed t3unpaid t4acvol t5outhm t6exerc t7inhm t8media t9trav eatdr sleep tmiss outside inside inveh locunk wchild walone wsppart wclsfam wother withunk. *aggregate /outfile='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01testag.SAV' /break=pide /tottime 'total minutes recorded' = SUM(time) /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) /outside = SUM(outside) /inside = SUM(inside) /inveh = SUM(inveh) /locunk = SUM(locunk) /inhome = SUM(inhome) /away = SUM(away) /homeunk = SUM(homeunk) /day = MAX(diaryday) /sex = MAX(rsex) . freq sec. vector tmain(98) tsc(98). Do repeat a=tmain1 to tmain98 /b=tsc1 to tsc98 /i=1 to 98. compute a=0. compute b=0. if main=i a=time. if main=i and (sec>32 and sec<41) b=time. End repeat. execute. compute t1dig = SUM(t0pcare to tmiss). compute t2dig = SUM (tmain1 to tmain98). compute t2dig = t2dig + tmiss. execute. desc tmain1 to tmain98. desc tsc1 to tsc98. apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\schema2.sav'. recode tmain2 tmain45 tmain58 tmain63 tmain66 tmain70 tmain71 tmain90 (0=-9). recode tsc2 tsc45 tsc58 tsc63 tsc66 tsc70 tsc71 tsc90 (0=-9). execute. *Previous code: *set all variable codes which could not be constructed to -9 for missing. *recode tm2 tm4 tm63 tm66 tm70 tm71 tm90 (0=-9). sort cases by pide. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_2.sav". get file "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_2.sav". aggregate /outfile='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum.sav' /break=survey wave hhid pide /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 = SUM(tmain4) /tmain5 = SUM(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 = SUM(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 = SUM(tmain43) /tmain44 = SUM(tmain44) /tmain45 = MAX(tmain45) /tmain46 = SUM(tmain46) /tmain48 = SUM(tmain48) /tmain49 = SUM(tmain49) /tmain50 = SUM(tmain50) /tmain51 = SUM(tmain51) /tmain52 = SUM(tmain52) /tmain53 = SUM(tmain53) /tmain54 = SUM(tmain54) /tmain55 = SUM(tmain55) /tmain56 = SUM(tmain56) /tmain57 = SUM(tmain57) /tmain58 = MAX(tmain58) /tmain60 = SUM(tmain60) /tmain62 = SUM(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 = SUM(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 = MAX(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 = SUM(tsc1) /tsc2 = MAX(tsc2) /tsc3 = SUM(tsc3) /tsc4 = SUM(tsc4) /tsc5 = SUM(tsc5) /tsc6 = SUM(tsc6) /tsc7 = SUM(tsc7) /tsc8 = SUM(tsc8) /tsc9 = SUM(tsc9) /tsc10 = SUM(tsc10) /tsc11 = SUM(tsc11) /tsc12 = SUM(tsc12) /tsc13 = SUM(tsc13) /tsc14 = SUM(tsc14) /tsc15 = SUM(tsc15) /tsc16 = SUM(tsc16) /tsc17 = SUM(tsc17) /tsc18 = SUM(tsc18) /tsc19 = SUM(tsc19) /tsc20 = SUM(tsc20) /tsc21 = SUM(tsc21) /tsc22 = SUM(tsc22) /tsc23 = SUM(tsc23) /tsc24 = SUM(tsc24) /tsc25 = SUM(tsc25) /tsc26 = SUM(tsc26) /tsc27 = SUM(tsc27) /tsc28 = SUM(tsc28) /tsc29 = SUM(tsc29) /tsc30 = SUM(tsc30) /tsc31 = SUM(tsc31) /tsc32 = SUM(tsc32) /tsc33 = SUM(tsc33) /tsc34 = SUM(tsc34) /tsc35 = SUM(tsc35) /tsc36 = SUM(tsc36) /tsc37 = SUM(tsc37) /tsc38 = SUM(tsc38) /tsc39 = SUM(tsc39) /tsc40 = SUM(tsc40) /tsc41 = SUM(tsc41) /tsc42 = SUM(tsc42) /tsc43 = SUM(tsc43) /tsc44 = SUM(tsc44) /tsc45 = MAX(tsc45) /tsc46 = SUM(tsc46) /tsc48 = SUM(tsc48) /tsc49 = SUM(tsc49) /tsc50 = SUM(tsc50) /tsc51 = SUM(tsc51) /tsc52 = SUM(tsc52) /tsc53 = SUM(tsc53) /tsc54 = SUM(tsc54) /tsc55 = SUM(tsc55) /tsc56 = SUM(tsc56) /tsc57 = SUM(tsc57) /tsc58 = MAX(tsc58) /tsc60 = SUM(tsc60) /tsc62 = SUM(tsc62) /tsc63 = MAX(tsc63) /tsc64 = SUM(tsc64) /tsc65 = SUM(tsc65) /tsc66 = MAX(tsc66) /tsc67 = SUM(tsc67) /tsc68 = SUM(tsc68) /tsc70 = MAX(tsc70) /tsc71 = MAX(tsc71) /tsc72 = SUM(tsc72) /tsc73 = SUM(tsc73) /tsc74 = SUM(tsc74) /tsc75 = SUM(tsc75) /tsc76 = SUM(tsc76) /tsc77 = SUM(tsc77) /tsc78 = SUM(tsc78) /tsc81 = SUM(tsc81) /tsc82 = SUM(tsc82) /tsc83 = SUM(tsc83) /tsc84 = SUM(tsc84) /tsc85 = SUM(tsc85) /tsc86 = SUM(tsc86) /tsc87 = SUM(tsc87) /tsc88 = SUM(tsc88) /tsc89 = SUM(tsc89) /tsc90 = MAX(tsc90) /tsc91 = SUM(tsc91) /tsc92 = SUM(tsc92) /tsc93 = SUM(tsc93) /tsc94 = SUM(tsc94) /tsc95 = SUM(tsc95) /tsc96 = SUM(tsc96) /tsc97 = SUM(tsc97) /tsc98 = SUM(tsc98) /outside = SUM(outside) /inside = SUM(inside) /inveh = SUM(inveh) /locunk = SUM(locunk) /athome = SUM(athome) /atwrksc = SUM(atwrksc) /elsewhr = SUM(elsewhr) /lunk = SUM(lunk) /walone = SUM(walone) /wchild= SUM(wchild) /wsppart= SUM (wsppart) /wclsfam = SUM(wclsfam) /wother= SUM (wother) /withunk=SUM (withunk) /t1dig = SUM(t1dig) /t2dig = SUM(t2dig). get file 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum.sav'. *get rid of extra digits. formats survey to t2dig (f8.0). execute. *check that variables sum to 1440 in aggregated file. freq t1dig t2dig tottime. *All 1440! Yey!. sort cases by survey wave hhid pide. save outfile 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum.sav'. ********* *BADCASE* *********. *Create age_sex file* *********************. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav". freq wave. rename variables (rsex=sex). compute age= (date - trunc(date/100)*100)-p3a. if age=-1 or age=0 age=-8. compute ageimp=-9. sort cases by pide. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_agg98_sexage.sav" /keep wave pide age sex ageimp. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav" /keep wave pide age rsex ageimp. freq wave. rename variables (rsex=sex). add files file=* file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_agg98_sexage.sav". freq wave sex age ageimp. recode age (sysmis=-8) (else=copy). recode ageimp (sysmis=-8) (else=copy). sort cases by pide. save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_agg9899_sexage.sav". get file "C:\Documents and Settings\evrim.altintas\My Documents\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) /tmiss2=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 tmiss2. *we need sex and age information. sort cases by pide. match files files= * table="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_agg9899_sexage.sav" /by pide. execute. compute lowqual=0. execute. if tmiss2>90 or epnum<7 or misbasic>1 lowqual=1. freq lowqual. *25 1.1% bad diaries.-2326 good ones. recode tmiss2 (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 tmiss2 nep misbasic age sex. *If the person is missing 2+ basic acts but providing care he/she is flagged as carer. *The person flagged with caremflg is likely to combine one of the basic acts with care. cro anycare by misbasic. compute caremflg=0. if anycare=1 and misbasic=1 and epnum>6 caremflg=1. freq caremflg. *none in this case. temp. select if misbasic=1. freq pide. cro tmiss2 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. recode age (sysmis=1) (-8=1) (else=0)into baddem. recode ageimp (sysmis=1) (-8=1) (else=0)into baddemi. cro wave by baddem baddemi. sort cases by wave pide. save outfile ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\lowqual.sav" /keep wave pide lowqual baddem baddemi caremflg. get file 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum.sav' /drop t1dig t2dig. desc wave hhid pide. compute pid=hhid. sort cases by wave pide. match files /file=* /file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\lowqual.sav" /by wave pide. execute. apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\schema2.sav'. desc all. freq wave. *wave to be changed. sort cases by survey wave hhid pid. save outfile 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum2.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 inveh inside locunk athome atwrksc elsewhr lunk walone wchild wsppart wclsfam wother withunk lowqual baddem baddemi pide caremflg. *this file identical to the one above with the exception of hhid and baddemi. *this is to send to Kimberly. desc wave hhid pid. compute wave=1. sort cases by survey wave hhid pid. save outfile 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum3.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 inveh inside locunk athome atwrksc elsewhr lunk walone wchild wsppart wclsfam wother withunk lowqual baddem caremflg. *WEIGHTS* *********. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav" /keep wave pid pide wt daywt. add files file=* file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav" /keep wave pid pide wt daywt finalwt weight. sort cases by wave pide. match files /file=* /file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum2.sav" /by wave pide /keep wave pide pid baddem baddemi lowqual diaryday wt daywt finalwt weight . execute. sort cases by wave pide. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weight1.sav". *wt, daywt for 98. *finalwt weight for 99. *Use weight file to create origwght owghtflg xtimewt infltwt recwght. *change wave. get file "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_2.sav". sort cases by wave pide. match files file=* table="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\lowqual.sav" /by wave pide. compute wave=1. compute hhadult=-9. compute hhid=pid. apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\schema1.sav'. 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 lowqual baddem baddemi caremflg. freq survey wave diaryday year time clockst start end epnum main sec inout eloc mtrav alone infant child sppart clsfam hhadult animal shoprof cowork wellknw otherp unknwp lowqual baddem baddemi caremflg. compute cday=-9. compute month=-9. sort cases by survey wave hhid pid. save outfile= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_3.sav" /keep 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 lowqual baddem caremflg. *Create supplement file+weights* ********************************. get file "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weight1.sav". desc all. sort cases by wave pide. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weight1.sav". get file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_agg9899_sexage.sav". sort cases by wave pide. match files file=* file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weight1.sav" /by wave pide. formats wave to diaryday (f8.0). compute survey=6. if wave=2 survey=8. cro wave by survey. compute wave=1. compute hhid=pid. apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\questschema.sav'. execute. if age=97 age=92. formats ageimp (f8.2). freq ageimp. compute wave=1. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weightsupp.sav" /keep survey wave hhid pid sex age ageimp baddem baddemi lowqual diaryday daywt finalwt . get file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weightsupp.sav". freq diaryday sex survey. weight by DAYWT. freq diaryday sex survey. *daywt is population & day weight for FISCT. weight by FINALWT. freq diaryday sex survey. *finalwt is population & day weight for NSP. weight off. compute owghtflg=3. compute origwght=daywt. recode origwght (sysmis=-5). if origwght=-5 origwght=finalwt. desc origwght. temp. select if origwght=0. freq sex age. *even bad cases weighted in original data. recode age (-8=-8) (18 thru 24=1) (25 thru 34=2) (35 thru 44=3) (45 thru 54=4) (55 thru 64=5) (65 thru 74=6) (75 thru high=7) into agegp. compute agegpi=agegp. if agegp=-8 and (ageimp>17 and ageimp<25) agegpi=1. if agegp=-8 and (ageimp>24 and ageimp<35) agegpi=2. if agegp=-8 and (ageimp>34 and ageimp<45) agegpi=3. if agegp=-8 and (ageimp>44 and ageimp<55) agegpi=4. if agegp=-8 and (ageimp>54 and ageimp<65) agegpi=5. if agegp=-8 and (ageimp>64 and ageimp<75) agegpi=6. if agegp=-8 and ageimp>74 agegpi=7. val lab agegp agegpi 1 18-24 2 25-34 3 35-44 4 45-54 5 55-64 6 65-74 7 '75+'. freq agegp agegpi. cro agegpi by ageimp baddemi. cro agegp by ageimp baddem. *age groups above 54 not affected, younger ages minimally affected by imputation. if agegpi=-8 and ageimp=-7 baddemi=1. cro agegpi by baddemi. compute badcase=0. compute badcasei=0. if baddem=1 or lowqual=1 badcase=1. if baddemi=1 or lowqual=1 badcasei=1. cro badcase by baddem lowqual. cro badcasei by baddemi lowqual. compute agesexgp=agegp. if sex=2 and agegp>-8 agesexgp=agesexgp+10. compute agsexgpi=agegpi. if sex=2 and agegpi>-8 agsexgpi=agsexgpi+10. cro agesexgp by badcase. cro agsexgpi by badcasei. *allow for 0-weighting of the bad diary cases. if badcase>0 agesexgp=99. if badcasei>0 agsexgpi=99. cro agesexgp by badcase. cro agsexgpi by badcasei. compute w=origwght. compute wi=origwght. if agesexgp=99 w=0. if agsexgpi=99 wi=0. execute. compute walt=w. compute walti=wi. desc w wi walt walti. cro survey by agesexgp agsexgpi. *account for oversample of parents in NSP, treating all *missing but imputed ages as missing * * sex=1 %age grp sex=2 %age grp * men parents women parents *age 25-34 NSP 58 39.7 116 59.5 *age 25-34 all 163 253 * *age 35-44 NSP 152 59.4 221 72.5 *age 35-44 all 278 376 * *age 45-54 NSP 102 49.3 93 48.5 *age 45-54 all 188 194 *. Do if survey=8 and agesexgp=2. compute walt=walt*.397. Else if survey=8 and agesexgp=12. compute walt=walt*.595. Else if survey=8 and agesexgp=3. compute walt=walt*.594. Else if survey=8 and agesexgp=13. compute walt=walt*.725. Else if survey=8 and agesexgp=4. compute walt=walt*.493. Else if survey=8 and agesexgp=14. compute walt=walt*.485. End if. execute. Do if survey=6 and agesexgp=2. compute walt=walt*((163-58)/(163-(58*.397))). Else if survey=6 and agesexgp=12. compute walt=walt*((253-116)/(253-(116*.595))). Else if survey=6 and agesexgp=3. compute walt=walt*((278-152)/(278-(152*.594))). Else if survey=6 and agesexgp=13. compute walt=walt*((376-221)/(376-(221*.725))). Else if survey=6 and agesexgp=4. compute walt=walt*((188-102)/(188-(102*.493))). Else if survey=6 and agesexgp=14. compute walt=walt*((194-93)/(194-(93*.485))). End if. execute. *account for oversample of parents in NSP, treating all *imputed ages as valid ages * * sex=1 %age grp sex=2 %age grp * men parents women parents *age 25-34 NSP 82 39.7 199 59.5 *age 25-34 all 187 336 * *age 35-44 NSP 230 59.4 357 72.5 *age 35-44 all 356 512 * *age 45-54 NSP 114 49.3 111 48.5 *age 45-54 all 200 212 *. Do if survey=8 and agsexgpi=2. compute walti=walti*.397. Else if survey=6 and agsexgpi=2. compute walti=walti*((187-82)/(187-(82*.397))). Else if survey=8 and agsexgpi=12. compute walti=walti*.595. Else if survey=6 and agsexgpi=12. compute walti=walti*((336-199)/(336-(199*.595))). Else if survey=8 and agsexgpi=3. compute walti=walti*.594. Else if survey=6 and agsexgpi=3. compute walti=walti*((356-230)/(356-(230*.594))). Else if survey=8 and agsexgpi=13. compute walti=walti*.725. Else if survey=6 and agsexgpi=13. compute walti=walti*((512-357)/(512-(357*.725))). Else if survey=8 and agsexgpi=4. compute walti=walti*.493. Else if survey=6 and agsexgpi=4. compute walti=walti*((200-114)/(200-(114*.493))). Else if survey=8 and agsexgpi=14. compute walti=walti*.485. Else if survey=6 and agsexgpi=14. compute walti=walti*((212-111)/(212-(111*.485))). End if. desc walt walti. sort cases by agesexgp diaryday. aggregate out='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\group.sav' /break=agesexgp /grouptot=sum(w) /galttot=sum(walt) /groupn=nu. execute. aggregate out='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\day.sav' /break= agesexgp diaryday /daytot=sum(w) /dalttot=sum(walt) /dayn=nu. execute. match files file=* table='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\group.sav' /by agesexgp. execute. match files file=* table='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\day.sav' /by agesexgp diaryday. execute. compute exptot=(grouptot/7). compute xpalttot=(galttot/7). sort cases by agsexgpi diaryday. aggregate out='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\groupi.sav' /break=agsexgpi /grptoti=sum(wi) /galttoti=sum(walti) / groupni=nu. execute. aggregate out='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\dayi.sav' /break= agsexgpi diaryday /daytoti=sum(wi) /dalttoti=sum(walti) /dayni=nu. execute. match files file=* table='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\groupi.sav' /by agsexgpi. execute. match files file=* table='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\dayi.sav' /by agsexgpi diaryday. execute. compute exptoti=(grptoti/7). compute xalttoti=(galttoti/7). Do if badcase>0. compute recwght=0. Else if badcase=0. compute recwght=(exptot/daytot)/(dayn/daytot). End if. Do if badcase>0. compute recalt=0. Else if badcase=0. compute recalt=(xpalttot/dalttot)/(dayn/dalttot). End if. Do if badcasei>0. compute recwghti=0. Else if badcasei=0. compute recwghti=(exptoti/daytoti)/(dayni/daytoti). End if. Do if badcasei>0. compute recalti=0. Else if badcasei=0. compute recalti=(xalttoti/dalttoti)/(dayni/dalttoti). End if. weight off. var lab recalt recwght, adjusting parents into population proportion. var lab recalti recwght, with imputed ages & adjust parents to pop proportion. var lab recwghti recwght, with imputed ages. desc recwght recalt recwghti recalti origwght. weight by recwght. freq diaryday. weight by recalt. freq diaryday. weight by recwghti. freq diaryday. weight by recalti. freq diaryday. weight by origwght. freq diaryday. weight off. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=wave /wtsumo = SUM(origwght) /wtsum = SUM(recwght) /wtsumi = SUM(recwghti) /wtsuma = SUM(recalt) /wtsumai = SUM(recalti). freq wtsumo wtsum wtsumi wtsuma wtsumai. *inflate the propwt to the number of diaries from the survey. *compute the total number of diaries divided by the sum of the weight. compute recwght=recwght*(2351/1906.7). compute recalt=recalt*(2351/1433.43). compute recwghti=recwghti*(2351/2240.55). compute recalti=recalti*(2351/1585.86). AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=wave /wtsum1 = SUM(recwght) /wtsumi1 = SUM(recwghti) /wtsuma1 = SUM(recalt) /wtsumai1 = SUM(recalti). freq wtsum1 wtsumi1 wtsuma1 wtsumai1. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=agesexgp /wtsuminf = SUM(recwght). means wtsuminf by agesexgp. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=agsexgpi /wtsumini = SUM(recwghti). means wtsumini by agsexgpi. compute xtimewt=recwght. compute infltwt=0. compute infltwti=0. *see Excel file showing the population distributions *by age and sex from the CPS for 2000, to make total 9937103. if agegp=1 and sex=1 infltwt=recwght*(653137/129.8055). if agegp=2 and sex=1 infltwt=recwght*(943219/236.8833). if agegp=3 and sex=1 infltwt=recwght*(1101000/296.6948). if agegp=4 and sex=1 infltwt=recwght*(931841/253.2487). if agegp=5 and sex=1 infltwt=recwght*(604633/97.3432). if agegp=6 and sex=1 infltwt=recwght*(439866/59.9514). if agegp=7 and sex=1 infltwt=recwght*(159887/34.0205). if agegp=1 and sex=2 infltwt=recwght*(629871/216.2605). if agegp=2 and sex=2 infltwt=recwght*(952423/276.4537). if agegp=3 and sex=2 infltwt=recwght*(1133330/334.6978). if agegp=4 and sex=2 infltwt=recwght*(970814/199.7529). if agegp=5 and sex=2 infltwt=recwght*(656855/85.8801). if agegp=6 and sex=2 infltwt=recwght*(530402/73.9930). if agegp=7 and sex=2 infltwt=recwght*(229825/56.0099). if agegpi=1 and sex=1 infltwti=recwghti*(653137/110.4640). if agegpi=2 and sex=1 infltwti=recwghti*(943219/244.6919). if agegpi=3 and sex=1 infltwti=recwghti*(1101000/335.5799). if agegpi=4 and sex=1 infltwti=recwghti*(931841/228.6719). if agegpi=5 and sex=1 infltwti=recwghti*(604633/82.8387). if agegpi=6 and sex=1 infltwti=recwghti*(439866/51.0185). if agegpi=7 and sex=1 infltwti=recwghti*(159887/28.9514). if agegpi=1 and sex=2 infltwti=recwghti*(629871/189.6821). if agegpi=2 and sex=2 infltwti=recwghti*(952423/316.3087). if agegpi=3 and sex=2 infltwti=recwghti*(1133330/395.8736). if agegpi=4 and sex=2 infltwti=recwghti*(970814/183.2101). if agegpi=5 and sex=2 infltwti=recwghti*(656855/73.0836). if agegpi=6 and sex=2 infltwti=recwghti*(530402/62.9678). if agegpi=7 and sex=2 infltwti=recwghti*(229825/47.6642). desc xtimewt infltwt infltwti. weight by infltwt. freq diaryday agesexgp. weight by infltwti. freq diaryday agsexgpi. weight off. desc origwght owghtflg xtimewt xtimewt infltwt recwght. sort cases by survey pid. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\weightsupp2.sav". sort cases by survey pid. save outfile 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\ahtuswght.sav' /keep survey wave hhid pid origwght owghtflg xtimewt infltwt recwght. rename variables (ageimp=ageimpo). compute ageimp=ageimpo. freq survey wave. sort cases by survey pid. compute persid=pid. compute hldid=0. recode survey into (6=3) (8=4) into msamp. var lab msamp MTUS variable - multiple samples in study. var lab hldid MTUS variable - Household identifier. var lab persid 'MTUS variable - Person/diarist identifier'. var lab survey AHTUS variable - survey period. var lab hhid AHTUS variable - household id. var lab pid AHTUS variable - personal identifier. var lab recwghti recwghti recalt recalti infltwti baddemi ageimp. var lab recalt 'recwght (or MTUS propwt), adjusting parents into population proportion'. var lab recalti 'recwght (or MTUS propwt), with imputed ages & adjust parents to pop proportion'. var lab infltwti recwght (or MTUS propwt) inflated to national population with imputed ages. var lab baddemi 'age, sex or diary day missing (with imputed ages added)'. var lab ageimp imputed age contructed by John Robinson. val lab msamp 3 USA 1998-99 4 USA 1999-01. val lab hldid 0 1 person sampled per household. val lab baddemi 0 no 1 yes. var lab -9 age actually collected, not imputed -8 age still missing. save outfile 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01-extra-weights.sav' /keep msamp hldid persid survey hhid pid recwghti recalt recalti infltwti baddemi ageimp. get file= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\US_ep98_99_3.sav". sort cases by survey wave hhid pid. match files file=* table='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\ahtuswght.sav' /by survey wave hhid pid. ************************* ****SAVE EPISODE FILE**** *************************. apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\schema1.sav'. desc all. sort cases by survey wave hhid pid. save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\Harmonised Files\usa1998hfep.sav" /keep 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 lowqual baddem caremflg origwght owghtflg xtimewt infltwt recwght. *SAVE SUMMARY FILE* *******************. get file 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\USA1998-01hfsum3.sav'. sort cases by survey wave hhid pid. match files file=* file='C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\ahtuswght.sav' /by survey wave hhid pid. apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\schema2.sav'. sort cases by survey wave hhid pid. save outfile="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\Harmonised Files\usa1998hsum.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 inveh inside locunk athome atwrksc elsewhr lunk walone wchild wsppart wclsfam wother withunk lowqual baddem caremflg origwght owghtflg xtimewt infltwt recwght. *BACKGROUND VARIABLES FOR 1999-2001 NSP* ****************************************. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg99.sav" /drop act1 to who0 q1 q2 q3 to q5_f q6 to q20. desc all. *WAVE/ SURVEY* ***************. compute wave=2. compute survey=8. *HHID* ******. compute hhid=pide. *REGIONC/REGIONE /STATE* ************************. compute regionc=regn. *There is a mismatch between the state labels in the original survey and AHTUS codes. 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. cro area by state. recode state (13, 38, 48=0) (7, 20, 22, 30, 40, 46=1) (31,33=2) (8, 9, 21, 39, 47, 49=3) (14, 15, 23, 24, 36, 50=5) (4, 19, 32, 37, 44=6) (16, 18, 26, 28=7) (6, 27, 35, 42, 51=8) (3, 5, 29=9) (-8=-8) (else=4) into regione. cro state by regione. *URBAN/ OWNHOME* ****************. compute urban=-9. compute ownhome=-9. *SEX/ AGE / AGECAT* ******************. freq rsex. compute sex=rsex. recode age ageimp (sysmis=-8) (else=copy). freq age ageimp. *'imputed' age has only 29 missings. recode age (18 thru 24=1) (25 thru 34=2) (35 thru 44=3) (45 thru 54=4) (55 thru 64=5) (65 thru highest=6) (else=copy) into agecat. cro age by agecat. *ageflag. *ETHNIC2/ ETHNIC/ HISP* ***********************. recode p7 (2=0) (1=1) (9=-8) into hisp. execute. freq p7a. recode p7a (9=-8) (else=copy) into ethnic. cro ethnic by hisp. recode p7a (9=-8) (4=3) (else=copy) into ethnic2. cro p7a by ethnic2. *EDUC* ******. freq p8. recode p8 (1 thru 8=1)(9 thru 11=2) (12=3) (13 thru 15=4) (16=5) (17, 18 =6) (99=-8) into educ. cro p8 by educ. freq educ. *CIVSTAT/ COHAB/ MARFLAG/ EMPSP* ********************************. freq P6. recode p6 (1=1) (2,3=2) (4=3) (5=4) (9=-8) into civstat. compute cohab=-7. *This is for 75 diaries only. compute marrflag=-9. freq p5a. recode p5a (sysmis=-7) (9=-8) (3=4)(else=copy) into empsp. cro p5a by empsp. cro civstat by empsp. if civstat=-8 and empsp=-7 empsp=-8. *NADULT/ UNDER18* *****************. freq p1. recode p1 (99=-8) (else=copy) into nadult. cro p1 by nadult. *The respondent pide=99052627 reports only one adult at home, but she also *reports being married and having one child. We set this case as nadult=2. *Both her own and her partners' age is missing. if pide=99052627 nadult=2. *temp. *select if pide=99020324 or pide=99061641 or pide=99062111. *cro pide by p1 p2 p6 spoage. *The three adults above reported being married with child and are all above 35 but they *reported only one adult in the hhold. Code them as two adults. if pide=99020324 or pide=99061641 or pide=99062111 nadult=2. freq p2. recode p2 (99=-8) (else=copy) into under18. cro p2 by under18. *AGE YNGST* ***********. recode CHILD1_1 CHILD2_1 CHILD3_1 CHILD4_1 CHILD5_1 CHILD6_1 (sysmis=-8) (else=copy). freq CHILD1_1 CHILD2_1 CHILD3_1 CHILD4_1 CHILD5_1 CHILD6_1. *temp. *select if CHILD1_1=0. *freq CHILD1_1. *There are 5 cases with 0 value for age of oldest child but SPS doe snot recognize them?... *So I will recode them as 1... SPSS being stupid. If pid=11920 or pid=20899 or pid=21533 or pid=50576 or pid=51508 CHILD1_1=1. compute test=0. If child2_1>0 and child2_1>child1_1 test=1. freq test. *all must be 0 for all cases. temp. select if test=1. freq pid. *60936: an error in the ordering of children by age, youngest child is at the age of 7. *10836: an error in the ordering of children by age, youngest child is at the age of 6. *52404: an error in the ordering of children by age, youngest child is at the age of 15. *53449: an error in the ordering of children by age, youngest child is at the age of 9. *54034: an error in the ordering of children by age, youngest child is at the age of 10. *62068: an error in the ordering of children by age, youngest child is at the age of 2. *11445: an error in the ordering of children by age, youngest child is at the age of 5. *61682: an error in the ordering of children by age, youngest child is at the age of 5. *63520: an error in the ordering of children by age, youngest child is at the age of 1. compute ageyngst=-8. Do if child6_1>0. compute ageyngst=child6_1. Else if child5_1>0. compute ageyngst=child5_1. Else if child4_1>0. compute ageyngst=child4_1. Else if child3_1>0. compute ageyngst=child3_1. Else if child2_1>0. compute ageyngst=child2_1. Else if child1_1>0. compute ageyngst=child1_1. End if. freq ageyngst. *Fix thecases with wrong ordering of children:. If pid=60936 ageyngst=7. If pid=10836 ageyngst=6. If pid=52404 ageyngst=15. If pid=53449 ageyngst=9. If pid=54034 ageyngst=10. If pid=62068 ageyngst=2. If pid=11445 ageyngst=5. If pid=61682 ageyngst=5. If pid=63520 ageyngst=1. execute. freq ageyngst. temp. select if ageyngst=18. freq pid. *54825 reported having one child under age 18 but then reported the age of youngest child as 18!. *for now I ll code the age of youngest child as 17. But put a note on this in Read Me file. If pid=54825 ageyngst=17. freq ageyngst. *UNDER 5* ********. recode ageyngst (1 thru 4=1) (5 thru 17=0) (else=copy) into under5. cro ageyngst by under5. *FAMSTAT* *********. *Because all the respondents were aged 18 or older ANd because *they all have with at least one co-resident child aged uner 18 *we actually don't need to use age information to create famstat for this *particular survey. cro ageyngst by under5. Do if under5>0. compute famstat=1. Else if ageyngst ~= -8 and under18>0. compute famstat=2. Else. compute famstat=-8. end if. cro under5 under18 by famstat. means ageyngst age by famstat /cells = min max. *HHTYPE* *******. freq under18. *We know that all respodents have at least one child aged under 18. compute hhtype=0. Do if civstat=1. compute hhtype=1. Else if civstat>1 and sex=2. compute hhtype=3. Else if civstat>1 and sex=1. compute hhtype=5. else. compute hhtype=-8. end if. *KIDFLAG/ NKIDFLAG* *******************. compute kidflag=-9. compute nkidflag=-9. *54825 reported having one child under age 18 but then reported the age of youngest child as 18 *EMPSTAT / FULLTIME/ PARTTIME/ NOEMPLOY* ****************************************. freq p3a. recode p3a (sysmis=-8) (9=-8) (else=copy) into empstat. cro empstat by p3a p3b. cro p3b by p3a. recode empstat (1=1) (else=0) into fulltime. recode empstat (2=1) (else=0) into parttime. recode empstat (1,2,=0) (3=1)(else=copy) into noemploy. cro empstat by fulltime parttime noemploy. *WORKHRS/ OCCUPATION / WAGELM /NWORK /EMPFLAG/WKHRFLAG * *********************************************************. freq p3c_a. recode p3C_a (sysmis=-7) (99,98=-8) (else=copy) into wkhrs. cro wkhrs by empstat p3a. means wkhrs by empstat. compute occup=-9. compute wagelm=-9. compute nwork=-9. compute empflag=-9. compute wkhrflag=-9. *RETIRED/ HOMEMAKER/ STUDENT/ DISAB/UNEMP * ******************************************. recode p3b (sysmis=-7) (else=copy). recode p3b (1=1) (else=0) into retired. cro p3b empstat by retired. recode p3b (2=1) (else=0) into homemakr. cro p3b empstat by homemakr. recode p3b (4=1) (else=0) into student. cro student by empstat p3b. recode p3b (5=1) (else=0) into disab. freq disab. recode p3b (3=1) (else=0) into unemp. freq unemp. *INCOME98 / INCOMEQT* *********************. *I am excluding the so-called "imputed" cases according to the crosstabulation of hinc and hincome. cro HINC by hincome. compute income98=-8. Do if hinc=1 and hincome=1. compute income98=1. Else if hincome=1 and hinc=4. compute income98=2. Else if hincome=2 and hinc=5. compute income98=3. else if hincome=3 and hinc=6. compute income98=4. else if hincome=4 and hinc=7. compute income98=5. else if hincome=5 and hinc=10. compute income98=6. else if hincome=6 and hinc=12. compute income98=7. end if. cro income98 by hincome. cro hinc by income98. freq income98. recode income98 (1,2,3=1) (4=2) (5=3) (6,7=4) (-8=-8) into incomeqt. freq incomeqt. sort cases by survey wave hhid pid. save outfile= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\99quest.sav" /keep survey wave hhid pid state regionc regione urban ownhome age sex ethnic ethnic2 hisp educ civstat cohab marrflag famstat hhtype kidflag nadult under18 under5 ageyngst nkidflag fulltime parttime noemploy empstat occup unemp retired empsp disab student homemakr wkhrs nwork empflag wkhrflag wagelm incomeqt income98. *BACKGROUND VARIABLES FOR 1998-1999 FISCT* *****************************************. get file ="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\US_agg98.sav" /drop fone to b19a_b c1 to q4 q19 to q20h where00 to act99. desc all. *WAVE* ******. compute wave=1. compute survey=6. *HHID* ******. compute hhid=pide. *SEX/ AGE* **********. freq rsex. rename variables (rsex=sex). compute age= (date - trunc(date/100)*100)-p3a. if age=-1 or age=0 age=-8. freq age. *compute year= 1900 + (date - trunc(date/100)*100). *string dates (A6). *compute dates=string (date,F6.0). *CIVSTAT/ COHAB/ MARFLAG/ EMPSP* ********************************. cro P6 by marstat. recode p6 (1,6=1) (2,3=2) (4=3) (5=4) (9=-8) into civstat. freq civstat. recode p6 (6=1) (9=-8) (else=0) into cohab. cro civstat by cohab. *there were three cases where a spouse presence was indicated in the diary file. *original survey coded these as married in a marflag variable. WE will follow *their procedure. cro civstat by marstat. If civstat=4 and marstat=1 civstat=1. compute marflag=-9. cro zo_a by civstat. recode zo_a (0=4) (1 thru 20=2) (21 thru 97=1) (98, 99=-8) (sysmis=-7) into empsp. If empsp=-7 and civstat=1 empsp=-8. If civstat=-8 empsp=-8. cro empsp by civstat. *EDUC* ******. recode p5 (0 thru 8=1) (9 thru 11=2) (12=3) (13 thru 15=4) (16=5) (17,18=6) (sysmis=-8) into educ. cro p5 by educ. *REGIONC/ REGIONE/ STATE* *************************. rename variables (region=regionc). *There is a mismatch between the state labels in the original survey and AHTUS codes. recode state (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). freq state. recode state (13, 38, 48=0) (7, 20, 22, 30, 40, 46=1) (31,33=2) (8, 9, 21, 39, 47, 49=3) (14, 15, 23, 24, 36, 50=5) (4, 19, 32, 37, 44=6) (16, 18, 26, 28=7) (6, 27, 35, 42, 51=8) (3, 5, 29=9) (-8=-8) (else=4) into regione. *URBAN/ OWNHOME* ****************. compute urban=-9. compute ownhome=-9. *EMPSTAT/FULLTIME/ PARTTIME/ NOEMPLOY/ WORKHRS* ***********************************************. recode p7 (9=-8) (else=copy) into empstat. recode empstat (1=1) (-8=-8) (else=0) into fulltime. recode empstat (2=1) (-8=-8) (else=0) into parttime. recode empstat (1,2,=0) (3=1) (-8=-8)(else=copy) into noemploy. recode wrkhrs (sysmis=-7) (98,99=-8)(else=copy) into wkhrs. freq wrkhrs. *RETIRED/ HOMEMAKER/ STUDENT/ DISAB/UNEMP * ******************************************. recode p7a (sysmis=-7) (9=-8) (else=copy). recode p7a (1=1) (else=0) into retired. cro p7a empstat by retired. recode p7a (2=1) (else=0) into homemakr. cro p7a empstat by homemakr. recode p7a (4=1) (else=0) into student. cro student by empstat p7a. recode p7a (5=1) (else=0) into disab. freq disab. recode p7a (3=1) (else=0) into unemp. freq unemp. *NADULT/ UNDER18/ UNDER5* *************************. recode p1 (99=-8) (else=copy) into nadult. recode p2 (9=-8) (else=copy) into under18. freq p2a. Compute under5=-8. Do if under18=0. compute under5=0. else if p2a=9. compute under5=-8. else. compute under5=p2a. end if. *The question is asked only to those who reported at least 1 child under 18. *P2a asks whether there is a child aged 6 or younger. cro under18 by under5. cro nadult by under18. *FAMSTAT* *********. *All the respondents are aged 18 or older. But there are several cases with missing value for age. freq age under18. Do if under18=0 and (age>0 and age<40). compute famstat=0. Else if under18=0 and age>39. compute famstat=3. Else if age>0 and under5>0. compute famstat=1. Else if age>0 and under18>0. compute famstat=2. else. compute famstat=-8. end if. temp. select if age>0. cro under18 under5 by famstat. *55 cases with missing age and 3 casses missing presence of children. *HHTYPE* *******. freq under18. cro under18 by civstat. compute hhtype=-99. Do if under18=-8. compute hhtype=-8. else if civstat=1 and under18>0. compute hhtype=1. Else if civstat=1 and under18=0. compute hhtype=2. Else if civstat>1 and sex=2 and under18>0. compute hhtype=3. Else if civstat>1 and sex=2 and under18=0. compute hhtype=4. Else if civstat>1 and sex=1 and under18>0. compute hhtype=5. Else if civstat>1 and sex=1 and nadult=1. compute hhtype=6. Else if sex=2 and civstat>1 and nadult=1. compute hhtype=7. Else if sex=2 and civstat>1. compute hhtype=7. else. compute hhtype=8. end if. *ETHNIC/ETHNIC2/ HISP* *********************. recode p4a (4=3)(sysmis=-8) (else=copy) into ethnic2. cro p4a by ethnic2. recode p4 (9=-8) (else=copy) into hisp. recode p4a (sysmis=-8) (else=copy) into ethnic. cro ethnic by hisp. *INCOME 98/ INCOMEQT* *********************. recode hincome1 (99=-8) (else=copy) into income98. cro income98 by hincome1. recode income98 (1,2,3=1) (4=2) (5=3) (6,7=4) (-8=-8) into incomeqt. freq incomeqt. compute occup=-9. compute wagelm=-9. compute nwork=-9. compute empflag=-9. compute wkhrflag=-9. compute ageyngst=-7. compute marrflag=-9. compute kidflag=-9. compute nkidflag=-9. sort cases by survey wave hhid pid. save outfile= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\98quest.sav" /keep survey wave hhid pid state regionc regione urban ownhome age sex ethnic ethnic2 hisp educ civstat cohab marrflag famstat hhtype kidflag nadult under18 under5 ageyngst nkidflag fulltime parttime noemploy empstat occup unemp retired empsp disab student homemakr wkhrs nwork empflag wkhrflag wagelm incomeqt income98. get file= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\99quest.sav". add files file=* /file="C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\temp\98quest.sav". desc all. *no system missings. sort cases by hhid. compute test=0. if hhid=lag(hhid) test=1. freq test. freq wave. *as the variable survey distinguishes the two surveys, we do not need the altered household id created above *to make a unique identifier for each case, turn hhid back to = pid. compute hhid=pid. *original survey has variables called PID and AGE which are in all caps - as the AHTUS and *MTUS variables are in all lower case, address this by renaming the original variables *and then reconstructing the variables in lower case. rename variables (pid age=pidorig ageorig). compute age=ageorig. compute pid=pidorig. ******** *AGECAT* ********. recode age (18 thru 24=1) (25 thru 34=2) (35 thru 44=3) (45 thru 54=4) (55 thru 64=5) (65 thru 97=6) (else=copy) into agecat. formats survey to income98 (f8.0). apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\questschema.sav'. execute. desc all. freq cohab ageyngst. var lab cohab "with unmarried cohabiting partner". val lab cohab -9 not asked -8 missing or dirty on the case record -7 not applicable or refusal 0 no 1 yes. if age=97 age=92. compute wave=1. desc survey wave hhid pid. freq survey wave state regionc regione urban ownhome age sex ethnic ethnic2 hisp educ civstat cohab marrflag famstat hhtype kidflag nadult under18 under5 ageyngst nkidflag fulltime parttime noemploy empstat occup unemp retired empsp disab student homemakr wkhrs nwork empflag wkhrflag wagelm incomeqt income98. sort cases by survey wave hhid pid. save outfile= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\Harmonised Files\usa98_01quest.sav" /keep survey wave hhid pid state regionc regione urban ownhome age sex ethnic ethnic2 hisp educ civstat cohab marrflag famstat hhtype kidflag nadult under18 under5 ageyngst nkidflag fulltime parttime noemploy empstat occup unemp retired empsp disab student homemakr wkhrs nwork empflag wkhrflag wagelm incomeqt income98. get file= "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\Harmonised Files\usa98_01quest.sav". apply dictionary from 'C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\questschema.sav'. sort cases by survey wave hhid pid. save outfile "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\Harmonised Files\usa98_01quest.sav". get file "C:\Documents and Settings\evrim.altintas\My Documents\Dropbox\CTUR\USA\1998-2001\Harmonised Files\usa98_01quest.sav".