log using annual05, text replace set memory 1000m 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 define aef2 local dct_name "aef`3'.dbd" local raw_name "../raw/morg`2'" display "dct_name `dct_name'" display "raw_name `raw_name'" *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 *quietly infile using "`dct_name'" in 1/100 , using("`raw_name'") clear *quietly infile using aef if age>15&age!=. display "infile successful" #delimit cr generate int year = `1' *summarize tab intmonth if `1'==2005 * Geography display "Geography" if `1' == 2005 { replace serial = serial04 replace hhnum = hhnum04 display "dropping cmsacode msafips smsa93" drop cmsacode msafips smsa93 replace smsa04 = . if smsa04<2 & intmonth >= 5 } display "smsasize = . if smsasize <=0" capture replace smsasize = . if smsasize <=0 display "replace smsastat = . if smsastat==3 | smsastat<0" replace smsastat = . if smsastat==3 | smsastat<0 display "replace smsasize=. if smsasize<=0" **should line below be commented out??? capture replace smsasize=. if smsasize<=0 display "drop smsasize" capture drop smsasize * Demography display "Demography" if `1' > 1991 { replace grade92 = . if grade92 < 0 } if `1' >= 1998 { replace ged = . if ged < 0 replace gedhigr = . if gedhigr < 0 replace yrcoll = . if yrcoll < 0 replace grprof = . if grprof < 0 replace gr6cor = . if gr6cor < 0 replace ms123 = . if ms123 < 0 generate double ihigrdc = . ** Jaeger label var ihigrdc "Imputed highest grade completed" replace ihigrdc = 0 if grade92==31 replace ihigrdc = 2.5 if grade92==32 replace ihigrdc = 5.5 if grade92==33 replace ihigrdc = 7.5 if grade92==34 replace ihigrdc = 9 if grade92==35 replace ihigrdc =10 if grade92==36 replace ihigrdc =11 if grade92==37 replace ihigrdc =12 if grade92==38 replace ihigrdc = 0 if grade92==39 & ged==2 & gedhigr==1 replace ihigrdc = 2.5 if grade92==39 & ged==2 & gedhigr==2 replace ihigrdc = 5.5 if grade92==39 & ged==2 & gedhigr==3 replace ihigrdc = 7.5 if grade92==39 & ged==2 & gedhigr==4 replace ihigrdc = 9 if grade92==39 & ged==2 & gedhigr==5 replace ihigrdc = 10 if grade92==39 & ged==2 & gedhigr==6 replace ihigrdc = 11 if grade92==39 & ged==2 & gedhigr==7 replace ihigrdc = 12 if grade92==39 & ged==2 & gedhigr==8 replace ihigrdc = 12 if ged==1 replace ihigrdc = 12 if grade92>=40 & grade92<=42 & yrcoll==1 replace ihigrdc = 13 if grade92>=40 & grade92<=42 & yrcoll==2 replace ihigrdc = 14 if grade92>=40 & grade92<=42 & yrcoll==3 replace ihigrdc = 15 if grade92>=40 & grade92<=42 & yrcoll==4 replace ihigrdc = 16 if grade92>=40 & grade92<=42 & yrcoll==5 replace ihigrdc = 16 if grade92==43 & grprof==2 replace ihigrdc = 17 if grade92==43 & gr6cor==2 replace ihigrdc = 18 if grade92==43 & gr6cor==1 replace ihigrdc = 17 if grade92==44 & ms123==1 replace ihigrdc = 18 if grade92==44 & ms123>=2 & ms123<. replace ihigrdc = 18 if grade92==45 | grade92==46 } if `1' >= 1994 { replace penatvty = . if penatvty < 0 replace pemntvty = . if pemntvty < 0 replace pefntvty = . if pefntvty < 0 replace prcitshp = . if prcitshp < 0 replace prcitflg = . if prcitflg < 0 } if `1' > 1989 { replace ethnic = . if ethnic < 0 replace ethnic = . if ethnic >= 10 } if `1' == 2005 { display "replacing veteran and dropping vet1-vet4 if intmonth <=7" replace veteran = . if veteran < 0 & intmonth <= 7 replace vet1=. if intmonth <= 7 replace vet2=. if intmonth <= 7 replace vet3=. if intmonth <= 7 replace vet4=. if intmonth <= 7 } if `1' == 2005 { display "setting veteran to missing and vet1-vet4 to missing" replace veteran = . if intmonth >= 8 replace vet1 = . if vet1 < 0 & intmonth >= 8 replace vet2 = . if vet2 < 0 & intmonth >= 8 replace vet3 = . if vet3 < 0 & intmonth >= 8 replace vet4 = . if vet4 < 0 & intmonth >= 8 } * Employment display "Employment" #delimit ; ; display "docc00" ; if `1' >= 2000 { display "generate int docc00=occ00;"; generate int docc00=occ00; display "recode docc00"; 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); } ; display "dind"; if `1' >= 2000 { display "replacing dind for `1' >= 2000 " ; gen dind02 = ind02; 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) ; } ; #delimit cr **Wages (If earnings are 0, then wage rate is missing, not zero). display "Wages" replace paidhr = . if paidhr <=0 replace paidhre = . if paidhre <=0 replace earnhr = . if earnhr <=0 replace earnhre = . if earnhre <=0 replace earnwke = . if earnwke < 0 if `1' >= 1989 { replace eligible = 2 if eligible <= 0 } if `1' >= 1994 { replace I25a = 0 if I25a <= 3 replace I25b = 0 if I25b <= 3 *replace I25a = . if I25a < 0 *replace I25b = . if I25b < 0 replace earnhre = . if earnhre ==1 replace uhourse = . if lfsr94 >2 | lfsr94 <1 replace lfsr94 = . if lfsr94 < 0 } if `1' >= 1996 { replace I25c = . if I25c < 0 replace I25d = . if I25d < 0 } ** Hours, Unions display "Hours, Unions" if `1' >= 1994 { replace reason94 = . if reason94< 0 replace absent94 = . if absent94< 0 replace studftpt = . if studftpt< 0 replace schenr = . if schenr < 0 replace schlvl = . if schlvl < 0 replace ftpt94 = . if ftpt94 < 0 replace hourslw = . if hourslw < 0 replace hourslw = 99 if hourslw >99 & hourslw != . replace uhourse = . if uhourse < 0 replace why3594 = . if why3594 < 0 replace unionmme = . if unionmme< 0 replace unioncov = . if unioncov< 0 } ** Save and exit compress saveold /home/data/morg/annual/morg`2',replace summarize clear *! /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 ! /bin/chmod a+r /home/data/morg/annual/morg`2'.dta ! /usr/bin/chmod g+w /home/data/morg/annual/morg`2'.dta ! /bin/chmod g+w /home/data/morg/annual/morg`2'.dta ! /usr/bin/chgrp web /home/data/morg/annual/morg`2'.dta ! /bin/chgrp web /home/data/morg/annual/morg`2'.dta 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