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

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

This is a SAS/Graph implementation of the sgplot graph from this example:
http://blogs.sas.com/content/graphicallyspeaking/2012/02/09/sg-procedures-book-samples-adverse-event-timeline/

I use Proc Gplot to draw the axes and the legend, and then 
annotate the event 'bars', the 'arrow' on the end of bars 
that extend outside the axes, and the zero-line. 

----

One advantage of the SAS/Graph version is that it can be used in any version of SAS,
whereas sgplot only works in recent versions (and since sgplot is 'new', it is
more likely to have bugs or incomplete features).

Here are some other advantages of this Gplot implementation:

o The event labels are guaranteed to fit, since they are treated 
  as part of the axis.

o Also, the axis order is controlled by a numeric variable, but the 
  axis text is created using a user-defined format (created on-the-fly
  from the data itself).

o The upper & lower axes use matching tickmarks, to avoid confusion.

o Single-day events actually have a width (rather than being just 1 pixel wide).

o Each event has mouse-over text & drilldown.

o The timeline graph is drawn top-to-bottom, the same order as the 
  tabular data, and in the natural reading order.

o Being created using custom annotate, the graph is just about 100% customizable.

o Used the same date format in the axis, as had been used in the 
  original data.


(Note that I have changed the data just a little from the original, to demonstrate 
additional functionality.)

Back to Samples Index