ARCHIVED: How do I create a scatterplot matrix in SAS?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Instead of creating multiple individual scatterplots to examine relationships between variables with PROC GPLOT, it is often useful to examine the scatterplots of multiple relationships in a matrix form (i.e., to examine relationships before performing a multiple linear regression). To create a scatterplot matrix in SAS, use the SGSCATTER procedure:

PROC SGSCATTER DATA=input.data; 
     MATRIX <var1 var2...>;
RUN; 

Submitting this procedure will produce the scatterplot matrix in the results viewer (output window for versions prior to 9.3, or .png files on Linux platforms) with the variable names along the diagonal. You may also choose to see graphs in the diagonal of the matrix by specifying an option for the matrix statement as follows:

PROC SGSCATTER DATA=input.data; 
     MATRIX <var1 var2...>/DIAGONAL = (HISTOGRAM); 
RUN;

In addition to a HISTOGRAM graph option, you may also request a KERNEL density or a NORMAL density curve with the diagonal option.

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document bbpn in the Knowledge Base.
Last modified on 2023-05-09 14:41:52.