SAS Macro Programs for Statistical Graphics

These programs all require the base SAS and SAS/GRAPH products; many require SAS/STAT and SAS/IML or both as well.

General Usage Notes

You may receive unanticipated results if you use multiple macros in a single SAS session, because global statement parameters set in one macro may be carried over to subsequent macros used in the same session. If you are using Version 6 of the SAS system, we recommend adding the statment GOPTIONS RESET=ALL; to the beginning of each macro. Under Release 5.18, you can modify SYMBOL and PATTERN statements to explicitly specify null values for parameters (V=NONE, for example).

The macros were originally written to produce hardcopy output on a white background, and some use the black as a foreground color. If you are using the macros to generate graphics on a device with a black background, you may need change all references to BLACK in the macro to another color.

Macro Programs

BIPLOT
Implements the biplot technique (e.g., Gabriel, 1971) for plotting multivariate observations and variables together in a single display.
BOXANNO
Provides univariate marginal boxplot annotations for two-dimensional and three-dimensional scatterplots.
BOXPLOT
Produces standard and notched boxplots for a single response variable with one or more grouping variables.
CONTOUR
Plots a bivariate scatterplot with a bivariate data ellipse for one or more groups with one or more confidence coefficients.
CORRESP
Performs correspondence analysis (also known as "dual scaling") on a table of frequencies in a two-way (or higher-way) classification. In V6 of &SAS., this analysis is also performed by PROC CORRESP.
DENSITY
Calculates a nonparametric density estimate for histogram smoothing of a univariate data distribution. The program uses the Gaussian kernel and calculates an optimal window half-width (Silverman, 1986) if not specified by the user.
DOTPLOT
Produces grouped and ungrouped dot charts of a single variable (Cleveland, 1984, 1985).
LOWESS
Performs robust, locally weighted scatterplot smoothing (Cleveland, 1979).
NQPLOT
Produces theoretical normal quantile-quantile (Q-Q) plots for single variable. Options provide a classical (mu, sigma) or robust (median, IQR) comparison line, standard error envelope, and a detrended plot.
OUTLIER
Detects multivariate outliers. The OUTLIER macro calculates robust Mahalanobis distances by iterative multivariate trimming (Gnanadesikan & Kettenring, 1972; Gnanadesikan, 1977), and produces a chisquare Q-Q plot.
PARTIAL
Produces partial regression residual plots. Observations with high leverage and/or large studentized residuals can be individually labeled.
SCATMAT
Draws a &scat matrix for all pairs of variables. A classification variable may be used to assign the plotting symbol and/or color of each point.
STARS
Draws a star plot of the multivariate observations in a data set. Each observation is depicted by a star-shaped figure with one ray for each variable, whose length is proportional to the size of that variable.
SYMPLOT
Produces a variety of diagnostic plots for assessing symmetry of a data distribution and finding a power transformation to make the data more symmetric.
TWOWAY
Performs an exploratory analysis of two-way experimental design data with one observation per cell, including Tukey's (1949) one degree of freedom test for non-additivity. Two plots may be produced: a graphical display of the fit and residuals for the additive model, and a diagnostic plot for a power transformation for removable non-additivity.