x cd /pub/data/acspums/Tools; %let pgm=application_earnings_bysex; filename pgm "&pgm..sas" ; *---the request from Soo-Yeon Cho, MU was to look at latest values of median earnings by sex. Using https://mcdc.missouri.edu/data/acspums/PUMSDataDict15.txt as codebook. p Nov, 2016, jhgb ----; title "&pgm.: Earnings (Wages & Salary) by Gender" ; title2 "Caution: this is an adhoc query that has not been thorougly reviewed. Use data at your own risk"; footnote h=1 "Program by J. Blodgett, Missouri Census Data Center"; footnote2 h=1 "From program in acspums/Tools/&pgm..sas"; options fmtsearch=(acspums work sasctlgs); *--see /pub/data/acspums/vallabs.sas for defns of formats in the acspums formats catalog--; libname acspums '/pub/data/acspums' access=readonly; proc format; value $hispnc '01'='Not Hispanic' other='Hispanic'; run; %let vars=adjinc sex agep pernp wagp wkhp wkw rac1p hisp ; data &pgm; *--note that we keep pernp which is person **earnings**. This is salary + net income from a business, tips, etc. We go with just wages-; set acspums.moprecs14(keep=st pwgtp &vars in=in14) acspums.moprecs15(keep=st pwgtp &vars in=in15); if wkhp; *--must have worked during last 12 months---; if in14 then Year='2014'; else if in15 then Year='2015'; retain _adjinc 0; if _adjinc=0 or (adjinc ne lag(adjinc)) then _adjinc=input(adjinc,7.6); *--convert the input string to a numeric value. Once per year--; *---Estimate hourly wages based on weeks worked and usual hour per week---; if wkw='1' then _wkmid=52; else if wkw='2' then _wkmid=48.5; else if wkw='3' then _wkmid=43.5; else if wkw='4' then _wkmid=33; else if wkw='5' then _wkmid=20; else if wkw='6' then _wkmid=10; esttothrs=wkhp*_wkmid; wages=wagp*_adjinc; hrlywage=round((wages/esttothrs),.01); format wages dollar9. hrlywage dollar7.2; if wkhp ge 35 and (wkw ='1') then FullTime='Yes'; else FullTime='No '; label Fulltime='Worked full time (35+ hrs 50+ wks)'; format sex $sex. rac1p $rac1p. Hisp $hispnc. ; run; ods html file = "&pgm..html"; options ls=165; proc tabulate data=&pgm format=comma11.; by st year; format st $state.; freq pwgtp; class sex fulltime rac1p hisp; var wages esttothrs hrlywage; *format agep agecat. raceh $raceh.; label st='State'; format hrlywage 6.2; table all='All workers' fulltime*(all rac1p hisp),sex*(n="N" (wages esttothrs hrlywage*f=6.2)*(mean='Avg' median='Median')); run; ods html close;