%let name=nc_unemployment; filename odsout '.'; filename file1 'nc_unemployment_feb_2009.txt'; data my_data; infile file1 lrecl=80 firstobs=3 pad; length county_upcase $20.; informat Labor_Force Employment Unemployment comma12.0; informat Rate comma6.1; format Labor_Force Employment Unemployment comma12.0; format Rate comma6.1; input county_upcase $ Labor_Force Employment Unemployment Rate; county_upcase=translate(county_upcase,' ','_'); state=37; run; /* Get numeric county fips code, to match up with the map */ proc sql; create table my_data as select my_data.*, cntyname.county from my_data left join maps.cntyname on my_data.state=cntyname.state and my_data.county_upcase=upcase(cntyname.countynm); quit; run; /* Calculate an html variable, with multi-line 'chart tip' info, and an html href link */ /* Note that '0D'x is the hexadecimal for a carraige return */ data my_data; set my_data; length myhtmlvar $400; myhtmlvar='title='|| quote( trim(left(county_upcase))||' county, NC'||'0D'x|| 'Unemployment Rate: '||trim(left(rate))||'% ' ) ||' '|| 'href="http://www.google.com/search?hl=en&q=NC+unemployment+'|| trim(left(county_upcase))||'+county"' ; run; data my_map; set maps.counties (where=(state=37)); run; proc gproject data=my_map out=my_map; id state county; run; proc sql noprint; select sum(Unemployment)/sum(Labor_Force) format=percentn7.2 into :ncrate from my_data; select sum(Unemployment) format=comma7.0 into :ncunemp from my_data; quit; run; %let ncrate=%trim(&ncrate); data my_anno; length function $8 style $20 text $100; xsys='3'; ysys='3'; hsys='3'; function='label'; position='6'; x=10; color='gray22'; style='"arial/bold"'; y=45.5; text='February 2009 Unemployment Numbers *'; output; color=''; style='"arial/bold"'; y=y-4.8; text="&ncunemp individuals or &ncrate of North Carolinians"; output; y=y-3; text="were unemployed in the month of February."; output; color='gray22'; style='"arial/bold"'; y=y-4.8; text="Mouse over each county for unemployment numbers."; output; function='move'; x=10; y=5; output; function='image'; x=x+30; y=y+20; imgpath='./economic_watch.jpg'; style='fit'; output; run; GOPTIONS DEVICE=png; goptions xpixels=960 ypixels=540; goptions cback=white; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" style=minimal; goptions gunit=pct htitle=4.25 htext=2.5 ftitle="arial/bold" ftext="arial/bold" ctext=gray66; title j=l c=gray22 " North Carolina unemployment rates, county-by-county"; footnote1 h=17pct " "; footnote2 h=2.5 j=l link="http://www.ncesc.com/pmi/rates/PressReleases/County/NR_Feb_09_CountyRates.pdf" " * Unadjusted data" j=r "Source: Employment Security Commission of North Carolina "; footnote3 h=.5 " "; legend1 label=(position=(top) j=left "KEY") position=(right bottom) across=2 colmajor mode=share value=(j=right) shape=bar(.15in,.15in) offset=(-5,-18); data my_data; set my_data; length bucket $15; if rate <= 2.99 then bucket='0 - 2.99%'; else if rate <= 5.99 then bucket='3 - 5.99%'; else if rate <= 8.99 then bucket='6 - 8.99%'; else if rate <= 11.99 then bucket='9 - 11.99%'; else if rate <= 14.99 then bucket='12 - 14.99%'; else if rate <= 17.99 then bucket='15 - 17.99%'; else bucket='???'; run; pattern1 v=s c=cxe9e9e9; pattern2 v=s c=cxe1f9be; pattern3 v=s c=cx7cd855; pattern4 v=s c=cx27be08; pattern5 v=s c=cx196e06; pattern6 v=s c=cx003300; proc gmap map=my_map data=my_data anno=my_anno; id state county; choro bucket / midpoints = '0 - 2.99%' '3 - 5.99%' '6 - 8.99%' '9 - 11.99%' '12 - 14.99%' '15 - 17.99%' coutline=grayee legend=legend1 html=myhtmlvar des="" name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;