SGPLOT Procedure

PBSPLINE Statement

Creates a fitted penalized B-spline curve.
About Penalized B-Spline Plots

Syntax

PBSPLINE x= numeric-variable y= numeric-variable </ options>;

Summary of Optional Arguments

Label options
adds a label for the curve.
specifies whether the curve label is placed inside the plot axes (INSIDE) or outside of the plot axes (OUTSIDE).
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.
PBSPLINE options
specifies the degree of the spline transformation.
specifies the appearance of the fitted curve.
specifies the appearance of the markers in the plot.
specifies the maximum number of predicted points for the spline curve and for any confidence limits.
specifies the number of evenly spaced internal knots.
hides the legend entry for the individual value prediction 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.
specifies a smoothing parameter value.
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 variable that is used to group the data.
specifies a label that identifies the B-spline curve in the legend.
specifies a name for the plot.
specifies how observations are weighted.
assigns the X variable to the secondary (top) horizontal axis.
assigns the Y variable to the secondary (right) vertical axis.

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.
CURVELABELLOC= OUTSIDE | INSIDE
specifies whether the curve label is placed inside the plot axes (INSIDE) or outside of the plot axes (OUTSIDE).
Default:INSIDE
CURVELABELPOS= AUTO | END | MAX | MIN | START
specifies the location of the curve label. Specify one of the following values:
AUTO
places the curve label outside the plot area near the end of the curve along unused axes whenever possible (typically Y2 or X2).
Interaction:This value takes effect only when CURVELABELLOC=OUTSIDE.
END
places the curve label at the last point on the curve.
MAX
places the label at the part of the curve closest to the maximum X axis value.
MIN
places the label at the part of the curve closest to the minimum X axis value.
START
places the curve label at the first point on the curve.
Default:END
Interactions:This option has no effect unless the CURVELABEL option is also specified.

The START and END suboptions take effect only when CURVELABELLOC=INSIDE.

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 spline transformation.
Default:3
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 variable that is used to group the data. A separate plot is created for each unique value of the grouping variable. The plot elements for each group value are automatically distinguished by different visual attributes.
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 B-spline curve in the legend. By default, the label “Penalized B-Spline” is used with the SMOOTH= value if specified, or else the group value for each B-spline is used.
LINEATTRS= style-element <(options)> | (options)
specifies the appearance of the fitted curve. 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 spline curve and for any confidence limits.
Default:201
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.
NKNOTS= n
specifies the number of evenly spaced internal knots.
Default:100
Range:1 to 1000
NOLEGCLI
hides the legend entry for the individual value prediction 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.
SMOOTH= numeric-value
specifies a smoothing parameter value. If you do not specify this option, a smoothing value is determined automatically.
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.
X2AXIS
assigns the X variable to the secondary (top) horizontal axis.
Y2AXIS
assigns the Y variable to the secondary (right) vertical axis.

Details

For the SMOOTH= option, the smoothing parameter value must be greater than the minimum value that is determined by the following equation.