SGPLOT Procedure

BAND Statement

Creates a band that highlights part of the plot.
Restriction: The axis that the UPPER and LOWER values are placed on cannot be a discrete axis. For example, if you specify a variable for Y, the plot cannot use a discrete horizontal axis.
Note: The input data should be sorted by the X or Y variable. If the data is not sorted, the graph might produce unpredictable results.
About Band Plots

Creating Lines and Bands from Pre-Computed Data

Syntax

BAND X= variable | Y= variable
UPPER= numeric-value | numeric-variable LOWER= numeric-value | numeric-variable
</option(s)>;

Summary of Optional Arguments

Band options
specifies an amount to offset all bands from discrete X or Y tick values.
specifies whether the area fill is visible.
specifies the appearance of the area fill for the band.
specifies the appearance of the outlines for the band.
specifies a plot that is used as a model for the interpolation for the band.
specifies that the band does not extend beyond the first and last data points in the plot.
specifies whether the outlines of the band are visible.
specifies how the data points for the lower and upper band boundaries are connected.
Group options
specifies a variable that is used to group the data.
specifies that missing values of the group variable are not included in the plot.
Label options
specifies the appearance of the labels in the plot when you specify a curve label.
specifies whether the curve label is placed inside the plot axes (INSIDE) or outside of the plot axes (OUTSIDE).
adds a label to the lower edge of the band.
specifies the location of the curve label.
adds a label to the upper edge of the band.
Plot options
specifies the value of the ID variable in an attribute map data set.
specifies a label that identifies the elements from the band plot in the legend.
specifies a name for the plot.
specifies the degree of transparency for the plot.
assigns the variable that is assigned to the primary (bottom) horizontal axis to the secondary (top) horizontal axis.
assigns the variable that is assigned to the primary (left) vertical axis to the secondary (right) vertical axis.

Required Arguments

X= variable | Y=variable
specifies a variable that is used to plot the band along the x or y axis.
LOWER= numeric-value | numeric-variable
specifies the lower value for the band. You can specify either a constant numeric value or a numeric variable.
UPPER= numeric-value | numeric-variable
specifies the upper value for the band. You can specify either a constant numeric value or a numeric variable.

Optional Arguments

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.
CURVELABELATTRS= style-element <(options)> | (options)
specifies the appearance of the labels in the plot when you specify a curve label. 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.
Here is an example that specifies a style element: CURVELABELATTRS=GraphTitleText
options can be one or more of the following:
COLOR= color
specifies the color of the line label characters. 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 Color attribute of the GraphValueText 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.
FAMILY= “font-family
specifies the font family for the label characters. The SAS ODS styles use TrueType system fonts. For more information, see TrueType Fonts Supplied by SAS in SAS Language Reference: Concepts.
Default:The default font family is specified by the FontFamily attribute of the GraphValueText style element in the current style.
Restriction:You cannot specify a list of font family names.
SIZE= n <units>
specifies the font size of the label characters. 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 font size is specified by the FontSize attribute of the GraphValueText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the label characters are italic or normal.
Default:The default font style is specified by the FontStyle attribute of the GraphValueText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the label characters are bold or normal.
Default:The default font weight is specified by the FontWeight attribute of the GraphValueText style element in the current style.
Here is an example expression:
CURVELABELATTRS=(Color=Green Family=Arial Size=8 Style=Italic Weight=Bold)
Default:The default style element is GraphValueText.
Interaction:This option has no effect unless CURVELABELLOWER or CURVELABELUPPER is also specified.
CURVELABELLOC= OUTSIDE | INSIDE
specifies whether the curve label is placed inside the plot axes (INSIDE) or outside of the plot axes (OUTSIDE).
Default:INSIDE
CURVELABELLOWER = “text-string
adds a label to the lower edge of the band. Specify the label text.
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.

CURVELABELUPPER = “text-string
adds a label to the upper edge of the band. Specify the label text.
DISCRETEOFFSET= numeric-value
specifies an amount to offset all bands from discrete X or Y tick values. Specify a value from -0.5 (left offset) to +0.5 (right offset).
Default:0.0 (no offset)
Requirement:This option is applicable only when the X or Y axis is discrete.
FILL | NOFILL
specifies whether the area fill is visible. The FILL option shows the area fill. The NOFILL option hides the area fill.
Default:The default status of the area fill is specified by the DisplayOpts attribute of the GraphBand style element in the current style.
Interactions:Specifying FILL also hides any visible outlines.

If NOFILL and NOOUTLINE are both specified, then both options are ignored.

FILLATTRS= style-element | (COLOR= color)
specifies the appearance of the area fill for the band. 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.
Default:For ungrouped data, the default color is specified by the Color attribute of the GraphDataConfidence style element in the current style. For grouped data, the default color is specified by the Color attribute of the GraphData1... GraphDatan style elements in the current style.
Interaction:This option has no effect if you specify the NOFILL option.
GROUP= variable
specifies a variable that is used to group the data. A separate band is created for each unique value of the grouping variable. The plot elements for each group value are automatically distinguished by different visual attributes.
LEGENDLABEL= “text-string
specifies a label that identifies the elements from the band plot in the legend. By default, the label “band“ is used for ungrouped data, and the group values are used for grouped data.
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 outlines for the band. 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 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 GraphDataDefault 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 option has no effect unless you also specify the OUTLINES option.
MODELNAME= “plot-name
specifies a plot that is used as a model for the interpolation for the band. If you do not specify the MODELNAME= option, then the band is interpolated in the same way as a series plot.
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.
NOEXTEND
specifies that the band does not extend beyond the first and last data points in the plot. By default, the band extends to the edges of the plot area.
Interaction:This option has no effect if you do not specify numeric values for the UPPER= and LOWER= options.
NOMISSINGGROUP
specifies that missing values of the group variable are not included in the plot.
OUTLINE | NOOUTLINE
specifies whether the outlines of the band are visible. The OUTLINE option shows the outlines. The NOOUTLINE option hides the outlines.
Default:The default status of the band outlines is specified by the DisplayOpts attribute of the GraphBand.
Interactions:Specifying OUTLINE also hides the fill color.

If NOOUTLINE and NOFILL are both specified, then both options are ignored.

TRANSPARENCY= value
specifies the degree of transparency for the plot. Specify a value from 0.0 (completely opaque) to 1.0 (completely transparent).
Default:0.0
TYPE= SERIES | STEP
specifies how the data points for the lower and upper band boundaries are connected. You can specify one of the following:
SERIES
the data points are connected directly using line segments, as in a series plot.
STEP
the data points are connected using a step function, as in a step plot.
Default:SERIES
X2AXIS
assigns the variable that is assigned to the primary (bottom) horizontal axis to the secondary (top) horizontal axis.
Y2AXIS
assigns the variable that is assigned to the primary (left) vertical axis to the secondary (right) vertical axis.

Details

The MODELNAME= option fits a band to another plot. This is particularly useful for plots that use a special interpolation such as step plots.
The following code fragment fits a band to a step plot:
band x=t upper=ucl lower=lcl / modelname="myname" transparency=.5;
step x=t y=survival / name="myname";
Fitted Band Plot Example
Fitted Band Plot