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

Click here to download the sas dataset.


I got all the mpg data (2008-1984) from:

In this example, I do the main title with a short/wide gslide,
and I do the individual plots with "gplot", using "ods htmlpanel"
to dynamically lay out the plots 3-per-row (this is a lot simpler
than doing a greplay/dashboard layout, since I don't really care
about the placement of the individual charts - the alphabetical
order of the make/manufacturer produced by the "by make" is fine
with me).

Note that you have to sort your data "by make" before you can
do the single gplot "by make" ... but this is the beauty and
simplicity of sas ... one gplot, automatically looping through
all my data, and producing dozens of plots.

I hard-code the axes so they go from 0-70 mpg, so that each
plot will be plotted to the exact/same/predictable scale
(that way we can visually compare them easier).

I annotate a light gray line from the bottom/left to the top/right
so that it's easy to tell if the vehicles get better mileage 
on the highway or city (this helps identify many of the 
hybrid vehicles, since they generally get better mileage 
around the city, while they're using the electric cells at
low speed).

Also, I annotate 'bad' at the bottom/left and 'good' at the
top/right, so that people don't even have to think about
what the axes really mean ;)

I arbitrarily picked 30mpg as the milestone/threshold for what
I consider "decent" mpg, and drew a light red line at the 
30mpg marks, so it's easy to quickly tell whether a manufacturer's
cars get "good" or "bad" mileage.

Back to Samples Index