Click here to see the SAS code.
Click here to see the example.
---------------------------------------------------------------
This is my SAS/Graph imitation of the following map:
http://theswine.files.wordpress.com/2009/04/picture-11.png
There's quite a bit going on in this SAS code...
I read in the data in-line, via a data step and "datalines" section.
In the data, I spell the names of the Mexican areas exactly the same as
they're spelled in the maps.mexico2 table, so that I can join them with
proc sql and thereby lookup the numeric 'id' for each area - I use this
numeric id later to color-plot the data on the choropleth map
using proc gmap.
I create an annotate data set of successively larger empty 'pie' outlines,
to create the 'target' effect in the background.
I use the relatively new %centroid macro to find a centerpoint for each
map area, so I'll know where to put the pointer to attach the text labels.
To draw the label, I start by drawing a dot (pie) at the center location,
and then draw 2 line segments (based on x1/y1 and x2/y2 offsets in the
datalines I read in earlier), and then use x3/y3 offsets for the
position of the text (relative to the last point of the line.
(Determining these x/y offset coordinates was a bit tricky, and
required some trial-and-error.)
For the "telephone" info box, I draw a white solid box, then a red
empty/outline box, and then annotate the text on it (with some of
the text being bold). And I use the annotate image & imgpath to
annotate the icon for the red phone.
For the annotated "shadow" effect behind the map, I use some code from
tech support. It takes the whole map, gremove's the interior borders,
then creates an annotate data set that draws the entire outline as one
polygon (poly/polycont), and fill it with a dark gray. I then apply
a small x/y offset from the original position, and annotate it behind
(when='b') the actual map.
For the banner at the top of the page, I create my own html style
(called 'banner') and define a 'prehtml' section containing the jpg banner.
Then in the ods html section, I say 'style=banner'.
I could have annotated the banner at the top of the graph, but
by keeping the banner separate from the actual graph, it gives
me the flexibility of easily showing just the graph, or the graph
with the banner.
I define a large blank footnote to create space at the bottom of the map,
and then use the legend statement offset= option to move the legend into
that space.
Back to Samples Index