The SGSCATTER Procedure |
Statements for Creating Panels |
The SGSCATTER procedure contains three statements that you can use to create a paneled graph of scatter plots:
PLOT
COMPARE
MATRIX
Each of the statements is specialized for creating a different type of paneled graph.
The PLOT statement is used to create a paneled graph of scatter plots where each graph cell has its own independent set of axes. Each variable pair that you specify in the PLOT statement creates an independent graph cell. You can also overlay fit plots and ellipses on each cell by using options.
For example, Example Graph from the PLOT Statement shows a graph that contains two independent cells. Each cell contains a scatter plot and a loess curve.
Example Graph from the PLOT Statement
By default, the axis ranges of each cell are independent from the other cells. However, you can use the UNISCALE= option to specify that all of the cells use the same axis ranges for the X axis, the Y axis, or both axes.
Note: It is possible to create a single scatter cell with the PLOT statement, but the SGPLOT procedure is better suited to creating a single-celled graph.
The COMPARE statement is used to create a shared axis panel, also called an MxN matrix. The list of X and Y variables are crossed to create each cell in the graph. All cells in a row share the same row axis range. All cells in a column share the same column axis range.
When using the COMPARE statement, you can add fit plots and confidence ellipses to each cell in the panel by using options.
The COMPARE statement can also be used to do simple X or Y axis sharing by specifying only one X or Y variable, as in the following example:
Example Graph from the COMPARE Statement
The MATRIX statement is used to create a scatter plot matrix. Each of the variables that you specify are graphed against each other to create the graph. You can use the ELLIPSE option to overlay a confidence ellipse on each cell in the panel.
The MATRIX statement also has an option called DIAGONAL= that enables you to display the distribution of your variables in the diagonal cells of the matrix. You can place histograms in the diagonal cells, and overlay those histograms with normal density curves or kernel density estimates.
For example, the following example shows a graph with histograms and normal density curves in the diagonal cells.
Example Graph from the MATRIX Statement
Legends in the SGSCATTER Procedure |
The SGSCATTER procedure creates a legend automatically when you specify a GROUP= variable. You can use the NOLEGEND option to disable the legend.
For all of the graph creation statements, you can use the LEGEND= option to specify the attributes of the legend.
Line Patterns |
The LINEATTRS= option in some plot statements enables you to specify the line pattern that is used for the lines in your plot. List of Line Patterns shows the line patterns that you can use.
Marker Symbols |
The MARKERATTRS= option in some of the plot statements enables you to specify the marker symbol that is used to represent your data. The markers that you can use are shown in the following figure:
List of Marker Symbols
Units of Measurement |
Some options such as LINEATTRS enable you specify the unit of measurement as part of the value. The following table contains the units that are available:
Unit | Description |
---|---|
CM | centimeters |
IN | inches |
MM | millimeters |
PCT or % | percentage |
PT | point size, calculated at 100 dots per inch |
PX | pixels |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.