SAS Macro Programs: splot
$Version: 1.7 (7 Jun 2001)
Michael Friendly
York University
The splot macro draws side-by-side boxplots for the groups
defined by one or more grouping (CLASS) variables in a data set.
It is a simplified, printer version of the boxplot macro.
Method
The macro uses PROC UNIVARIATE; BY CLASS producing a printer-plot
version of the boxplot, and discards all the output for each
group separately.
To do this, the macro uses PROC PRINTTO to route the PROC UNIVARIATE
output to a temporary file.
This means that you should not call the splot macro
within another application that uses PROC PRINTTO to
redirect procedure output.
Usage
- DATA=_LAST_
- Name of the input data set.
- CLASS=
- Grouping variable(s). The CLASS= variables
may be character or numeric. If no CLASS= variable
is specified, the program generates one boxplot for
all the data.
- VAR=
- The name of the response variable(s) to be plotted.
A separate plot is produced for each variable listed.
- ID=
- A character variable to identify each
observation. If an ID= variable is specified,
outside variables are labelled on the graph,
using the first 8 characters of the value of
the ID variable (to reduce overplotting).
Otherwise, outside points are not labelled.
- LS=80
- Linesize option for printed output, which determines
how many groups will fit on the page.
Example
The example below plots data for 6 groups in a 2 x 3 design,
classified by factors A and B.
title h=1.5 'Notched Boxplot: 2 x 3 design';
%splot(data=testbox,
class= A B, var=y,
id=name,
ls=80);
See also
boxplot Box-and-whisker plots
dotplot Dotplots