Click here to see the SAS code.
Click here to see the example.
First & foremost - this example is a little outdated now!
Here is a link to the new/updated version using 2005 data.
I created it several years ago, using a snapshot of the data.
But, it still makes a nice demo/sample... :-)
This is basically a US map, with red dots (annotated pies)
at the locations of our sas offices, and also annotated state
abbreviations, and for the icing on the cake I have annotated
a gray "drop/shadow" of the us behind the map.
How did I do all this?...
For each office, I got the city longitude/latitude location
of that office's zipcode from the sashelp.zipcode data set.
I then created an annotate data set, and combined it with
the maps.states sas/graph map data set (you can't use maps.us
because it doesn't have long/lat coordinates). I then use
"proc gproject" to project the long/lat coordinates of the
map and the red dots into a rectangular area that will look
good as a map. I separate the annotate dots from the rest
of the map, so I can use "proc gmap" and have the map=
and the anno= separate.
Similarly, I do about the same thing for the state abbreviations,
except I get the location for these from the maps.uscenter data set,
rather than the sashelp.zipcode.
The "drop shadow" of the us is also annotate, but a little trickier.
First, I take the maps.states data set, and I "gremove" all the internal
boundaries of the states, so I just have one map area for the whole
country. Then I create an annotate "polygon" of that area, and color
it gray. When I draw the map, I use when="b" for this annotated
gray polygon, so it gets drawn before (ie, behind) the real map.
And, I give it a little bit of offset in the X & Y direction, so that
it will look like a shadow.
One nice touch, I code in some drilldowns for the red dots, so you
can click on them and go to that office's website. And you can hover
your mouse over the red dots to see what city they're in. I do this
by creating an "html" variable in the annotate data set, and putting
title= charttips, and href= drilldown in this variable.
Back to Samples Index