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

---------------------------------------------------------------

Xan Gregg (representing SAS) recently won Stephen Few's 2006 
business graphics contest.

Click here to see Xan's actual graph.

This example is my own (Robert Allison) implementation, using traditional
SAS/Graph, to produce a graph (almost) exactly like Xan's winning graph.
Also, since my output is web-based, I have added html charttips & drilldowns
to the number/markers in the graph, and also to each individual line in
the table below the graph.

This was not a "trivial" SAS/Graph to do :)

I used "proc import" to read the data directly from the spreadsheet.
I used SAS/Graph "proc gplot" to plot the data & color the area under 
the graph line.

That's about it for standard/easy things...

Now, here's what I used "tricks" to do...

Since gplot doesn't do reflines in front of the "area" plot, I had
to annotate the reference lines (using move/draw).

Since SAS doesn't have a date format that prints a 2-digit day (with leading 0),
I had to get tricky and do some string parsing of the date value, and then 
process it with the z2. format, and then annotate the numbers along the x-axis.

Behind each number along the x-axis, I annotated a square character, and colored
it gray or white depending on whether it was a day of an odd, or even-numbered
week.

The numbers on the plot were produced by annotating special characters of 
the "Wingding 2" font.  (Could have alternately been done by annotating a 
pie/circle, and annotating the text number in the middle -- I wanted them
to look as much like Xan's as possible, so I used the "Wingding 2" font 
for this example.

I annotated the lavendar square behind the title at the top of the page.


The tables before & after the graph are not really "tables" - they are
SAS/Graph graphics as well.  I used "proc gslide" and then annotated 
everything on them.  In the first table, I calculate all the values
an save them in macro variables, and then annotate those values in the
pre-defined locations.

In the 2nd table, I loop through the data, and move my y-position down
the page for each line of data, annotating the values as I go.  The 
alternating gray & white areas behind the lines of the table (ala "green
bar paper") are also done with annotate (using the 'bar' function).

By default, sas would put a visible line between each graph, in the ODS
html output.  I created my own modified version of the ods "minimal"
style, and changed "Pagebreakhtml=_undef_" to suppress these visible 
line-breaks.


Back to Samples Index