Click here to see the SAS code.
Click here to see the example.
I created an example for this, because I thought it was interesting,
and also data that most/all sas users could relate to - ie, where did
people come from, to SUGI 26.
The data was somewhat "dirty", so there could be some error in this map.
If the data were collected specifically for the purpose of populating
this map, we could have had a separate field for US zipcode, but
the way I received this data the 'address' was more or less a freehand
field, and I took quite some liberty about parsing out the part that
I thought was the zipcode -- good enough for a proof-of-concept demo
though! :)
Here are some of the tricks needed for this map...
Make sure to use maps.states, rather than maps.us - that's because
maps.states has the unprojected longitude/latitude in it, and you
can therefore annotate the dots (by the zipcode long/lat) with this
map (maps.us is already "projected" and there is no easy way to reliably
annotate dots by zipcode location onto it).
When I create the annotate data set containing the dots, I use
the annotate 'pie' function, and each dot is a pie with 1 slice that
goes 360 degrees. I sort the annotate data set so the smaller pies
will be printed last, and therefore will be less likely to be
obscured by other (especially the bigger) pies. I represent the
number of attendees by both the size and the color of the dots.
Also, I use the annotate html variable to encode title= charttips/flyover-text
so you can see the zipcode, state, city, and the number of sugi 26 attendees
from that zipcode. I split these bits of text onto separate lines, using
the '0d'x carriage return (this works well in IE, but some other browsers
like netscape and mozilla don't handle the multi-line text so well -- maybe
they'll catch up with IE one of these days ;)
And one last trick - since I'm annotating my response data (colored dots)
rather than representing it with one of gmap's built-in ways of doing it
(choro colors) I don't get an automatic color legend, and I therefore
have to create my own using annotate.
Back to Samples Index