SAS Macro Programs: scatter
$Version: 1.2 (10 Oct 2006)
Michael Friendly
York University
Scatterplot matrix with SAS/INSIGHT
The scatter macro uses SAS/INSIGHT to produce
a scatterplot matrix for two or more variables, showing all pairwise
plots. If observations are classified by a grouping variable,
colors and symbols may be assigned automatically to the
observations in different groups.
The macro must be run in the SAS Display Manager, not in batch.
Also, the macro starts SAS/INSIGHT with a PROC INSIGHT
statement, so you must terminate INSIGHT before you
can run additional procedures from the Program Manager.
Usage
scatter is a macro program. Specify the names of the
VAR= variables, and the GROUP= or CLASS= grouping variable. All
options have default values.
The arguments may be listed within parentheses in any order, separated
by commas. For example:
%scatter(data=iris, var=sepalwid sepallen petalwid petallen, class=species);
Arguments
- DATA=
- The name of the SAS dataset to be plotted. If DATA= is not
specified, the most recently created data set is used.
- VAR=_numeric_
- List of variables to be plotted.
The default is to plot all numeric variables in the dataset.
- CLASS=
- GROUP=
- Name of an optional grouping variable used
to define the plot symbols and colors.
- SYMBOLS=square plus circle diamond X up down star
- List of symbols, separated by spaces, to
use for plotting points in each of the groups.
The i-th element of SYMBOLS is used for
group i.
- COLORS=BLACK RED GREEN BLUE BROWN YELLOW ORANGE PURPLE
- List of colors to use for each of the
groups. If there are g groups,
specify g colors. The i-th
element of COLORS is used for group i.
Notes
The scatter macro calls the paint macro to assign
colors and symbols to the observations.
Example
%include goptions;
%include data(iris);
%scatter(data=iris,
var=sepalwid sepallen petalwid petallen,
class=species)
See also
scatmat Scatterplot matrix
paint