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

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

Note that this example is included in the book SAS/Graph: Beyond the Basics,
and all the 'tricks' used to create it are described in great detail!

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

This plot is my own version of a plot I found on the following page:
LA Ozone Chart
Explanation

I wrote all of the code for my chart totally independently,
and have never seen the code used to create the chart referenced
in the above pages.


In my example, I use sas/graph "proc gmap" to draw a calendar
and color-code it based on my data - I call this my "calendar
chart".

First, you'll need data that has a variable containing a date,
and has 1 obsn per day.  Sort that data by date, to make sure
it's in ascending order.  Then, create a custom sas/graph map 
data set, by outputting 4 x/y coordinates for each day (this 
takes a little bit of mathematical trickery & looping, such 
that you get each year grouped together, and then you have 
each week's worth of data in a column in that year, and all
the same weekdays line up left-to-right.

Then, based on this sas/graph map data set, I create an annotate
data set that has labels to put along the left (for year and
weekday names), and along the top (for the month names).

I then use sas/graph "proc gmap" to draw this map, and color-code
the blocks based on the value of some response variable (you
tell it which variable to use via gmap's "choro" statement).

To make it a little easier to determine the exact date and 
value for any given block, I have use gmap's "html=" option
to add html title= charttips/flyover-text, so that when you 
hover your mouse over the blocks (using the Internet Explorer
web browser) you'll see the date and the exact data value.

It is impressive that this type of chart can graphically show
10 years (or more) worth of data on one page, and it is easy
to visually see changes and patterns in the data (for example 
the months march-october have noticeably higher values in this
chart, and also after the year 1989 the values decreased.) 

Back to Samples Index