SGPANEL Procedure

REG Statement

Creates a fitted regression line or curve.
Interaction: A linear regression (DEGREE=1) cannot be used with logarithmic axes.
About Regression Plots

Creating a Panel of Regression Curves

Syntax

REG X= numeric-variable Y= numeric-variable </ option(s)>;

Summary of Optional Arguments

Label options
adds a label for the curve.
specifies the location of the curve label.
displays a label for each data point.
Limit options
creates prediction limits for the individual predicted values.
specifies the appearance of the individual value prediction limits by using an ODS style element or by specifying attributes for the outlines.
creates confidence limits.
specifies the appearance of the mean value confidence limits by using an ODS style element or by specifying fill and line attributes.
specifies the degree of transparency for the confidence limits.
Plot options
specifies the confidence level for the confidence limits.
specifies the value of the ID variable in an attribute map data set.
specifies how many times observations are repeated for computational purposes.
specifies a classification variable to divide the values into groups.
specifies a label that identifies the regression curve in the legend.
specifies a name for the plot.
specifies how observations are weighted.
REG options
specifies the degree of the polynomial fit.
specifies the appearance of the fit line.
specifies the appearance of the markers in the plot.
specifies the maximum number of predicted points for the regression curve and for any confidence limits.
hides the legend entry for the individual predicted value confidence limits.
hides the legend entry for the mean value confidence limits.
hides the legend entry for the fit line.
removes the scatter markers from the plot.

Required Arguments

X= numeric-variable
specifies the variable for the x axis.
Y= numeric-variable
specifies the variable for the y axis.

Optional Arguments

ALPHA= numeric-value
specifies the confidence level for the confidence limits. Specify a number between 0.00 (100% confidence) and 1.00 (0% confidence).
Default:.05
Interaction:This option has no effect unless you specify the CLI or CLM option (or both).
ATTRID= variable
specifies the value of the ID variable in an attribute map data set. You specify this option only if you are using an attribute map to control visual attributes of the graph. For more information, see Using SG Attribute Maps to Control Visual Attributes.
CLI <= “text-string”>
creates prediction limits for the individual predicted values. The optional text string overrides the default legend label for the prediction limits.
CLIATTRS = style-element | (CLILINEATTRS= style-element <(options)> | (options))
specifies the appearance of the individual value prediction limits by using an ODS style element or by specifying attributes for the outlines. The outline attributes can be the following:
CLILINEATTRS= style-element <(options)> | (options)
You can specify the appearance of the outline by using a style element or by using suboptions. If you specify a style element, then you can also specify suboptions to override specific appearance attributes.
options can be one or more of the following:
COLOR= color
specifies the color of the line. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the ContrastColor attribute of the GraphPredictionLimits style element in the current style. For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.
PATTERN= line-pattern
specifies the line pattern for the line. You can reference SAS patterns by number or by name. For a list of line patterns, see Line Patterns.
Default:For ungrouped data, the default line pattern is specified by the LineStyle attribute of the GraphPredictionLimits style element in the current style. For grouped data, the default line pattern is specified by the LineStyle attribute of the GraphData1 ... GraphDatan style elements in the current style.
THICKNESS= n <units>
specifies the thickness of the line. You can also specify the unit of measure. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:For ungrouped data, the default line thickness is specified by the LineThickness attribute of the GraphPredictionLimits style element in the current style. For grouped data, the default line thickness is specified by the LineThickness attribute of the GraphData1 ... GraphDatan style elements in the current style.
Default:The default style element is GraphPredictionLimits.
Interaction:The CLIATTRS = option has no effect unless you also specify the CLI option.
CLM <= “text-string”>
creates confidence limits. The optional text string overrides the default legend label for the confidence limit.
CLMATTRS = style-element | (CLMAttributeOptions )
specifies the appearance of the mean value confidence limits by using an ODS style element or by specifying fill and line attributes. CLMAttributeOptions can be one or both of the following:
CLMFILLATTRS=style-element | (COLOR= color)
You can specify the color of the fill by using a style element or by using the COLOR= suboption. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
CLMLINEATTRS= style-element <(options)> | (options)
You can specify the appearance of the outline by using a style element or by using suboptions. If you specify a style element, then you can also specify suboptions to override specific appearance attributes.
The confidence limits have no outlines by default (for most styles). To make the outlines appear, you can change the DISPLAYOPTS in the GRAPHBAND style element. Then you can specify attributes for the outlines. The following code provides an example.
proc template;
  define style MyStyleDefault;
  parent=Styles.Default;
  style GraphBand from GraphBand /
      DisplayOpts = "Fill outline";
  end; 
run;

ods listing style= MyStyleDefault;
proc sgplot data=sashelp.class;
  reg x=height y=weight / CLM
  CLMATTRS=(CLMLINEATTRS= 
   (COLOR=Green PATTERN= ShortDash)); 
run;
The CLMLINEATTRS= options can be one or more of the following:
COLOR= color
specifies the color of the line. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the ContrastColor attribute of the GraphConfidence style element in the current style. For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.
PATTERN= line-pattern
specifies the line pattern for the line. You can reference SAS patterns by number or by name. For a list of line patterns, see Line Patterns.
Default:For ungrouped data, the default line pattern is specified by the LineStyle attribute of the GraphConfidence style element in the current style. For grouped data, the default line pattern is specified by the LineStyle attribute of the GraphData1 ... GraphDatan style elements in the current style.
THICKNESS= n <units>
specifies the thickness of the line. You can also specify the unit of measure. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:For ungrouped data, the default line thickness is specified by the LineThickness attribute of the GraphConfidence style element in the current style. For grouped data, the default line thickness is specified by the LineThickness attribute of the GraphData1 ... GraphDatan style elements in the current style.
Interaction:This suboption has no effect unless you change the display options in the style element to display outlines. See the preceding code example.
Default:The default appearance of the confidence limits is specified by the GraphConfidence style element in the current style.
Interaction:The CLMATTRS = option has no effect unless you also specify the CLM option.
CLMTRANSPARENCY= numeric-value
specifies the degree of transparency for the confidence limits. Specify a value from 0.0 (completely opaque) to 1.0 (completely transparent).
Default:0.0
Interaction:This option takes effect only if you also specify the CLM option.
CURVELABEL <=“text-string”>
adds a label for the curve. You can also specify the label text. If you do not specify a label, the label from the Y variable is used.
CURVELABELPOS= MIN | MAX | START | END
specifies the location of the curve label. Specify one of the following values:
MIN
places the label at the part of the curve closest to the minimum X axis value.
MAX
places the label at the part of the curve closest to the maximum X axis value.
START
places the curve label at the first point on the curve.
END
places the curve label at the last point on the curve.
Default:END
Interaction:This option has no effect unless the CURVELABEL option is also specified.
DATALABEL <= variable>
displays a label for each data point. If you specify a variable, then the values of that variable are used for the data labels. If you do not specify a variable, then the values of the Y variable are used for the data labels.
Interaction:This option has no effect if you also specify the NOMARKERS option.
DEGREE= n
specifies the degree of the polynomial fit. For example, 1 specifies a linear fit, 2 specifies a quadratic fit, and 3 specifies a cubic fit.
Default:1
FREQ= numeric-variable
specifies how many times observations are repeated for computational purposes. Each observation is repeated n times for computational purposes, where n is the value of the numeric variable. If n is not an integer, then it is truncated to an integer. If n is less than 1 or missing, then it is excluded from the analysis.
GROUP= variable
specifies a classification variable to divide the values into groups. A separate plot is created for each unique value of the classification variable.
Interaction:If you specify the GROUP= option in multiple fit plot statements, then the first GROUP= variable is used for all of the fit plots that specify GROUP=.
LEGENDLABEL= “text-string
specifies a label that identifies the regression curve in the legend. By default, the label “Regression” is used.
Interaction:The LEGENDLABEL= option has no effect if you also specify the GROUP= option in the same plot statement.
LINEATTRS= style-element <(options)> | (options)
specifies the appearance of the fit line. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can also specify suboptions to override specific appearance attributes.
options can be one or more of the following:
COLOR= color
specifies the color of the line. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the ContrastColor attribute of the GraphFit style element in the current style.

For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.

PATTERN= line-pattern
specifies the line pattern for the line. You can reference SAS patterns by number or by name. For a list of line patterns, see Line Patterns.
Default:For ungrouped data, the default line pattern is specified by the LineStyle attribute of the GraphFit style element in the current style.

For grouped data, the default line pattern is specified by the LineStyle attribute of the GraphData1 ... GraphDatan style elements in the current style.

THICKNESS= n <units>
specifies the thickness of the line. You can also specify the unit of measure. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:For ungrouped data, the default line thickness is specified by the LineThickness attribute of the GraphFit style element in the current style.

For grouped data, the default line thickness is specified by the LineThickness attribute of the GraphData1 ... GraphDatan style elements in the current style.

MARKERATTRS= style-element <(options)> | (options)
specifies the appearance of the markers in the plot. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can also specify suboptions to override specific appearance attributes.
options can be one or more of the following:
COLOR= color
specifies the color of the markers. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the ContrastColor attribute of the GraphDataDefault style element in the current style.

For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.

SIZE= n <units >
specifies the size of the markers. You can also specify the unit of measurement. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:The default marker size is specified by the MarkerSize attribute of the GraphDataDefault style element in the current style.
SYMBOL= symbol-name
specifies the symbol for the markers. For a list of valid marker symbols, see Marker Symbols.
Default:For ungrouped data, the default marker symbol is specified by the MarkerSymbol attribute of the GraphDataDefault style element in the current style.

For grouped data, the default marker symbol is specified by the MarkerSymbol attribute of the GraphData1 ... GraphDatan style elements in the current style.

MAXPOINTS= n
specifies the maximum number of predicted points for the regression curve and for any confidence limits.
Default:10
NAME= “text-string
specifies a name for the plot. You can use the name to refer to this plot in other statements.
Note:The name is case-sensitive. When you refer to the specified name in other statements, you must use the same exact capitalization.
NOLEGCLI
hides the legend entry for the individual predicted value confidence limits.
NOLEGCLM
hides the legend entry for the mean value confidence limits.
NOLEGFIT
hides the legend entry for the fit line.
NOMARKERS
removes the scatter markers from the plot.
WEIGHT= numeric-variable
specifies how observations are weighted. Each observation is weighted by a factor of w for computational purposes, where w is the value of the numeric variable. w can be any numeric value. If w is 0, negative or missing, then that observation is excluded from the analysis.