. 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 /home/data/morg/raw/morg`1'.Z |tr "\-A" " " >/tmp/aef.ra > w} 2. if `1' >= 94 {!zcat /home/data/morg/raw/morg`1'.Z >/tmp/aef.raw} 3. ! cat /home/data/morg/sources/dcthead /home/data/morg/sources/aef`2'.dbd > > ./aef.dct 4. quietly infile using aef if age>15&age!=. 5. . * Geography . generate byte year = `1' 6. if `1' > 95 & `1' < 98 { drop hhid } 7. if `1'== 95 { replace hhid = . if intmonth>8 8. replace hhid95 = . if intmonth<9 } 9. . if `1' > 95 { replace smsastat = smsa995 10. replace icntcity = icntcit2 11. replace smsa93 =. if smsa93 < 2 12. replace centcity =centcitx 13. drop smsa80 } 14. if `1' == 95 { replace smsastat = smsa995 if intmonth>=9 15. replace icntcity = icntcit2 16. replace smsa93 = . if intmonth>=9 & smsa93 < 2 17. replace centcity = centcitx if intmonth>=9 18. replace smsa80 = . if intmonth>9 } 19. replace smsastat = . if smsastat==3 | smsastat<0 20. if `1' >= 94 { drop icntcit2 } 21. if `1' >= 94 { drop smsa995 smsa93} 22. if `1' ==94 { replace eligible = . if eligible == 0} 23. replace centcity = . if centcity==4 24. if `1' >= 86 { replace pmsarank = . if pmsarank<=0 25. replace icntcity = . if icntcity==0} 26. if `1' > 84 { replace cmsarank = . if cmsarank<=0} 27. if `1' >= 89 { replace msafips = . if msafips <=0 28. replace cmsacode = . if cmsacode<=0} 29. replace docc80 = . if docc80<=0 30. if `1' < 83 { drop docc80 } 31. if `1' == 83 { drop docc70 } 32. if `1' == 85 { replace smsarank = . if intmonth > 9} 33. if `1' == 84 | `1'==85 { drop icntcity pmsarank cmsarank } 34. if `1' == 94 { replace cmsarank = . if intmon>3 } 35. if `1' > 94 { drop cmsarank pmsarank } 36. replace smsasize=. if smsasize<=0 37. if `1' < 85 { generate byte smsa70 = smsasize } 38. if `1' > 85 { generate byte smsa80 = smsasize } 39. if `1' == 85 { generate byte smsa70 = smsasize if intmonth<10 } 40. if `1' == 85 { generate byte smsa80 = smsasize if intmonth>9 } 41. drop smsasize 42. if `1' > 85 & `1' < 89 { drop smsarank } 43. if `1' < 83 { drop unioncov unionmme occ80 ind80 } 44. . * Demography . if `1' < 89 { replace gradeat = gradeat - 1 45. replace marital = 7 if marital==5 } 46. if `1' > 91 & `1' < 94 { generate grade92=gradeat 47. drop gradecp gradeat} 48. if `1' == 95 { replace relref94 = . if intmonth > 2 49. replace relref95 = . if intmonth < 3 } 50. if `1' > 95 & `1' < 98 { drop relref94 } 51. if `1' == 94 { drop relref95 } 52. if `1' >= 94 { replace veteran = . if veteran < 0 53. replace peinusyr = . if peinusyr < 0 54. replace penatvty = . if penatvty < 0 55. replace pemntvty = . if pemntvty < 0 56. replace pefntvty = . if pefntvty < 0 57. replace prcitshp = . if prcitshp < 0 58. replace prcitflg = . if prcitflg < 0 } 59. . * Employment . if `1' >= 94 { replace dind94 = . if dind94<=0 60. replace lfsr94 = . if lfsr94 <0 61. replace occ80 = . if occ80 <0 62. replace ind80 = . if ind80 < 10 63. replace class94 = . if class94<0 } 64. #delimit ; delimiter now ; . if `1' >=83 { replace docc80=occ80; 65. recode docc80 1/3=1 7/22=2 23/37=3 44/59=4 64/68=5 69/83=6 84/89=7 > 95/106=8 113/154=9 155/159=10 178/179=11 43 63 163/177 183/199=12 > 203/208=13 213/225=14 226/235=15 243=16 253/257=17 258/259=18 > 263/278=19 283/285=20 303/307=21 308/309=22 313/315=23 337/344=24 > 354/357=25 316/336 345/353 359/389=26 403/407=27 413/427=28 > 433/444=29 445/447=30 448/455=31 456/469=32 503/549=33 553/599=34 > 613/699=35 703/779=36 783/799=37 803/814=38 823/859=39 869=40 > 875/883=41 863/868 873 874 885/889=42 473/476=43 477/489=44 494/499=45 > 905=46}; 66. if `1'<=82{ > replace dind=ind70 ; 67. recode dind 18/19=1 17=2 47/57=3 67/77=4 107/109=5 118=6 119/138=7 > 139/149=8 157/168 258=9 169=10 177/198=11 199/209=12 219 =13 > 227=14 228/238=15 239/257=16 259=18 268/298=19 299=20 > 307/318=21 319/327=22 328/337=23 338/339=24 347/369=25 > 377/378=26 379/ > 387=27 388/398=28 407/429=29 447/449=30 467/479=31 > 507/588=32 607/698=33 707/709=34 717/718=35 > 769=36 727/748=37 749/759=38 777/798=39 807/809=40 838=41 > 828/837 839/848=42 877/879=44 857/868=43 849 869 887/897= > 45 027 028 = 46 907/937=52 } ; 68. if `1' <=93 & `1' >=83 {replace dind=ind80; 69. recode > dind 12/30=1 10/11=2 40/50=3 60=4 230/241=5 242=6 250/262=7 > 270/280=8 281/300=9 301=10 310/332=11 340/350=12 > 351=13 352=14 360/370=15 371/382=16 390=17 391/392=18 > 100/122=19 130=20 132/150=21 151/152=22 160/162=23 171/172=24 > 180/192=25 200/201=26 210/212=27 220/222=28 > 400/432=29 440/442=30 450/472=31 500/571=32 580/691=33 700/710=34 > 711/712=35 761=36 721/750=37 751/760=38 762/791=39 800/810=40 > 831=41 812/830 832/840=42 842/860=43 861/871=44 841 872/893=45 > 31/32=46 900/932=52 991=51}; 70. if `1' >=94 {replace dind=ind80; 71. recode > dind 12/30=1 10/11=2 40/50=3 60=4 230/241=5 242=6 250/262=7 > 270/280=8 281/300=9 301=10 310/332=11 340/350=12 > 351=13 352=14 360/370=15 371/382=16 390=17 391/392=18 > 100/122=19 130=20 132/150=21 151/152=22 160/162=23 171/172=24 > 180/192=25 200/201=26 210/212=27 220/222=28 > 400/432=29 440/442=30 450/472=31 500/571=32 580/691=33 > 700/710=34 711/712=35 761=36 721/750=37 751/760=38 762/791=39 > 800/810=40 831=41 812/830 832/840=42 842/860=43 > 861/871=44 841 872/893 =45 > 032 031 =46 910 922 932 900 901 > 921 930 931 =52 991=51 }; 72. #delimit cr delimiter now cr . * Wages (If earnings are 0, then wage rate is missing, not zero). . replace paidhr = . if paidhr <=0 73. replace paidhre = . if paidhre <=0 74. replace earnhr = . if earnhr <=0 75. replace earnhre = . if earnhre <=0 76. replace earnwke = . if earnwke < 0 77. if `1' < 89 {replace eligible = 2 if eligible==.} 78. if `1' >= 89 {replace eligible = 2 if eligible==0} 79. if `1' < 89 {replace I25a = 0 if I25a ==. 80. replace I25b = 0 if I25b ==. 81. replace I25c = 0 if I25c ==. 82. replace I25d = 0 if I25d ==.} 83. if `1' >= 94 {replace eligible = 0 if eligible ==. 84. replace I25a = 0 if I25a <= 3 85. replace I25b = 0 if I25b <= 3 86. replace earnhre = . if earnhre ==1 87. replace uhourse = . if pemlr >2 | pemlr <1 88. replace pemlr = . if pemlr < 0 } 89. . * Hours, Unions . if `1' >= 94 { 90. replace reason94 = . if reason94< 0 91. replace absent94 = . if absent94< 0 92. replace studftpt = . if studftpt< 0 93. replace ftpt94 = . if ftpt94 < 0 94. replace hourslw = . if hourslw < 0 95. replace hourslw = 99 if hourslw >99 and hourslw ne . 96. replace uhourse = . if uhourse < 0 97. replace why3594 = . if why3594 < 0 98. replace unionmme = . if unionmme< 0 99. replace unioncov = . if unioncov< 0 } 100. . * Save and exit . * ! /bin/rm -f /home/data/morg/annual/morg`1'.dta . *compress . * save /home/data/morg/annual/morg`1',old . summarize 101. clear 102. ! /bin/rm -f aef.dct /tmp/aef.raw 103. 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 (5731 real changes made, 5731 to missing) icntcit2 not found r(111); end of do-file r(111); . exit,clear