SGSCATTER Procedure

Example 4: Creating a Comparative Panel with Regression Fits and Confidence Ellipses

Features:

COMPARE statement

REG option

ELLIPSE option

SPACING option

Sample library member: SGSCCM1
This example shows a comparative panel of scatter plots with regression fits and confidence ellipses.

Output

Comparative Panel with Regression Fits and Confidence Ellipses

Program

proc sgscatter data=sashelp.iris(where=(species="Versicolor"));
  title "Versicolor Length and Width";
  compare y=(sepalwidth petalwidth)
          x=(sepallength petallength)
          / reg ellipse=(type=mean) spacing=4;
run;
title;

Program Description

Create the scatter plot. In the COMPARE statement, the REG option fits the regression lines and the ELLIPSE option creates the confidence ellipses and sets the ellipse type to MEAN. The SPACING= option adds spacing between plots.
proc sgscatter data=sashelp.iris(where=(species="Versicolor"));
  title "Versicolor Length and Width";
  compare y=(sepalwidth petalwidth)
          x=(sepallength petallength)
          / reg ellipse=(type=mean) spacing=4;
run;
title;