SGPLOT Procedure

LINEPARM Statement

Creates a straight line specified by a point and a slope. You can generate a single line by specifying a constant for each required argument. You can generate multiple lines by specifying a numeric variable for any or all required arguments.
Requirement: The statement must be used with another plot statement that is derived from data values that provide boundaries for the axis area. For example, the LINEPARM statement can be used with a scatter plot or a histogram.
About Parameterized Lines

Syntax

LINEPARM X= numeric-value |numeric-variable
Y= numeric-value |numeric-variable
SLOPE= numeric-value |numeric-variable
</option(s)>;

Summary of Optional Arguments

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
adds a label for the line.
specifies the appearance of the labels in the plot when you use the CURVELABEL= option.
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.
Line options
specifies that the data for the line is ignored when determining the data ranges for the axes.
specifies the appearance of the line.
prevents the line from being extended beyond the axis offset.
Plot options
specifies the value of the ID variable in an attribute map data set.
specifies a label that identifies the plot in the legend.
specifies a name for the plot.
specifies the degree of transparency for the lines.
assigns the X variable to the secondary (top) horizontal axis.
assigns the Y variable to the secondary (right) vertical axis.

Required Arguments

X= numeric-value | numeric-variable
specifies the X coordinate of a point.
Notes:Values are in the units of the data.

If the value specified for the X= option is outside of the data range, then the data range is extended to include the specified point. This behavior can be changed with the CLIP= option.

If you specify a variable, and the variable contains any missing values, no line is drawn for the respective observation.

Y= numeric-value | numeric-variable
specifies the Y coordinate of a point.
Notes:Values are in the units of the data.

If the value specified for the Y= option is outside of the data range, then the data range is extended to include the specified point. This behavior can be changed with the CLIP= option.

If you specify a variable, and the variable contains any missing values, no line is drawn for the respective observation.

SLOPE= numeric-value | numeric-variable
specifies the slope of the line. The slope can be positive or negative.
Tips:SLOPE= 0 creates a horizontal line (parallel to the X axis).

SLOPE= . (missing value) creates a vertical line (parallel to the Y axis).

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.
CLIP
specifies that the data for the line is ignored when determining the data ranges for the axes. Each axis scale is determined by the other plots in the overlay. This might result in the line not being displayed if its data range is not within the data ranges of the other plots.
CURVELABEL <=“text-string”>
adds a label for the line. You can also specify the label text. If you do not specify a label, then SLOPE=value is used. If you specify a GROUP variable, the group value is shown instead of the slope.
CURVELABELATTRS= style-element <(options)> | (options)
specifies the appearance of the labels in the plot when you use the CURVELABEL= option. 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 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 the CURVELABEL option 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
Interactions:This option is used in conjunction with the CURVELABELPOS= option to determine where the labels appear.

This option has no effect unless CURVELABEL is also specified.

CURVELABELPOS= AUTO | MIN | MAX
specifies the location of the curve label. Specify one of the following values:
AUTO
determines the best label position automatically. The line label is positioned near the line boundary along unused axes whenever possible (typically Y2 and X2).
Interaction:This value is available only when CURVELABELLOC=OUTSIDE. If CURVELABELLOC=INSIDE, you must specify either MIN or MAX.
MIN
places the curve label at the minimum value for the X axis.
MAX
places the curve label at the maximum value for the X axis.
Default:AUTO when CURVELABELLOC=OUTSIDE

MAX when CURVELABELLOC=INSIDE

Interaction:This option has no effect unless CURVELABEL is also specified.
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.
LEGENDLABEL= “text-string
specifies a label that identifies the plot in the legend. By default, the label “LineParm” is used (if you specify a numeric value for Y) or the Y variable name is used (if you specify a variable for Y).
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 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.
Here is an example that specifies a style element: LINEATTRS=GraphData3
For more information about style elements, see Style Elements for Use with ODS Graphics.
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 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.
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 GraphDataDefault 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.
Here is an example expression:
LINEATTRS=(Color= "light green" Pattern= MediumDash Thickness= 4)
Default: GraphDataDefault is the default style element.
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
prevents the line from being extended beyond the axis offset. When specified, there might be a gap between the line and the axis. The gap is controlled by the axis offset. If the offset is set to 0, then there is no gap.
NOMISSINGGROUP
specifies that missing values of the group variable are not included in the plot.
Interaction:This option has no effect unless GROUP= is also specified.
TRANSPARENCY= numeric-value
specifies the degree of transparency for the lines. Specify a value from 0.0 (completely opaque) to 1.0 (completely transparent).
Default:0.0
X2AXIS
assigns the X variable to the secondary (top) horizontal axis.
Y2AXIS
assigns the Y variable to the secondary (right) vertical axis.