---------------------------------------------------------------------------------------------------------------------------------------- log: /disk/nber10/SCCS/morg/sources/annual05.log log type: text opened on: 1 Mar 2006, 14:49:49 . set memory 1000m (1024000k) . set more 1 . *primary family and child variables added 2000-04-20 by Jean Roth, jroth@nber.org . *Y2K compliance by Jean Roth, jroth@nber.org, 2001-01-15 . *Imputed highest grade completed, ihigrdc, added by Jean Roth, jroth@nber.org, 2003-01-20 . *Stata 8 compliance by Jean Roth, jroth@nber.org, 2003-02-28 . *matching variables added by Jean Roth, jroth@nber.org, 2003-02-12 . * run with nohup stata -b do annual2002 & to run in batch mode . do rw . . program rw 1. * grab the annual file . * keep data from the relevant month . * sort by revised weight merge variables . * merge using the revised weight monthly file, 'rwmonyy.dta' . * save the merged file as 'mon' . use /homes/data/morg/annual/rw/annual 2. keep if intmonth==`3' 3. quietly describe 4. display "`3' `2' obs " r(N) 5. local rwlist qstnum intmonth year occurnum 6. sort `rwlist' 7. merge `rwlist' using /homes/data/morg/annual/rw/rw`2'`1' 8. drop if _merge == 2 9. save /homes/data/morg/annual/rw/`2', replace 10. end . end of do-file . program define aef2 1. local dct_name "aef`3'.dbd" 2. local raw_name "../raw/morg`2'" 3. display "dct_name `dct_name'" 4. display "raw_name `raw_name'" 5. *quietly infile using "`dct_name'" if age>15&age!=. , using("`raw_name'") clear . quietly infile using "`dct_name'" if age>15&age!=. in 1/100 , using("`raw_name'") clear 6. *quietly infile using "`dct_name'" in 1/100 , using("`raw_name'") clear . *quietly infile using aef if age>15&age!=. . display "infile successful" 7. #delimit cr delimiter now cr . generate int year = `1' 8. *summarize . tab intmonth if `1'==2005 9. * Geography . display "Geography" 10. if `1' == 2005 { 11. replace serial = serial04 12. replace hhnum = hhnum04 13. display "dropping cmsacode msafips smsa93" 14. drop cmsacode msafips smsa93 15. replace smsa04 = . if smsa04<2 & intmonth >= 5 16. } 17. display "smsasize = . if smsasize <=0" 18. capture replace smsasize = . if smsasize <=0 19. display "replace smsastat = . if smsastat==3 | smsastat<0" 20. replace smsastat = . if smsastat==3 | smsastat<0 21. display "replace smsasize=. if smsasize<=0" 22. **should line below be commented out??? . capture replace smsasize=. if smsasize<=0 23. display "drop smsasize" 24. capture drop smsasize 25. * Demography . display "Demography" 26. if `1' > 1991 { 27. replace grade92 = . if grade92 < 0 28. } 29. if `1' >= 1998 { 30. replace ged = . if ged < 0 31. replace gedhigr = . if gedhigr < 0 32. replace yrcoll = . if yrcoll < 0 33. replace grprof = . if grprof < 0 34. replace gr6cor = . if gr6cor < 0 35. replace ms123 = . if ms123 < 0 36. generate double ihigrdc = . 37. ** Jaeger . label var ihigrdc "Imputed highest grade completed" 38. replace ihigrdc = 0 if grade92==31 39. replace ihigrdc = 2.5 if grade92==32 40. replace ihigrdc = 5.5 if grade92==33 41. replace ihigrdc = 7.5 if grade92==34 42. replace ihigrdc = 9 if grade92==35 43. replace ihigrdc =10 if grade92==36 44. replace ihigrdc =11 if grade92==37 45. replace ihigrdc =12 if grade92==38 46. replace ihigrdc = 0 if grade92==39 & ged==2 & gedhigr==1 47. replace ihigrdc = 2.5 if grade92==39 & ged==2 & gedhigr==2 48. replace ihigrdc = 5.5 if grade92==39 & ged==2 & gedhigr==3 49. replace ihigrdc = 7.5 if grade92==39 & ged==2 & gedhigr==4 50. replace ihigrdc = 9 if grade92==39 & ged==2 & gedhigr==5 51. replace ihigrdc = 10 if grade92==39 & ged==2 & gedhigr==6 52. replace ihigrdc = 11 if grade92==39 & ged==2 & gedhigr==7 53. replace ihigrdc = 12 if grade92==39 & ged==2 & gedhigr==8 54. replace ihigrdc = 12 if ged==1 55. replace ihigrdc = 12 if grade92>=40 & grade92<=42 & yrcoll==1 56. replace ihigrdc = 13 if grade92>=40 & grade92<=42 & yrcoll==2 57. replace ihigrdc = 14 if grade92>=40 & grade92<=42 & yrcoll==3 58. replace ihigrdc = 15 if grade92>=40 & grade92<=42 & yrcoll==4 59. replace ihigrdc = 16 if grade92>=40 & grade92<=42 & yrcoll==5 60. replace ihigrdc = 16 if grade92==43 & grprof==2 61. replace ihigrdc = 17 if grade92==43 & gr6cor==2 62. replace ihigrdc = 18 if grade92==43 & gr6cor==1 63. replace ihigrdc = 17 if grade92==44 & ms123==1 64. replace ihigrdc = 18 if grade92==44 & ms123>=2 & ms123<. 65. replace ihigrdc = 18 if grade92==45 | grade92==46 66. } 67. if `1' >= 1994 { 68. replace penatvty = . if penatvty < 0 69. replace pemntvty = . if pemntvty < 0 70. replace pefntvty = . if pefntvty < 0 71. replace prcitshp = . if prcitshp < 0 72. replace prcitflg = . if prcitflg < 0 73. } 74. if `1' > 1989 { 75. replace ethnic = . if ethnic < 0 76. replace ethnic = . if ethnic >= 10 77. } 78. if `1' == 2005 { 79. display "replacing veteran and dropping vet1-vet4 if intmonth <=7" 80. replace veteran = . if veteran < 0 & intmonth <= 7 81. replace vet1=. if intmonth <= 7 82. replace vet2=. if intmonth <= 7 83. replace vet3=. if intmonth <= 7 84. replace vet4=. if intmonth <= 7 85. } 86. if `1' == 2005 { 87. display "setting veteran to missing and vet1-vet4 to missing" 88. replace veteran = . if intmonth >= 8 89. replace vet1 = . if vet1 < 0 & intmonth >= 8 90. replace vet2 = . if vet2 < 0 & intmonth >= 8 91. replace vet3 = . if vet3 < 0 & intmonth >= 8 92. replace vet4 = . if vet4 < 0 & intmonth >= 8 93. } 94. . * Employment . display "Employment" 95. #delimit ; delimiter now ; . ; . display "docc00" ; 96. if `1' >= 2000 { > display "generate int docc00=occ00;"; 97. generate int docc00=occ00; 98. display "recode docc00"; 99. recode docc00 (10/430=1) (500/950=2) (1000/1240=3) (1300/1560=4) (1600/1960=5) > (2000/2060=6) (2100/2150=7) (2200/2550=8) (2600/2960=9) (3000/3540=10) (3600/3650=11) > (3700/3950=12) (4000/4160=13) (4200/4250=14) (4300/4650=15) (4700/4960=16) > (5000/5930=17) (6000/6130=18) (6200/6940=19) (7000/7620=20) (7700/8960=21) > (9000/9750=22) (9840=23); 100. } ; 101. display "dind"; 102. if `1' >= 2000 { > display "replacing dind for `1' >= 2000 " ; 103. gen dind02 = ind02; 104. recode > dind02 (170/180 290=1) (190/280=2) (370/490=3) (770=4) (2470/2590=5) > (2670/2990=6) (3070/3290=7) (3360/3390=8) (3470 3490=9) (3570/3690=10) > (3770/3870=11) (3890=12) (3960/3990=13) (1070/1290=14) (1370 1390=15) > (1470/1790=16) (1870/1990=17) (2070 2090=18) (2170/2290=19) (2370/2390=20) > (4070/4590=21) (4670/5790=22) (6070/6390=23) (570/690=24) (6470/6490=25) > (6570 6590=26) (6670=27) (6675=28) (6680 6690=29) (6692 6695=30) > (6770 6780=31) (6870/6970=32) (6990=33) (7070=34) (7080/7190=35) > (7270/7490=36) (7570=37) (7580/7780=38) (7790=39) (7860/7890=40) > (8190=41) (7970/8180 8270 8290=42) (8370/8470=43) (8560/8590=44) (8660 8670=45) > (8680 8690=46) (8770/8890=47) (8970/9090=48) (9160/9190=49) (9290=50) > (9370/9590=51) (9890=52) ; 105. } ; 106. #delimit cr delimiter now cr . **Wages (If earnings are 0, then wage rate is missing, not zero). . display "Wages" 107. replace paidhr = . if paidhr <=0 108. replace paidhre = . if paidhre <=0 109. replace earnhr = . if earnhr <=0 110. replace earnhre = . if earnhre <=0 111. replace earnwke = . if earnwke < 0 112. if `1' >= 1989 { 113. replace eligible = 2 if eligible <= 0 114. } 115. if `1' >= 1994 { 116. replace I25a = 0 if I25a <= 3 117. replace I25b = 0 if I25b <= 3 118. *replace I25a = . if I25a < 0 . *replace I25b = . if I25b < 0 . replace earnhre = . if earnhre ==1 119. replace uhourse = . if lfsr94 >2 | lfsr94 <1 120. replace lfsr94 = . if lfsr94 < 0 121. } 122. if `1' >= 1996 { 123. replace I25c = . if I25c < 0 124. replace I25d = . if I25d < 0 125. } 126. ** Hours, Unions . display "Hours, Unions" 127. if `1' >= 1994 { 128. replace reason94 = . if reason94< 0 129. replace absent94 = . if absent94< 0 130. replace studftpt = . if studftpt< 0 131. replace schenr = . if schenr < 0 132. replace schlvl = . if schlvl < 0 133. replace ftpt94 = . if ftpt94 < 0 134. replace hourslw = . if hourslw < 0 135. replace hourslw = 99 if hourslw >99 & hourslw != . 136. replace uhourse = . if uhourse < 0 137. replace why3594 = . if why3594 < 0 138. replace unionmme = . if unionmme< 0 139. replace unioncov = . if unioncov< 0 140. } 141. . ** Save and exit . compress 142. saveold /home/data/morg/annual/morg`2',replace 143. summarize 144. clear 145. *! /usr/bin/rm -f aef.dct /tmp/aef.raw . *! /bin/rm -f aef.dct /tmp/aef.raw . ! /usr/bin/chmod a+r /home/data/morg/annual/morg`2'.dta 146. ! /bin/chmod a+r /home/data/morg/annual/morg`2'.dta 147. ! /usr/bin/chmod g+w /home/data/morg/annual/morg`2'.dta 148. ! /bin/chmod g+w /home/data/morg/annual/morg`2'.dta 149. ! /usr/bin/chgrp web /home/data/morg/annual/morg`2'.dta 150. ! /bin/chgrp web /home/data/morg/annual/morg`2'.dta 151. end . . *Each block of commands does one year of the data. The data must be . *decompressed, and possibly have dashes converted to blanks. . *Then a dictionary for the particular year is prepared by . *concatenating a one line header (with the file name) to a generic . *dictionary body that covers several years of data that used the . *same format. . *Lastly, the data is read, modified, summarized and saved. . . aef2 2005 05 03 dct_name aef03.dbd raw_name ../raw/morg05 infile successful Interview | Month | Freq. Percent Cum. ------------+----------------------------------- 8 | 69 100.00 100.00 ------------+----------------------------------- Total | 69 100.00 Geography (69 real changes made) (69 real changes made) dropping cmsacode msafips smsa93 (0 real changes made) smsasize = . if smsasize <=0 replace smsastat = . if smsastat==3 | smsastat<0 (0 real changes made) replace smsasize=. if smsasize<=0 drop smsasize Demography (0 real changes made) (55 real changes made, 55 to missing) (67 real changes made, 67 to missing) (48 real changes made, 48 to missing) (51 real changes made, 51 to missing) (63 real changes made, 63 to missing) (65 real changes made, 65 to missing) (69 missing values generated) (0 real changes made) (0 real changes made) (0 real changes made) (2 real changes made) (4 real changes made) (0 real changes made) (3 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (1 real change made) (0 real changes made) (1 real change made) (12 real changes made) (2 real changes made) (6 real changes made) (10 real changes made) (3 real changes made) (0 real changes made) (12 real changes made) (1 real change made) (5 real changes made) (1 real change made) (3 real changes made) (3 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (69 real changes made, 69 to missing) (0 real changes made) replacing veteran and dropping vet1-vet4 if intmonth <=7 (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) setting veteran to missing and vet1-vet4 to missing (69 real changes made, 69 to missing) (59 real changes made, 59 to missing) (67 real changes made, 67 to missing) (68 real changes made, 68 to missing) (69 real changes made, 69 to missing) Employment docc00 recode docc00 (docc00: 50 changes made) dind (dind02: 50 changes made) Wages (52 real changes made, 52 to missing) (0 real changes made) (62 real changes made, 62 to missing) (0 real changes made) (0 real changes made) (52 real changes made) (21 real changes made) (52 real changes made) (0 real changes made) (21 real changes made, 21 to missing) (0 real changes made) (62 real changes made, 62 to missing) (52 real changes made, 52 to missing) Hours, Unions (65 real changes made, 65 to missing) (68 real changes made, 68 to missing) (62 real changes made, 62 to missing) (60 real changes made, 60 to missing) (62 real changes made, 62 to missing) (0 real changes made) (22 real changes made, 22 to missing) (0 real changes made) (11 real changes made, 11 to missing) (62 real changes made, 62 to missing) (52 real changes made, 52 to missing) (53 real changes made, 53 to missing) county was int now byte hourslw was int now byte docc00 was int now byte dind02 was float now byte string100 was str100 now str50 string150 was str150 now str50 string200 was str200 now str49 occurnum was str2 now str1 file /home/data/morg/annual/morg05.dta saved Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- string50 | 0 string100 | 0 string150 | 0 string200 | 0 hhid | 0 -------------+-------------------------------------------------------- intmonth | 69 8 0 8 8 hurespli | 69 1.362319 .4841917 1 2 minsamp | 69 4.753623 2.409575 1 8 hrlonglk | 69 1.710145 .8242902 0 3 hrhhid2 | 0 -------------+-------------------------------------------------------- serial | 0 serial04 | 0 hhnum | 69 1.086957 .2838356 1 2 hhnum04 | 69 1.086957 .2838356 1 2 state | 69 63 0 63 63 -------------+-------------------------------------------------------- cbsafips | 69 25630.43 8409.859 13820 33860 county | 69 37.68116 41.55736 0 97 centcity | 69 1 0 1 1 smsastat | 69 1 0 1 1 icntcity | 69 0 0 0 0 -------------+-------------------------------------------------------- smsa04 | 69 3.608696 .9270033 3 5 relref95 | 69 3.26087 4.046248 1 18 age | 69 43.69565 17.28932 16 85 sex | 69 1.492754 .5036102 1 2 veteran | 0 -------------+-------------------------------------------------------- grade92 | 69 40.56522 2.804819 34 46 race | 69 1.724638 1.083079 1 7 ethnic | 0 lineno | 69 1.550725 .7383653 1 4 famnum | 69 .7246377 .4499692 0 1 -------------+-------------------------------------------------------- pfamrel | 69 1.188406 .9743076 0 3 marital | 69 3.57971 2.653554 1 7 penatvty | 69 67.73913 48.28276 57 415 pemntvty | 69 66.97101 48.02143 57 415 pefntvty | 69 65.43478 47.45663 57 415 -------------+-------------------------------------------------------- prcitshp | 69 1.202899 .6769245 1 4 prcitflg | 69 0 0 0 0 peinusyr | 69 .6086957 2.295888 0 13 lfsr94 | 69 2.536232 2.379939 1 7 absent94 | 1 5 . 5 5 -------------+-------------------------------------------------------- uhourse | 37 39.54054 7.205687 8 53 reason94 | 4 4.25 2.872281 1 8 hourslw | 47 40.04255 10.77226 8 75 why3594 | 7 11.57143 9.378293 1 22 ftpt94 | 69 2.362319 2.057776 1 12 -------------+-------------------------------------------------------- class94 | 69 2.492754 2.3616 -1 7 eligible | 69 1.753623 .4340574 1 2 paidhre | 17 1.588235 .5072997 1 2 earnhre | 7 942.8571 263.6737 700 1400 earnwke | 17 786.9318 528.3464 187.5 1826.92 -------------+-------------------------------------------------------- unionmme | 17 1.941176 .2425356 1 2 unioncov | 16 2 0 2 2 schenr | 9 1.222222 .4409586 1 2 studftpt | 7 1.142857 .3779645 1 2 schlvl | 7 1.857143 .3779645 1 2 -------------+-------------------------------------------------------- earnwt | 69 4205.406 6119.322 0 19971.7 weight | 69 3164.347 629.8166 2247.222 4936.775 chldpres | 69 .4347826 2.179303 -1 10 ownchild | 69 0 1.084652 -1 3 I25d | 17 .2941176 .4696682 0 1 -------------+-------------------------------------------------------- I25c | 7 .8571429 .3779645 0 1 I25a | 69 .6086957 5.056206 0 42 I25b | 69 3.043478 10.96845 0 42 qstnum | 0 occurnum | 0 -------------+-------------------------------------------------------- ged | 14 1.142857 .3631365 1 2 gedhigr | 2 7 1.414214 6 8 yrcoll | 21 2.666667 .8563488 1 4 grprof | 18 1.666667 .4850713 1 2 gr6cor | 6 1.166667 .4082483 1 2 -------------+-------------------------------------------------------- ms123 | 4 1.75 .5 1 2 cmpwgt | 69 3171.668 650.2722 2240.059 5252.219 ind02 | 69 4532.696 3617.05 -1 9570 occ00 | 69 3243.058 3080.867 -1 9620 vet1 | 10 3.9 1.911951 2 8 -------------+-------------------------------------------------------- vet2 | 2 3 0 3 3 vet3 | 1 4 . 4 4 vet4 | 0 year | 69 2005 0 2005 2005 ihigrdc | 69 13.92754 2.813146 7.5 18 -------------+-------------------------------------------------------- docc00 | 69 9.072464 8.478899 -1 22 dind02 | 69 22.14493 18.89232 -1 51 . . end of do-file . . exit,clear