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

This is a sas imitation of a plot from p. 83 of Stephen Few's
book "Show me the Numbers".

This is actually a gplot line plot, rather than a gchart bar chart.

At first...
I created 3 obsns for each value -- one with the data value, one with
the min value of my axis range, and then a sas 'missing value'.
I then use gplot to draw the line segments (using a thick line 
that looks like a bar), and I use the skipmiss option to have it
lift the pen between drawing each bar segment.

But, alas, the line segments had rounded ends I couldn't override,
so I opted for drawing the thich horizontal lines with annotate
instead (using annotate 'move' and 'draw' commands).  

I use 'proc reg' to calculate a regression line for the data values.
I don't think this is a statistically valid line since it is just
regressing against the obsn#, but it produces a visual line that 
lets you see a trend (and this is what it looked like in the book :)

I use an axis statement to make the vaxis "disappear", and to 
order the haxis of the height chart 'backwards'.

I put the 2 graphs side-by-side using good old "proc greplay".

Back to Samples Index