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

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

Click on one of the bars to see the chart I was trying to imitate/improve.

Notice that these "floating bars" (as they call them in the powerpoint slide)
look a lot like box plots.

SAS can do boxplots (using either proc boxplot, or sas/graph gplot with
interpol=box), but to get this chart exactly like the one in the ppt slide
I decided to use annotate.

I used "proc gplot" to do the axes (with a 'plot2' statement causing 
the extra axis on the right-hand side.

To get the bars in the desired order left-to-right, I assigned them
each a numeric value, and then print the text label under the bar
(such as 'LAST 5 YEARS' using a user-defined format.  Rather than
hard-coding the user-defined format, I use some slightly "tricky"
code to generate the user-defined format from the data, on the fly.
I put '\' characters in the text, and then use split='\' in the
axis statement to make it split the text onto a separate line when
it encounters this character.

I use the percentn format, so that negative numbers have a '-' sign,
rather than being enclosed in ()'s.

I use a blank footnote with a large height to allocate a bunch of
white space under the graph.  I then annotate the table of values 
in that area.

The markers in the plot are annotated text characters from the 'markere' 
font (empty marker, rather than filled), and the 'special' font.
These are both sas/graph software fonts (hardware fonts could be used,
but they are not as easily portable between systems).  If you're always
going to run on Windows, a truetype hardware font could be used to
produce smoother-looking characters.


I took the liberty of making the following improvements over the original:
   
   o The sas web output has html charttips/rollover-text.

   o The sas web output has html drilldown on the bars.

   o I added a light gray 'zero %' refline.

   o I added color to the markers, so a marker-of-interest 
     could be easily hilighted, and to show that sas can 
     selectively color markers as desired/needed.

   o I made the trianglular markers outline, instead of solid,
     so they would look more consistent with the others.

   o I put dots ('.') for the missing values in the table
     below the graph.

   o I made the spacing to the left and right of the first 
     and last bars equal.
 
   o I left out 2 labels above the graph, and the underlines for
     the column headers (to reduce 'clutter' on the graph).

   o I made the 'mean' line thicker, so to differentiate it from
     the other lines that make up the floating bar.

Back to Samples Index