Click here to see the SAS code. 
Click here to see the example.

This example is a result of one of those little "challenges" Mike Zdeb
sends me from time to time...  :)

This example basically turned out to be a "tour 'de force" showing 
how sas/graph gmap and annotate can be used to do just about
anything.  

First, I create a sas data set containing 1 obsn for each square
in the grid, with enough variables to uniquely identify exactly
which row/column/classification(s) each square is in.
Then I add a 'myhtml' variable which has title= text - I'll use 
this variable later in the gmap html= option to add charttyp/flyover-text.
I also add a 'risk_color' numeric variable, telling which color range
each obsn is in (this lets me have greater control over the colors
instead of using the automatic binning that gmap would otherwise do
to the numeric data).

I then create a 'my_map' sas/graph map data set, containing 4 x/y
coordinates for each box in the grid.  I make liberal use of offsets
to separate the groups of boxes, and place them where I want.

I then create some annotate data sets to put the "risk score" label
on each box (making the color black for light-colored boxes, and
yellow for dark boxes), as well as various other labels.  I use the annotate 
cbox and cborder to put the boxes around the text at the tops of the
columns (such as 'Smoker' and 'Non-Smoker').

In the legend, I hard-code the textual value labels (such as '10%-14%')
so they look exactly the way I wanted (alternatively I could have used
a user-defined format).  Rather than using the built-in legend label
capability, I annotate the word 'SCORE' above the legend, and then
annotate a '+' in the middle of the 'O', to get that special-looking
character :)

Then, all that's left is to run "proc gmap" and draw my custom map,
and annotate all my text labels on it, and let ODS html map all of
the charttips/flyover-text over the right locations!

Back to Samples Index