************************************************ *SYNTAX TO CREATE World 5.5 FILES (6 July 2004)* ************************************************. Get file='R:\Soci 1205\Data Archives\Time Use Archives\Time Use Data Surveys\Norway\1971\Original\NOR1971orig.sav'. ************************************** *COMPUTATION OF DEMOGRAPHIC VARIABLES* **************************************. compute country = 5. compute period = 2. rename variables (survey = survold). compute survey = 1971. compute swave = 0. compute msamp = 0. compute id = newid. compute hldid = 0. recode var5 (7=1) (1=2) (2=3) (3=4) (4=5) (5=6) (6=7) (else=-8) into day. if range(var7,172,3172) month = 1. if range(var7,3272,6072) month = 2. if range(var7,6172,9172) month = 3. if range(var7,9272,12172) month = 4. if range(var7,12272,15272) month = 5. if range(var7,15372,18272) month = 6. if range(var7,18372,21372) month = 7. if range(var7,21472,24372) or (var7 = 40072) month = 8. if range(var7,24471,27371) month = 9. if range(var7,27471,30471) month = 10. if range(var7,30571,33471) month = 11. if range(var7,33571,36571) month = 12. compute year = (var7-trunc (var7/100)*100)+1900. *syntax to re-compute the missing and negative cases for *the original age variable from the year variable *note that age is needed to compute diary. if any(month,1,2,3,4,5,6,7,8) year1 = 1972. if any(month,9,10,11,12) year1 = 1971. if (var2 ge 0) and (var2 le 71) var2rec = var2 +1900. if (var2 gt 71) var2rec = var2 + 1800. compute tempage = year1-var2rec. recode var3 (sysmis = 0) (else = copy). if (var3 gt 0) newage = var3. if (var3 le 0) newage = tempage. execute. compute diary = 1. if (newage eq lag(newage)) diary = lag(diary) +1. save outfile = 'r:\soci 1205\data archives\time use archives\work files\junk\norpid1.sav'. vector y1_(7). compute y1_(diary) = newid. if (y1_1 ge 1) flag = 1. execute. save outfile = 'r:\soci 1205\data archives\time use archives\work files\junk\norpid2.sav'. select if flag = 1. compute flag1 = 1. if (flag eq lag (flag)) flag1 = lag(flag1)+1. save outfile = 'r:\soci 1205\data archives\time use archives\work files\junk\norpid2.sav' /keep = newid flag1. get file = 'r:\soci 1205\data archives\time use archives\work files\junk\norpid1.sav'. match files /file = * /file = 'r:\soci 1205\data archives\time use archives\work files\junk\norpid2.sav' /by newid. execute. recode flag1 (sysmis = 0). if (var3 = lag(var3)) and (flag1=0) flag1 = lag(flag1). compute persid = flag1. rename variables (sex = sexold). recode var1 (1=1) (2=2) (else=-8) into sex. compute age2 = newage. compute agegr5y = -8. if (age2 ge 0) and (age2 lt 5) agegr5y = 1. if (age2 ge 5) and (age2 lt 10) agegr5y = 2. if (age2 ge 10) and (age2 lt 15) agegr5y = 3. if (age2 ge 15) and (age2 lt 20) agegr5y = 4. if (age2 ge 20) and (age2 lt 25) agegr5y = 5. if (age2 ge 25) and (age2 lt 30) agegr5y = 6. if (age2 ge 30) and (age2 lt 35) agegr5y = 7. if (age2 ge 35) and (age2 lt 40) agegr5y = 8. if (age2 ge 40) and (age2 lt 45) agegr5y = 9. if (age2 ge 45) and (age2 lt 50) agegr5y = 10. if (age2 ge 50) and (age2 lt 55) agegr5y = 11. if (age2 ge 55) and (age2 lt 60) agegr5y = 12. if (age2 ge 60) and (age2 lt 65) agegr5y = 13. if (age2 ge 65) and (age2 lt 70) agegr5y = 14. if (age2 ge 70) and (age2 lt 75) agegr5y = 15. if (age2 ge 75) and (age2 lt 80) agegr5y = 16. if (age2 ge 80) agegr5y = 17. rename variables (famstat = famold). compute famstat = -8. recode var13 (sysmis=0) into var13. if (age2 ge 18) and (age2 le 39) and (var13 eq 0) famstat = 0. if (age2 ge 18) and any(var13,1,2) famstat = 1. if (age2 ge 18) and (var13 eq 3) famstat = 2. if (age2 ge 40) and (var13 eq 0) famstat = 3. if (age2 lt 18) famstat = 5. if (age2 lt 18) and (var18 eq 1) famstat = 4. compute cphome = -8. if (var18 eq 1) cphome = 1. if any(var18,2,3,4,5,6,7,8) cphome = 0. compute hhtype = -8. if (var11 eq 1) hhtype eq 1. if (var11 eq 2) and (var22 eq 2) hhtype = 2. if (var11 gt 2) and (var22 eq 2) hhtype = 3. if (var11 gt 1) and any(var22,1,3) hhtype = 4. compute singpar = -8. if (var18 eq 6) singpar = 1. if any(var18,1,2,3,4,5,7,8) singpar = 0. compute hhldsize = -8. recode var11 (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) into hhldsize. variable label hhldsize 'number of people in household'. compute nchild = var12. if (age2 lt 18) and (var18=1) nchild = 1. compute agekid = -8. recode var13 (0=-7) into agekid. if any(var13,1,2) agekid = 1. if (var13=3) agekid = 3. if (age2 lt 18) and (var18=1) agekid = 3. compute relrefp = -9. compute civstat = -8. if (var22=2) civstat = 1. if any(var22,1,3) civstat = 2. compute cohab = -9. recode var19 (1,2,3,4,5,6=3) (7,8,9=4) (else=-8) into empstat3. freq empstat3. if empstat3=3 and workhrs>29 empstat3=1. if empstat3=3 and (workhrs>0 and workhrs<30) empstat3=2. freq empstat3. recode empstat3 (1,2,3 =1) (4=0) (-8=-8) into emp. compute unemp = -9. recode var19 (7=1) (1,2,3,4,5,6,8,9=0) (else=-8) into student. recode var19 (9=1) (1,2,3,4,5,6,7,8=0) (else=-8) into retired. recode var30 (1=3) (2=4) (sysmis eq -7) (else=-8) into empsp. recode var15 (1=2) (2=7) (3=15) (4=25) (5=30) (6=sysmis) (else=copy). do if any(var14,1,2,3,4). recode var15 (sysmis=0) (else=copy). end if. recode var14 (1=15) (2=35) (3=45) (4=50) (else=copy). compute workhrs = sum(var15,var14). recode workhrs (sysmis = -7). compute incorig=var8. compute income = -8. if any(var8,1,8) income = 1. if any(var8,2,3) income = 2. if (var8=4) income = 3. compute empinclm=-9. compute educa = -9. compute edtry = -9. compute disab = -9. recode var25 (1 thru 6=1) (7 thru high =2) into urban. *********************************** *computation of time use variables* ***********************************. *the default value for all time use variables is 0 minutes - whether the study *coded the activity or not. note that if a variable cannot be created *it should be set to '0' and not to -9 at this stage. this is essential to select *'good diaries'. av variables that could not be created will then be recoded to *-9 later in the syntax. the code 'xx' should be replaced below by the *relevant time in minutes, or remain at 0 for diarists who did not record any of *the activity in their diary. rename variables (av1 = av1old) (av3=av3old) (av4=av4old) (av5=av5old) (av6=av6old) (av7=av7old) (av8=av8old) (av9=av9old) (av10=av10old) (av11=av11old) (av12=av12old) (av13=av13old) (av14=av14old) (av15=av15old) (av16=av16old) (av17=av17old) (av18=av18old) (av19=av19old) (av20=av20old) (av21=av21old) (av22=av22old) (av23=av23old) (av24=av24old) (av25=av25old) (av28=av28old) (av29=av29old) (av30=av30old) (av31=av31old) (av32=av32old) (av33=av33old) (av34=av34old) (av35=av35old) (av36=av36old) (av37=av37old) (av38=av38old) (av39=av39old) (av40=av40old) (av41=av41old). compute av1 = sum(act1,act2,act3,act5,act6,act7). compute av2 = 0. compute av3 = act4. compute av4 = sum(act36a,act36b,act37,act38,act39). compute av5 = sum(act8,act40). compute av6 = sum(act9,act10,act15). compute av7 = sum(act11,act12,act13,act14). compute av8 = sum(act17,act18a,act18b,act20,act28). compute av9 = act16. compute av10 = sum(act29,act30a,act30b,act30c,act33). compute av11 = sum(act21,act22.24,act23,act24,act25,act26). compute av12 = act35. compute av13 = act42. compute av14 = sum(act31,act31b,act32,act34). compute av15 = sum(act46,act47a,act47b). compute av16 = sum(act41,act43,act44). compute av17 = act94. compute av18 = sum(act55,act57,act61b). compute av19 = sum(act48,act49). compute av20 = act59. compute av21 = sum(act50,act52). compute av22 = act85. compute av23 = sum(act78,act80,act81,act82,act83,act84). compute av24 = sum(act60,act61a). compute av25 = sum(act62,act70,act72,act73.1,act73.2). compute av26 = 0. compute av27 = 0. compute av28 = act58. compute av29 = visitsa. compute av30 = act63. compute av31 = act64. compute av32 = act91. compute av33 = 0. compute av34 = act75. compute av35 = sum(act74,act76,act77). compute av36 = sum(act54,act93). compute av37 = act71. compute av38 = visitsb. compute av39 = 0. compute av40 = sum(act86,act88,act89,act90,act92). compute resid = act99. compute mistime = 1440 - (sum(av1 to av40) + resid). compute av41 = resid + mistime. compute avtot = sum (av1 to av40) + av41. execute. rename variables (kidcare=kidold) (visits=visold). compute paidetc=sum(av1,av2,av3,av5). compute hwork=av7. compute cooking=av6. compute eating=av15. compute kidcare=av11. compute shopping=av10. compute dtravel=av12. compute otravel=sum(av17,av18). compute perscare=sum(av13,av16). compute eatout=av28. compute pubclubs=sum(av26 to av27). compute spectat=sum(av20,av22 to av25). compute asports=av19. compute walking=av21. compute visits=sum(av29,av38). compute tvrad=sum(av30 to av32). compute reading=sum(av33 to av35). compute chatsetc=sum(av36 to av37). compute oddjobs=sum(av8 to av9). compute hobbies=sum(av39 to av40). compute medical=av14. compute educ=av4. execute. ****************************************************************** *selection of good diaries and recoding of selected av variables * ******************************************************************. compute tottime=rnd(sum(av1 to av40) + av41). execute. *note that the '-15' below is a selection criteria to identify diaries that do not add up to our target number of minutes. select if (av41 ge -15 and av41 lt 61). execute. *recoding of selected time use variables to -9 (only for variables that could not be computed for this survey). recode av2 av26 av27 av33 av39 (0=-9). execute. save outfile='r:\soci 1205\data archives\time use archives\time use data surveys\norway\1971\world 5.5\nor1971w552.sav' /keep=country period survey swave msamp id hldid persid day month year diary sex age2 agegr5y famstat cphome hhtype singpar hhldsize nchild agekid relrefp civstat cohab empstat3 emp unemp student retired empsp workhrs incorig income empinclm educa edtry disab urban paidetc hwork cooking eating kidcare shopping dtravel otravel perscare eatout pubclubs spectat asports walking visits tvrad reading chatsetc oddjobs hobbies medical educ tottime av1 to av40 av41. ************************ *computation of weights* ************************. *original survey weights. compute opopwt = 0. compute odaywt = 0. compute ocombwt = 0. *post-hoc population and day weights (to be computed only when original weights *are not available). if (age2 ge 10) and (age2 le 19) oriagegr = 1. if (age2 ge 20) and (age2 le 24) oriagegr = 2. if (age2 ge 25) and (age2 le 29) oriagegr = 3. if (age2 ge 30) and (age2 le 34) oriagegr = 4. if (age2 ge 35) and (age2 le 39) oriagegr = 5. if (age2 ge 40) and (age2 le 44) oriagegr = 6. if (age2 ge 45) and (age2 le 49) oriagegr = 7. if (age2 ge 50) and (age2 le 54) oriagegr = 8. if (age2 ge 55) and (age2 le 59) oriagegr = 9. if (age2 ge 60) and (age2 le 64) oriagegr = 10. if (age2 ge 65) and (age2 le 69) oriagegr = 11. if (age2 ge 70) and (age2 le 74) oriagegr = 12. if (age2 ge 75) oriagegr = 13. do if (sex eq 1). if (oriagegr eq 1) popwt2 = 2.4268. if (oriagegr eq 2) popwt2 = 1.1160. if (oriagegr eq 3) popwt2 = 0.8956. if (oriagegr eq 4) popwt2 = 0.7986. if (oriagegr eq 5) popwt2 = 0.8839. if (oriagegr eq 6) popwt2 = 0.6984. if (oriagegr eq 7) popwt2 = 0.8131. if (oriagegr eq 8) popwt2 = 0.7948. if (oriagegr eq 9) popwt2 = 0.8728. if (oriagegr eq 10) popwt2 = 0.8577. if (oriagegr eq 11) popwt2 = 0.9075. if (oriagegr eq 12) popwt2 = 0.9161. if (oriagegr eq 13) popwt2 = 4.6344. end if. do if (sex eq 2). if (oriagegr eq 1) popwt2 = 2.2929. if (oriagegr eq 2) popwt2 = 1.1149. if (oriagegr eq 3) popwt2 = 0.5726. if (oriagegr eq 4) popwt2 = 0.6392. if (oriagegr eq 5) popwt2 = 0.6963. if (oriagegr eq 6) popwt2 = 0.9072. if (oriagegr eq 7) popwt2 = 0.8749. if (oriagegr eq 8) popwt2 = 0.7548. if (oriagegr eq 9) popwt2 = 0.7696. if (oriagegr eq 10) popwt2 = 0.8304. if (oriagegr eq 11) popwt2 = 1.1381. if (oriagegr eq 12) popwt2 = 1.0668. if (oriagegr eq 13) popwt2 = 5.3216. end if. sort cases by sex oriagegr day. aggregate out= 'r:\soci 1205\data archives\time use archives\work files\junk\nor71-12.tmp'/break=sex oriagegr day /daycnt1=n. aggregate out='r:\soci 1205\data archives\time use archives\work files\junk\nor71-21.tmp'/break=sex oriagegr /wkcount1=n. match files file=* /table='r:\soci 1205\data archives\time use archives\work files\junk\nor71-12.tmp' /by sex oriagegr day. match files file=* /table='r:\soci 1205\data archives\time use archives\work files\junk\nor71-21.tmp' /by sex oriagegr. execute. compute daywt2 eq (wkcount1/7)/daycnt1. *computation of the proposed weight. compute propwt = (popwt2*daywt2)/1.00. recode propwt (sysmis = 0). recode popwt2 (sysmis = 0). recode daywt2 (sysmis = 0). execute. ************************************************ *formatting of variables and saving of outfile * ************************************************. apply dictionary from 'y:\all\mtus\mtusw552schema.sav'. val lab incorig 1 '<15 000 kr' 2 '15 - 29 000 kr' 3 '30-44 000 kr' 4 '45 000 kr or more' 8 'no independant income'. save outfile='r:\soci 1205\data archives\time use archives\time use data surveys\norway\1971\world 5.5\nor1971w552.sav' /keep=country period survey swave msamp hldid persid id day month year diary sex age2 agegr5y famstat cphome hhtype singpar hhldsize nchild agekid relrefp civstat cohab empstat3 emp unemp student retired empsp workhrs incorig income empinclm educa edtry disab urban paidetc hwork cooking eating kidcare shopping dtravel otravel perscare eatout pubclubs spectat asports walking visits tvrad reading chatsetc oddjobs hobbies medical educ tottime 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 opopwt odaywt ocombwt popwt2 daywt2 propwt.