[SAS macros] SAS Graphic Programs and Macros [SAS macros]

Michael Friendly
York University



This page provides access to SAS programs and macros for statistical graphics. Some were initially described in The SAS System for Statistical Graphics, First Edition and in Visualizing Categorical Data, however many of these have been updated and extended since their original publication. Most of them require SAS/GRAPH, SAS/STAT and/or SAS/IML as well as base SAS. See the Usage Notes for local modifications you may have to make at your site and for general descriptions of macro parameter conventions.

A considerable number of additional macros are also included here. Some are mentioned below, but all are now linked on the menu at the top of this page.
The individual listing below is no longer being maintained.

[download] boxcox macro
Finds power transformations of the response variable in a regression model (PROC REG) by the Box-Cox method, with graphic display of the maximum likelihood solution, t-values for model effects, and the influence of observations on choice of power.
[download] boxglm macro
Finds power transformations of the response variable in a general linear model (PROC GLM) by the Box-Cox method.
[download] caliscmp macro
Compare model fits from PROC CALIS. The CALISCMP macro extracts goodness of fit statistics from the RAM data sets produced in a series of models fit to a given data set using PROC CALIS. The COMPARE= parameter allows pairs of nested models to be tested.
[download] canplot macro
Canonical discriminant structure plot Displays the observations in a dataset in the space of the two canonical variables which discriminate most among groups. Also plots class means on the canonical variates, confidence circles for those means, and variable vectors showing the correlations of variables with the canonical variates..
[download] coplot macro
Constructs a conditioning plot - plots of Y * X | Z, showing how the relationship between X and Y depends on Z.
[download] cpplot macro
Plots of Mallow's C(p) and related statistics for model selection in linear models
[download] corrgram macro
The CORRGRAM macro produces a schematic display of a correlation matrix, called a correlogram. In this display, variables are permuted so that ``similar'' variables are positioned adjacently, and cells of a matrix are shaded or filled to show the correlation value.
[download] cqplot macro
The cqplot macro produces quantile-quantile comparison plots for multivariate normal data (based on squared Mahalanobis distances from the centroid) or for other data which should follow a Chi-square distribution, together with estimated confidence bands.
[download] csmpower macro
The csmpower macro carries out retrospective or prospective power computations for covariance structure models using the method of MacCallum, Browne and Sugawara (1996).
[download] datachk macro
The datachk macro performs basic data screening/checking on numeric variables in a dataset, and is designed to give a compact overview of many variables.
[download] dummy macro
The dummy macro creates dummy (0/1) variables to represent the levels of a discrete variable in a regression model. If the original variable has c levels, (c-1) new variables are produced.
[download] faces macro
Draws (possibly asymmetric) faces to represent multivariate observations.
[download] fpower macro
Power computations for ANOVA designs
[download] gtree macro
Draw a tree dendrogram from PROC CLUSTER/VARLCUS output
[download] hemat macro
Plot Hypothesis and Error matrices for all pairs of variables
[download] heplot macro
Plot Hypothesis and Error matrices for a bivariate MANOVA effect
[download] inflogis macro
Produces an influence plot for a logistic regression model. The plot shows a measure of badness of fit for a given case (DIFDEV or DIFCHISQ) vs. the fitted probability (PRED) or leverage (HAT), using an influence measure (C or CBAR) as the size of a bubble.
[download] inflplot macro
Produces an influence plot for a regression model -- a plot of studentized residuals vs. leverage (hat-value), using COOK's D or DFFITS as the size of a bubble symbol.
[download] label macro
Constructs an Annotate data set to label points in a 2- or 3-D scatter plot.
[download] jitter macro
The JITTER macro adds a small amount of noise to numeric variables, usually to avoid overplotting for discrete data.
[download] meanplot macro
The meanplot macro produces 1-way, 2-way, or 3-way plots of means for a factorial design with any number of factor variables.
[download] missrc macro
The missrc macro estimates cell probabilities in an n-way table with ignorable missing data (missing completely at random [MCAR], or missing at random [MAR]) on the table variables. The results are equivalent to the use of the EM algorithm.
[download] mpower macro
The mpower macro performs retrospective power analysis for a multivariate PROC GLM analysis. This treats the sample means as if they were population means, determines an effect size, and calculates the power for specified effects.
[download] orpoly macro
Constructs orthogonal polyomial contrasts (allowing unequal spacing | N)
[download] panels macro
The panels macro constructs a template in which to replay a series of panels, assumed all the same size, in a rectangular array of R rows and C columns.
[download] power macro
The power macro provides power calculations for general linear models.
[download] powerrxc macro
The powerrxc macro computes approximate power for Pearson and Likelihood Ratio Chi-square tests of independence in PROC FREQ.
[download] resline macro
Fits a resistant line to X-Y data and determines transformations to make the relation linear.
[download] robcov macro
The ROBCOV macro calculates robust estimates of the mean vector, variance-covariance matrix and/or correlation matrix for a multivariate sample. It also calculates classical estimates of multivariate (Mahalanobis) distance, and robust estimates of multivariate distance which ignore potential outliers. Optionally, it produces a plot of robust vs. classical distances.
[download] rpower macro
Retrospective power analysis for univariate GLMs.
[download] rsqdelta macro
Compute R-square change and F-statistics in regression.
[download] scale macro
Scale a set of variables to a given range.
[download] scatter macro
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.
[download] splot macro
Draws low-res (printer) schematic plots (boxplots) for one or more variables.
[download] sprdplot macro
The sprdplot macro produces a spread-level plot to determine if a simple power transformation can equalize within-group variance of a response variable in a dataset classified by one or more classification variables.
[download] stat2dat macro
The stat2dat macro takes a dataset containing summary statistics (N, mean, std dev) for a between groups design and produce a dataset from which PROC GLM can be run, producing an ANOVA summary table equivalent to that calculated from the raw data.
[download] sunplot macro
Sunflower plot for X-Y data. The sunflower plot displays a bivariate dataset using "sunflower symbols" to show the number of observations in the neighborhood of each XY point.
[download] symbox macro
Displays boxplots of a single variable raised to various powers in side-by-side boxplots as an aid to finding a power transformation to symmetry.

Michael Friendly
Email<friendly@yorku.ca>