. 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. . if `1' > 95 { replace smsastat = smsa995 7. replace icntcity = icntcit2 8. replace centcity = centcitx } 9. if `1' == 95 { replace smsastat = smsa995 if intmonth>=9 10. replace icntcity = icntcit2 11. replace centcity = centcitx if intmonth>=9 } 12. replace smsastat = . if smsastat==3 | smsastat<0 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 . . * aef2 95 94 . . * aef2 96 94 . . * aef2 97 94 . .