%let name=fedex; filename odsout '.'; /* This is just a proof-of-concept created for Mary Osborne */ /* Modification of the s04map.sas from democd1 */ goptions reset=global; libname here '../democd1' $mixed_case=yes; proc sql; /* Select one data obs for each county, ignoring the long/lat county outlines */ create table work.SO4_data as select unique state, county, LoessFitSO4 format=comma4.2 label='SO4 Concentration' from here.so4data; /* and get the county name */ create table work.SO4_data as select SO4_data.*, cntyname.countynm from work.SO4_data left join maps.cntyname on SO4_data.state=cntyname.state and SO4_data.county=cntyname.county; quit; run; /* Add html flyover chart tips, and set up a drilldown */ data work.SO4_data; set work.SO4_data; length htmlvar $1024; /* Dade county Florida changed it's county number */ if (state = stfips('FL')) and (county eq 25) then county=86; if state eq stfips('WA') then LoessFitSO4=.5; if state eq stfips('OR') then LoessFitSO4=.5; htmlvar= 'title='||quote( trim(left('County: '|| trim(left(countynm)) )) ||'0D'x|| trim(left('State: '|| trim(left(fipstate(state))) )) ) || 'href='||quote('http://www.epa.gov/air/data/repsst.html?st~'||trim(left(fipstate(state)))); run; /* Create state outlines (annotate dataset) from maps.uscounty map */ /* Just get the 48 continental states */ data work.uscounty; set maps.uscounty; where fipstate(state) not in ('AK' 'HI'); run; /* Remove all internal county boundaries, just keeping the state outline */ proc gremove data=work.uscounty out=work.outline; by STATE; id COUNTY; run; /* Create the annotate dataset */ data work.outline; length COLOR FUNCTION $ 8; retain XSYS YSYS '2' COLOR 'GRAY77' SIZE 1.75 WHEN 'A' FX FY FUNCTION; set work.outline; by State Segment; if first.Segment then do; FUNCTION = 'Move'; FX = X; FY = Y; end; else if FUNCTION ^= ' ' then do; if X = . then do; X = FX; Y = FY; output; FUNCTION = ' '; end; else FUNCTION = 'Draw'; end; if FUNCTION ^= ' ' then do; output; if last.Segment then do; X = FX; Y = FY; output; end; end; run; data anno_img; length function $ 8; xsys='3'; ysys='3'; hsys='3'; when='a'; function='move'; x=2; y=2; output; function='image'; x=x+20; y=y+14; imgpath='fedex_logo.jpg'; style='fit'; output; run; GOPTIONS DEVICE=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="FedEx Delivery Estimates") style=minimal gtitle gfootnote ; /* the ods style, combined with 'border' goption, produced 3d border */ goptions border cback=white gunit=pct htitle=5 htext=3 ftitle="arial/bo" ftext="arial/bo"; title link='http://www.fedex.com' c=gray "Estimated " c=black"Ground Delivery Times"; footnote "Mouse over map to see state and county names"; footnote2 color=gray "(This example uses fabricated data)"; pattern1 v=s c=tan; pattern2 v=s c=cx00ff00; pattern3 v=s c=orange; pattern4 v=s c=cyan; pattern5 v=s c=magenta; legend1 position=(top) label=none value=('5 days' '4 days' '3 days' '2 days' '1 day') shape=bar(1.3,2); proc gmap data=work.SO4_data map=maps.uscounty anno=work.outline; id state county; choro LoessFitSO4 / levels=5 legend=legend1 anno=anno_img html=htmlvar des="" name="&name" ; run; quit; ODS HTML CLOSE; ODS LISTING;