. 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 ../sources/dcthead ./aef`2'.dbd >./aef.dct 4. quietly infile using aef if age>15&age!=. 5. . * Misc . if `1' >= 95 { drop hhid } 6. * Geography . generate byte year = `1' 7. if `1' > 95 { replace smsastat = smsa995 8. replace icntcity = icntcit2 9. replace smsa93 =. if smsa93 < 2 10. replace centcity =centcitx} 11. if `1' == 95 { replace smsastat = smsa995 if intmonth>=9 12. replace icntcity = icntcit2 13. replace smsa93 = . if intmonth>=9 & smsa93 < 2 14. replace centcity = centcitx if intmonth>=9 } 15. replace smsastat = . if smsastat==3 | smsastat<0 16. if `1' >= 94 { drop icntcit2 } 17. if `1' == 94 { drop smsa995 smsa93} 18. if `1' ==94 { replace eligible = . if eligible == 0} 19. replace centcity = . if centcity==4 20. if `1' >= 86 { replace pmsarank = . if pmsarank<=0 21. replace icntcity = . if icntcity==0} 22. if `1' > 84 { replace cmsarank = . if cmsarank<=0} 23. if `1' >= 89 { replace msafips = . if msafips <=0 24. replace cmsacode = . if cmsacode<=0} 25. replace docc80 = . if docc80<=0 26. if `1' < 83 { drop docc80 } 27. if `1' == 83 { drop docc70 } 28. if `1' == 85 { replace smsarank = . if intmonth > 9} 29. if `1' == 84 | `1'==85 { drop icntcity pmsarank cmsarank } 30. if `1' == 94 { replace cmsarank = . if intmon>3 } 31. if `1' > 94 { drop cmsarank pmsarank } 32. replace smsasize=. if smsasize<=0 33. if `1' < 85 { generate byte smsa70 = smsasize } 34. if `1' > 85 { generate byte smsa80 = smsasize } 35. if `1' == 85 { generate byte smsa70 = smsasize if intmonth<10 } 36. if `1' == 85 { generate byte smsa80 = smsasize if intmonth>9 } 37. drop smsasize 38. if `1' > 85 & `1' < 89 { drop smsarank } 39. if `1' < 83 { drop unioncov unionmme occ80 ind80 } 40. . * Demography . if `1' < 89 { replace gradeat = gradeat - 1 41. replace marital = 7 if marital==5 } 42. /* > *if `1' > 91 { generate grade92=gradeat > * drop gradecp gradeat} > */ . if `1' >= 95 { replace relref94 = 11 if relref94 >12 43. replace relref94 = . if relref94 < 0 } 44. if `1' >= 94 { replace veteran = . if veteran < 0 45. replace peinusyr = . if peinusyr < 0 46. replace penatvty = . if penatvty < 0 47. replace pemntvty = . if pemntvty < 0 48. replace pefntvty = . if pefntvty < 0 49. replace prcitshp = . if prcitshp < 0 50. replace prcitflg = . if prcitflg < 0 } 51. . * Employment . if `1' >= 94 { replace dind = . if dind<=0 52. replace lfsr94 = . if lfsr94 <0 53. replace occ80 = . if occ80 <0 54. replace ind80 = . if ind80 < 10 55. replace class94 = . if class94<0 } 56. #delimit ; delimiter now ; . if `1' >=83 { replace docc80=occ80; 57. recode docc80 3/6=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}; 58. if `1'<=82{ > replace dind=ind70 ; 59. 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 } ; 60. if `1' <=93 & `1' >=83 {replace dind=ind80; 61. 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}; 62. if `1' >=94 {replace dind=ind80; 63. 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 }; 64. #delimit cr delimiter now cr . *if `1' >= 94 { drop dind94 } . * Wages (If earnings are 0, then wage rate is missing, not zero). . replace paidhr = . if paidhr <=0 65. replace paidhre = . if paidhre <=0 66. replace earnhr = . if earnhr <=0 67. replace earnhre = . if earnhre <=0 68. replace earnwke = . if earnwke < 0 69. if `1' < 89 {replace eligible = 2 if eligible==.} 70. if `1' >= 89 {replace eligible = 2 if eligible==0} 71. if `1' < 89 {replace I25a = 0 if I25a ==. 72. replace I25b = 0 if I25b ==. 73. replace I25c = 0 if I25c ==. 74. replace I25d = 0 if I25d ==.} 75. if `1' >= 94 {replace eligible = 0 if eligible ==. 76. replace I25a = 0 if I25a <= 3 77. replace I25b = 0 if I25b <= 3 78. replace earnhre = . if earnhre ==1 79. replace uhourse = . if lfsr94 >2 | lfsr94 <1 80. replace lfsr94 = . if lfsr94 < 0 } 81. . * Hours, Unions . if `1' >= 94 { 82. replace reason94 = . if reason94< 0 83. replace absent94 = . if absent94< 0 84. replace studftpt = . if studftpt< 0 85. replace ftpt94 = . if ftpt94 < 0 86. replace hourslw = . if hourslw < 0 87. replace hourslw = 99 if hourslw >99 88. replace uhourse = . if uhourse < 0 89. replace why3594 = . if why3594 < 0 90. replace unionmme = . if unionmme< 0 91. replace unioncov = . if unioncov< 0 } 92. . * Save and exit . ! /bin/rm -f /home/data/morg/annual/morg`1'.dta 93. compress 94. save /home/data/morg/annual/morg`1',old 95. summarize 96. clear 97. ! /bin/rm -f aef.dct /tmp/aef.raw 98. 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 (101766 real changes made) (102182 real changes made) (28928 real changes made, 28928 to missing) (102318 real changes made) (82212 real changes made, 82212 to missing) (15004 real changes made, 15004 to missing) (240562 real changes made, 240562 to missing) (96129 real changes made, 96129 to missing) (273856 real changes made, 273856 to missing) (149656 real changes made, 149656 to missing) (276489 real changes made, 276489 to missing) (97330 real changes made, 97330 to missing) (211516 real changes made, 211516 to missing) (211516 missing values generated) (9152 real changes made) (0 real changes made) (1512 real changes made, 1512 to missing) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (97330 real changes made, 97330 to missing) (1512 real changes made, 1512 to missing) (97330 real changes made, 97330 to missing) (97330 real changes made, 97330 to missing) (97330 real changes made, 97330 to missing) docc80 was byte now int (217021 real changes made) (217021 changes made) dind94 was byte now int (217021 real changes made) (217021 changes made) (144044 real changes made, 144044 to missing) (0 real changes made) (209451 real changes made, 209451 to missing) (0 real changes made) (0 real changes made) (144044 real changes made) (0 real changes made) (119594 real changes made) (144044 real changes made) (1 real change made, 1 to missing) (119594 real changes made, 119594 to missing) (0 real changes made) (298941 real changes made, 298941 to missing) (305346 real changes made, 305346 to missing) (292738 real changes made, 292738 to missing) (1512 real changes made, 1512 to missing) (128599 real changes made, 128599 to missing) (128709 real changes made) (15016 real changes made, 15016 to missing) (264977 real changes made, 264977 to missing) (144044 real changes made, 144044 to missing) (169589 real changes made, 169589 to missing) uhourse was int now byte dind94 was int now byte docc80 was int now byte file /home/data/morg/annual/morg95.dta saved Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- hurespli | 314351 1.599626 .8273512 0 16 intmonth | 314351 6.459327 3.446737 1 12 minsamp | 314351 5.985589 1.999951 4 8 state | 314351 51.10553 26.00006 11 95 centcity | 87831 2.00493 .7506562 1 3 smsa93 | 73907 5.309078 1.680211 2 7 centcitx | 102835 2.296018 .9885762 1 4 msafips | 164695 4432.164 2544.958 80 9360 cmsacode | 37862 52.55478 27.24881 7 97 smsastat | 232139 1.248558 .4321779 1 2 smsa995 | 314351 1.080995 .2757166 1 3 icntcity | 6706 1.167015 .4965119 1 4 hhid95 | 0 sex | 314351 1.529873 .4991076 1 2 veteran | 312839 5.576891 1.221982 1 6 grade92 | 314351 39.50774 2.859428 31 46 why3594 | 49374 14.73792 6.933514 1 23 class94 | 217021 4.128255 1.210992 1 8 unioncov | 144762 1.978413 .1453317 1 2 studftpt | 21613 1.100264 .3003583 1 2 relref94 | 314351 2.750263 2.250112 1 12 relref95 | 314351 2.8766 2.780852 1 18 age | 314351 44.11763 18.15374 16 90 marital | 314351 3.147179 2.590233 1 7 race | 314351 1.289177 .7960335 1 5 hourslw | 314351 63.62612 31.39963 1 99 reason94 | 15410 5.200584 2.893293 1 13 absent94 | 9005 6.03176 3.335539 4 14 ind80 | 217021 580.0291 276.9189 10 991 occ80 | 217021 368.2459 249.0915 3 905 uhourse | 179741 39.09786 11.93249 0 99 paidhre | 170307 1.383578 .4862585 1 2 unionmme | 170307 1.850006 .3570664 1 2 ethnic | 314351 7.688441 1.259143 1 10 lfsr94 | 312839 2.802365 2.354497 1 7 ftpt94 | 312839 2.736996 2.51753 1 12 dind94 | 217021 31.16404 13.46016 1 52 docc80 | 217021 22.63339 12.67543 1 46 eligible | 314351 1.458227 .4982527 1 2 earnhre | 104899 991.3914 601.0681 20 9900 earnwke | 170307 498.6546 365.7329 0 1923 weight | 314351 1895.181 1043.936 0 14211.12 earnwt | 314351 7614.107 4169.327 134.0936 56722.81 I25a | 314351 .1899183 2.563101 0 43 I25b | 314351 2.198215 9.344298 0 42 penatvty | 314351 80.86875 78.57915 57 555 pemntvty | 314351 91.04422 91.46981 57 555 pefntvty | 314351 91.89685 92.77311 57 555 prcitshp | 314351 1.38381 1.112335 1 5 prcitflg | 314351 .2822418 3.003631 0 41 peinusyr | 314351 .7975511 2.57967 0 13 hrlonglk | 314351 1.991455 .1304462 0 2 lineno | 314351 1.736988 1.010136 1 16 year | 314351 95 0 95 95 smsa80 | 102835 24.20777 10.07484 11 43 . * aef2 96 94 . * aef2 97 94 . end of do-file . :q unrecognized command: : invalid command name r(199); . exit,clear