x cd /pub/data/acs/Tools; %let pgm=app_insurancecoveragebytype; filename pgm "&pgm..sas"; *--For Soo-Yeon Cho, MU Public Policy, pull data for MO counties and state re pvt vs public insurace coverage. --*; *libname btabs '/pub/data/acs2014/basetbls'; libname btabs '/pub/data/acs2014/btabs5yr'; libname temp '/pub/data/temp'; libname user '/SAS_temp/user'; %macro cellref(i); b27010{&i + _offset} %mend cellref; *---pull extract from the US data set containing the housing tables---; data temp.&pgm; set btabs.usstcnty25_27( where=( state='29' and sumlev in ('040','050') ) keep=_character_ b27010: ); ***if geocomp='00'; *if _n_=1 then put _all_; PvtOnly=0; PubOnly=0; Both=0; None=0; Denom=0; Array b27010(*) b27010i1-b27010i66; do _offset=0 to 16 by 16; *--3 age groups: 0-18, 18-34 and 35-64. 65+ handled separately --; Denom + %cellref (2); PvtOnly + %cellref(4) + %cellref(5) + %cellref(11) + %cellref(14); PubOnly + %cellref(6) + %cellref(7) + %cellref(8) + %cellref(9) + %cellref(13) + %cellref(15); Both + %cellref(12) + %cellref(16); None + %cellref(17); end; _offset=32; *--they threw in an extra cat for the 35-64 group---; Denom + %cellref (2); PvtOnly + %cellref(4) + %cellref(5) + %cellref(11) + %cellref(15); PubOnly + %cellref(6) + %cellref(7) + %cellref(8) + %cellref(9) + %cellref(14) + %cellref(16); Both + %cellref(12) + %cellref(17); None + %cellref(18); Both + b27010{45}; PctPvtOnly=100*PvtOnly/Denom; PctPubOnly=100*PubOnly/Denom; PctBoth=100*Both/Denom; PctNone=100*None/Denom; AgeUniverse='Under 65 '; output; AgeUniverse='All incl 65+'; Denom + b27010{51}; PvtOnly + b27010{53} + b27010{54} + b27010{59} + b27010{63}; PubOnly + b27010{55} + b27010{56} + b27010{57} + b27010{62} + b27010{64}; Both + b27010{60} + b27010{61} +b27010{65}; None + b27010{66}; PctPvtOnly=100*PvtOnly/Denom; PctPubOnly=100*PubOnly/Denom; PctBoth=100*Both/Denom; PctNone=100*None/Denom; output; format Pct: 5.1; label Both='Both Pub & Pvt coverage'; keep esriid county AgeUniverse PvtOnly--PctNone; format county $county.; drop _: ; run; *proc sort; *by ageUniverse; run; proc print data=temp.&pgm(obs=25) ; title2 "First 25 of Output set temp.&pgm"; id esriid county; run; /*<=========================Comment out===================================== ods html file="&pgm..html" style=meadow; proc print data=temp.&pgm (drop=esriid rno ) label split='/'; by areaname notsorted; id areaname ; title "Public vs Private Insuracen Coverage for Missouri "; title2 h=.5 "Source: 2014 American Community Survey (5-year Estimates) Base Table .... "; footnote h=.5 "From setup in /pub/data/acs/&pgm..sas"; run; ===========================End commented out================================ */