Click here to see the SAS code.
Click here to see the example.
My goal in this example is to show that sas/graph gplot can be used to
display the production & warranty-work info for an entire production
run of a car.
Although I'm showing a *lot* of data here, it would also be useful to
slice-n-dice the data in many different ways, and view targeted subsets
of the data.
The car I chose was a 2001 Camaro with the V8 LS1 engine (since I own one :)
Although the real automobile manufacturers will have real data, I had to
create some "plausibly-real" data. Here is a description of the data
I created... *** Note that this data is entirely imaginary!!!
There were 12,652 of these cars produced, so I started by creating that number
of observations. I assigned a production date and a unique production
sequence number to each car (note that this sequence number would be the
last 6 digits of the VIN number of each car). I then plotted these observations
as black 'dots' - since there are so many dots packed so closely together,
they almost form a black line. Note that each little 'break' in the line
represents a weekend (I created my data so there were no cars produced on
the weekend), and also the line flattens out during the week of christmas
(I wanted to show that there would probably be fewer cars produced during
the holiday week).
I created a green dot to represent when each car was sold. I used a
one-sided, slightly modified 'normal' distribution to choose a date for
when the cars were sold (notice how the trail off to the right).
All the other colored dots represent various kinds of warranty work
that was done...
The red dots represent brake work. Notice that there is a notably
higher incidence of brake work done on cars produced during the
christmas holiday (maybe the some of the brake experts were all on
holiday during that week :) Notice that there was a lot of brake
work done about a year after sale, and then another smaller clump
about 2 years after sold.
The blue dots represent transmission work. Note that most of these
blue dots are grouped about 300 days after the car was sold.
The magenta colored dots represent A/C (air conditioner) warranty work.
Note that there are very few of these dots, and they are uniformly
The yellow dots represent headlight work. Note that these only occur for
cars produced during the first month of production, and they all occurred
about 200 days after the cars were sold -- this could represent a production
problem that was caught early-on (maybe because someone was looking at a
graph like this!) and then corrected.
To get the very-wide graph, I specify goptions for xpixels and ypixels
(you cannot specify such a large size using hsize and vsize, unless you
go to the trouble of modifying the 'gif' gdevice, so it is much easier to
just specify the size in xpixels and ypixels).
I use the gplot 'cframe' option to specify a light gray for the area inside
the axes (so that the light-colored markers, such as yellow, will show up),
and I use a slightly darker color for the reference lines (using the chref
and cvref gplot options).
I use axis statements to angle/rotate the yaxis label, and the x-axis
Rather than using gplot's normal markers, I use annotated dots - this gives
me easier control over the exact color, and also the marker shapes (if I chose
to use something other than a dot). Since I annotate my markers, I can't use
gplot's automatic legend, so I 'fake' a legend using the title2 - the dots in
the title2 are the 'W' character of the sas/graph 'marker' software font.
And, to give a visual cue as to which car this plot is about, I annotate
a jpg image of a 2001 V8 LS1 Camaro (a picture of the one I own :)
Back to Samples Index