Date: Wed, 27 May 2009 12:49:42 -0400
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: Annotate? Place Hotels onto existing county map?
Content-Type: text/plain;charset=iso-8859-1
hi ... .. try the following
in the annotate data set creation, create a variable named HTML
that can be used to add a pop-up tag and/or a link to another web page
by the way, I used a TITLE tag and not an ALT tag since the ALT tags do not work in Firefox
you could also try stuff like ...
html = catt('TITLE="LOCALITY:',city,'0d'x,'POPULATION:',put(pop,comma10. -l),'"');
where the hex character adds a line break ... but again, Firefox does not recognize it while IE does
ps ... lots of this is in a neat book (shameless self-promotion) ... http://www.sas.com/apps/pubscat/bookdetails.jsp?pc=57495
and there is some material about the HTML link in ... http://www.albany.edu/~msz03/251-29.pdf
which is a "corrected" version of ... http://www2.sas.com/proceedings/sugi29/251-29.pdf
*
extract New York State cities from maps.uscity data set
;
data nys;
set maps.uscity (keep=state lat long pop city);
where state eq 36 and pop ge 50000;
* convert locations from degrees to radians;
x = long * constant('pi') / 180;
y = lat * constant('pi') / 180;
drop state lat long;
run;
*
combine New York county map with city locations
;
data map_nys;
set maps.counties (where=(state eq 36 and density lt 6)) nys;
run;
*
project the map + cities
;
proc gproject data=map_nys out=proj asis;
id county;
run;
*
create an annotate data set out of the projected city coordinates
size and color of marker a function of 2000 population
;
data anno;
retain xsys ysys '2' hsys '3' style 'marker' color 'red' text 'V' size 2;
set proj;
where county is missing;
html = catt('TITLE="',city,':',put(pop,comma10.),'"');
run;
*
reset/set graphic options
;
goptions reset=all device=png ftext='calibri'
gunit=pct xpixels=1024 ypixels=768;
pattern v=e c=blue;
*
draw a map
;
ods listing close;
ods html path='z:\' (url=none) file='nysmap.html';
title1 h=5 'NEW YORK STATE LOCALITIES WITH 50,000+ POPULATION' ls=2;
title2 h=3 '(PLACE CURSOR ON STAR TO SEE LOCALITY NAME AND POPULATION)';
proc gmap map=proj (where=(county is not missing)) data=proj (obs=1) all;
id county;
choro county / discrete coutline=blue nolegend annotate=anno des='';
run;
quit;
ods html close;
ods listing;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> One additional question here. I am now trying to have the name of
> the hotel show when the mouse hovers over the star for that hotel.
> Not sure where I set this up. Do I add this in to the anno dataset?
> Thx for any kind advice!
>