. set memory 40m (40960k) . set more 1 . . ! /bin/rm -f /tmp/aef.raw aef.dct dcthead . . * Obtain raw data from Chung Underwood at BLS 202-606-7786 . ! echo >dcthead dictionary using /tmp/aef.raw . . program define aef2 1. . * '-A' are missing value indicators in the earlier files. . if `1' < 94 {!zcat ../raw/morg`1'.Z |tr "\-A" " " >/tmp/aef.raw} 2. . if `1' >= 94 {!zcat ../raw/morg`1'.Z >/tmp/aef.raw} 3. . ! cat dcthead aef`2'.dbd >aef.dct 4. . quietly infile using aef if age>15&age!=. 5. . . * Geography . generate byte year = `1' 6. . replace smsastat = . if smsastat==3 | smsastat<0 7. if `1' > 95 { replace smsastat = smsa995 8. replace icntcity = icntcit2 9. replace centcity = centcitx } 10. if `1' == 95 { replace smsastat = smsa995 if intmonth>=9 11. replace icntcity = icntcit2 12. replace centcity = centcitx if intmonth>=9 } 13. if `1' >= 94 { drop icntcit2 } 14. if `1' <= 94 { drop smsa995 smsa93} 15. replace centcity = . if centcity==4 16. if `1' >= 86 { replace pmsarank = . if pmsarank<=0} 17. if `1' > 84 { replace cmsarank = . if cmsarank<=0} 18. if `1' >= 89 { replace msafips = . if msafips <=0 19. replace cmsacode = . if cmsacode<=0} 20. replace docc80 = . if docc80<=0 21. if `1' < 83 { drop docc80 } 22. . if `1' == 85 { replace smsarank = . if intmonth > 9} 23. . if `1' == 84 | `1'==85 { drop icntcity pmsarank cmsarank } 24. . if `1' == 94 { replace cmsarank = . if intmon>3 } 25. if `1' > 94 { drop cmsarank pmsarank } 26. replace smsasize=. if smsasize<=0 27. . if `1' < 85 { generate byte smsa70 = smsasize } 28. . if `1' > 85 { generate byte smsa80 = smsasize } 29. . if `1' == 85 { generate byte smsa70 = smsasize if intmonth<10 } 30. . if `1' == 85 { generate byte smsa80 = smsasize if intmonth>9 } 31. . drop smsasize 32. . if `1' > 85 & `1' < 89 { drop smsarank } 33. . if `1' < 83 { drop unioncov unionmme occ80 ind80 } 34. . . * Demography . if `1' < 89 { replace gradeat = gradeat - 1 35. . replace marital = 7 if marital==5 } 36. if `1' > 91 { generate grade92=gradeat 37. . drop gradecp gradeat} 38. . if `1' >= 95 { replace relref94 = 11 if relref94 >12 39. replace relref94 = . if relref94 < 0 } 40. if `1' >= 94 { replace veteran = . if veteran < 0 41. replace peinusyr = . if peinusyr < 0 42. replace penatvty = . if penatvty < 0 43. replace pemntvty = . if pemntvty < 0 44. replace pefntvty = . if pefntvty < 0 45. replace prcitshp = . if prcitshp < 0 46. replace prcitflg = . if prcitflg < 0 } 47. . * Employment . if `1' <= 93 & `1'>=89{replace classer1=. if classer1==8|classer1<0} 48. if `1' <= 93 { replace class = . if class==8 } 49. if `1' >= 94 { replace dind94 = . if dind94<=0 50. replace lfsr94 = . if lfsr94 <0 51. replace occ80 = . if occ80 <0 52. replace ind80 = . if ind80 < 10 53. replace class94 = . if class94<0 } 54. . * Wages (If earnings are 0, then wage rate is missing, not zero). . replace paidhr = . if paidhr <=0 55. replace paidhre = . if paidhre <=0 56. replace earnhr = . if earnhr <=0 57. replace earnhre = . if earnhre <=0 58. replace earnwke = . if earnwke < 0 59. if `1' < 89 {replace eligible = 2 if eligible==.} 60. . if `1' >= 89 {replace eligible = 2 if eligible==0} 61. . if `1' < 89 {replace I25a = 0 if I25a ==. 62. . replace I25b = 0 if I25b ==. 63. . replace I25c = 0 if I25c ==. 64. . replace I25d = 0 if I25d ==.} 65. . if `1' >= 94 {replace eligible = 0 if eligible ==. 66. replace I25a = 0 if I25a <= 3 67. replace I25b = 0 if I25b <= 3 68. replace earnhre = . if earnhre ==1 69. replace uhourse = . if pemlr >2 | pemlr <1 70. replace pemlr = . if pemlr < 0 } 71. . * Hours, Unions . if `1' >= 94 { 72. replace reason94 = . if reason94< 0 73. replace absent94 = . if absent94< 0 74. replace studftpt = . if studftpt< 0 75. replace ftpt94 = . if ftpt94 < 0 76. replace hourslw = . if hourslw < 0 77. replace hourslw = 99 if hourslw >99 78. replace uhourse = . if uhourse < 0 79. replace why3594 = . if why3594 < 0 80. replace unionmme = . if unionmme< 0 81. replace unioncov = . if unioncov< 0 } 82. . * Save and exit . ! /bin/rm -f ../annual/morg`1'.dta 83. . compress 84. save ../annual/morg`1',old 85. summarize 86. . clear 87. . ! /bin/rm -f aef.dct /tmp/aef.raw 88. . 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 79 79_83 . . * aef2 80 79_83 . . * aef2 81 79_83 . . * aef2 82 79_83 . . * aef2 83 79_83 . . * aef2 84 84_88 . . * aef2 85 84_88 . . * aef2 86 84_88 . . * aef2 87 84_88 . . * aef2 88 84_88 . . * aef2 89 89_93 . . * aef2 90 89_93 . . * aef2 91 89_93 . . * aef2 92 89_93 . . * aef2 93 89_93 . . aef2 94 94 (5669 real changes made, 5669 to missing) (0 real changes made) (292194 real changes made, 292194 to missing) (263993 real changes made, 263993 to missing) (103879 real changes made, 103879 to missing) (291371 real changes made, 291371 to missing) (93092 real changes made, 93092 to missing) (0 real changes made) (263993 real changes made, 263993 to missing) (263993 missing values generated) (1518 real changes made, 1518 to missing) (284596 real changes made, 284596 to missing) (179 real changes made, 179 to missing) (179 real changes made, 179 to missing) (179 real changes made, 179 to missing) (179 real changes made, 179 to missing) (179 real changes made, 179 to missing) (93092 real changes made, 93092 to missing) (1518 real changes made, 1518 to missing) (93092 real changes made, 93092 to missing) (93201 real changes made, 93201 to missing) (93092 real changes made, 93092 to missing) (139174 real changes made, 139174 to missing) (0 real changes made) (205216 real changes made, 205216 to missing) (0 real changes made) (0 real changes made) (139174 real changes made) (9256 real changes made) (121454 real changes made) (146913 real changes made) (0 real changes made) (122969 real changes made, 122969 to missing) (1518 real changes made, 1518 to missing) (303165 real changes made, 303165 to missing) (309905 real changes made, 309905 to missing) (289860 real changes made, 289860 to missing) (1518 real changes made, 1518 to missing) (132298 real changes made, 132298 to missing) (132411 real changes made) (14588 real changes made, 14588 to missing) (258636 real changes made, 258636 to missing) (139174 real changes made, 139174 to missing) (165856 real changes made, 165856 to missing) uhourse was int now byte grade92 was float now byte file ../annual/morg94.dta saved Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- hurespli | 319234 1.59088 .7972991 0 14 intmonth | 319234 6.48794 3.454723 1 12 minsamp | 319234 6.01778 1.999924 4 8 state | 319234 51.01258 26.05296 11 95 centcity | 0 centcitx | 0 msafips | 215355 4441.511 2546.685 80 9340 pmsarank | 27040 1.774519 1.527274 1 12 cmsarank | 55241 42.91276 54.06513 1 252 cmsacode | 27863 51.30176 25.19262 7 91 smsastat | 313565 1.267224 .4425108 1 2 icntcity | 0 hhid | 0 sex | 319234 1.530752 .4990542 1 2 veteran | 317716 5.564038 1.238336 1 6 why3594 | 60598 12.69341 7.98549 1 23 class94 | 220259 4.134051 1.226125 1 8 unioncov | 145168 1.969491 .171985 1 2 studftpt | 21989 1.106599 .3086094 1 2 relref94 | 319234 2.752692 2.258558 1 12 age | 319234 44.118 18.26458 16 90 marital | 319234 3.141326 2.588014 1 7 race | 319234 1.260026 .7328593 1 5 hourslw | 319234 63.8559 31.52558 1 99 reason94 | 16069 5.533201 2.983082 1 13 absent94 | 9329 6.086504 3.321231 4 14 ind80 | 220223 575.8117 277.7924 10 991 occ80 | 216886 371.1543 247.5946 3 905 uhourse | 181677 38.95988 12.07523 0 99 paidhre | 170865 1.385591 .486736 1 2 unionmme | 170804 1.843786 .3630593 1 2 ethnic | 319234 7.697914 1.247565 1 13 lfsr94 | 317716 2.82767 2.365349 1 7 ftpt94 | 317716 2.776775 2.564107 1 12 dind94 | 216886 31.53476 13.62572 1 52 docc80 | 216886 22.82801 12.60155 1 46 eligible | 319234 1.406968 .547115 0 2 earnhre | 114018 897.1795 667.861 10 9999 earnwke | 180060 459.0454 364.6597 0 1923 weight | 319234 1849.563 1039.374 0 20892.63 earnwt | 319234 7406.083 4162.328 0 77523.12 I25a | 317714 .1512933 2.292265 0 43 I25b | 317713 1.482464 7.73911 0 42 penatvty | 319055 82.10512 85.39761 57 555 pemntvty | 319055 94.38929 102.6987 57 555 pefntvty | 319055 95.82457 105.1551 57 555 prcitshp | 319055 1.370679 1.098016 1 5 prcitflg | 319055 .4469449 4.085667 0 40 peinusyr | 34638 6.858797 3.748605 1 13 pemlr | 317716 2.82767 2.365349 1 7 year | 319234 94 0 94 94 smsa80 | 55241 5.223005 1.907405 2 8 grade92 | 319234 39.45939 2.851063 31 46 . . aef2 95 94 op. sys. refused to start new process r(702); . . aef2 96 94 op. sys. refused to start new process r(702); . .