%let name=today;
filename odsout '.';
goptions reset=global;
/* Somewhat based on ...
http://ftp.sas.com/techsup/download/sample/graph/gmap-pop.html
and
http://www.usatoday.com/graphics/census2000/usnav/usnav.htm
*/
data work.maplabel;
length function $ 8;
retain flag 0 xsys ysys '2' hsys '3' when 'a' color 'white';
set maps.uscenter(where=(fipstate(state) not in ('DC' 'PR') ) drop=long lat);
function='label';
size=1.8; style='"arial"'; position='5';
/* text=fipstate(state); */
text=fipname(state);
if ocean='Y' then
do;
position='6'; output;
function='move';
flag=1;
end;
else if flag=1 then
do;
function='draw'; size=.25;
flag=0;
end;
output;
run;
proc sql;
create table work.my_us as
select *, fipstate(state) as st
from maps.us
where fipstate(state) ne 'PR'
;
create table work.my_data as
select unique st, fipnamel(state) as st_name
from work.my_us
where fipstate(state) ne 'PR'
;
quit; run;
data work.my_data; set work.my_data;
length myhtmlvar $400;
myhtmlvar='title='|| quote(trim(left(st_name))) ||' '|| 'href="http://www.usatoday.com/graphics/census2000/'||trim(left(lowcase(compress(st_name))))||'/state.htm"' ;
run;
ods path work.template(update) sashelp.tmplmst;
proc template;
/* Define a style */
define style styles.usatoday;
parent = styles.default;
style Body from Document /
prehtml = "
![]() |
"
;
replace color_list /
"white" = cxffffff
"black" = cx000000
"dblue" = cx000067
;
replace colors /
"docbg" = color_list("black")
"link1" = color_list("white")
"link2" = color_list("white")
;
end;
run;
GOPTIONS DEVICE=png;
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm"
(title="USA Today Census 2000 imitation")
style=usatoday
gtitle gfootnote
;
pattern1 c=cxcb0000 r=100;
goptions
hsize=7in vsize=5.5in
cback=black iback='astro.jpg'
;
title1 h=3pct j=l f=marker c=cxd2b14d " U "
f="arial" c=white "Throughout the month of May, the Census Bureau"
j=r f=marker c=cxd2b14d " U "
f="arial" c=white "The Census Bureau also released ";
title2 h=3pct j=l f="arial" c=white " released new information about income, education,"
j=r f="arial" c=white "a demographic profile for the USA. ";
title3 h=3pct j=l f="arial" c=white " commuting and birthplace for every state."
j=r link="http://www.usatoday.com/graphics/census2000/unitedstates/state.htm" f=marker c=cxcb0000 " B "
f="arial" c=cxd2b14d h=3pct "U.S. demographic profile ";
title4 h=3pct j=l f="arial" c=cxd2b14d " Click on a state to see the latest information."
j=r link="http://www.usatoday.com/graphics/census2000/uspop/uspop.htm" f=marker c=cxcb0000 " B "
f="arial" h=3pct c=cxd2b14d "U.S. population center ";
/* A fake/blank title, positioned to add extra space on right-hand-side of graph
so the annotated state names aren't chopped off. */
title5 a=-90 h=9pct " ";
footnote1 h=3pct f="arial" c=white link="http://www.usatoday.com/graphics/census2000/usnav/usnav.htm"
"SAS/Graph Imitation of USA Today map";
proc gmap data=work.my_data map=work.my_us annotate=work.maplabel;
id st;
choro st / html=myhtmlvar coutline=black nolegend /* des='Imitation of USA Today map' */ des='' name="&name";
run;
quit;
ODS HTML CLOSE;
ODS LISTING;