Macro Programs from "The SAS System for Statistical Graphics"

The SAS System for Statistical Graphics, First Edition contains numerous general macro programs for the graphical methods described in the book. These programs are described and illustrated throughout the book and listed in Appendix A. The book may be ordered by WWW (click for an order form) from SAS Institute (click for their WWW server).

Copyright: Yes, Warrantee: No

These programs all bear the following copyright notice:

From SAS System for Statistical Graphics, First Edition; Copyright(c) 1991 by SAS Institute Inc., Cary, NC, USA.

This material is provided "as is" by SAS Institute Inc. There are no warranties, express or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. The Institute is not responsible for errors in this material as it now exists or will exist, nor does the Institute provide technical support for it. Questions or problem reports concerning this material may be addressed to the author, Michael Friendly, by electronic mail:

Michael Friendly <>

Program Availability

The graphic macros published in Appendix A of SAS System for Statistical Graphics are available from several sources.

The current versions of the programs may be obtained from To obtain the programs individually by WWW, click the FTP icons below.

The datasets used in the book are also available here in the directory .

Macro Programs

Click the program name for program documentation, or the FTP button to obtain the program. See the Usage Notes for local modifications you may have to make at your site and for general descriptions of macro parameter conventions.
[download] ftp [doc]BIPLOT
Implements the biplot technique (e.g., Gabriel, 1971) for plotting multivariate observations and variables together in a single display.
[download] ftp [doc] BOXANNO
Provides univariate marginal boxplot annotations for two-dimensional and three-dimensional scatterplots.
[download] ftp [doc] BOXPLOT
Produces standard and notched boxplots for a single response variable with one or more grouping variables.
[download] ftp [doc] CONTOUR
Plots a bivariate scatterplot with a bivariate data ellipse for one or more groups with one or more confidence coefficients.
[download] ftp [doc] 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.
[download] ftp [doc] 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.
[download] ftp [doc] DOTPLOT
Produces grouped and ungrouped dot charts of a single variable (Cleveland, 1984, 1985).
[download] ftp [doc] LOWESS
Performs robust, locally weighted scatterplot smoothing (Cleveland, 1979).
[download] ftp [doc] 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.
[download] ftp [doc] 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.
[download] ftp [doc] PARTIAL
Produces partial regression residual plots. Observations with high leverage and/or large studentized residuals can be individually labeled.
[download] ftp [doc] SCATMAT
Draws a scatterplot matrix for all pairs of variables. A classification variable may be used to assign the plotting symbol and/or color of each point.
[download] ftp [doc] 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.
[download] ftp [doc] 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.
[download] ftp [doc] 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.

Michael Friendly
My home page