SGPLOT Procedure

HLINE Statement

Creates a horizontal line chart. You can use the HLINE statement with the HBAR statement to create a horizontal bar-line chart.
Interaction: The HLINE statement can be combined only with other categorization plot statements in the SGPLOT procedure. See Plot Type Compatibility.
About Line Charts

Syntax

HLINE category-variable < / option(s)>;

Summary of Optional Arguments

Group options
specifies the width of the group clusters as a fraction of the midpoint spacing.
specifies a variable that is used to group the data.
specifies how to display grouped lines.
specifies the ordering of lines within a group.
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.
displays a label for each data point.
specifies the appearance of the labels in the plot when you use the DATALABEL= option.
Line options
creates a break in the line for each missing value of the response variable.
specifies an amount to offset all lines from the discrete category values.
specifies the appearance of the limit lines in the plot.
adds limit lines to the plot.
specifies the statistic for the limit lines.
specifies the appearance of the lines in the line plot.
specifies the appearance of the markers in the plot.
adds markers to the plot.
removes the statistic name from the axis and legend labels.
specifies the number of standard units for the limit lines, when you specify LIMITSTAT= STDDEV or LIMITSTAT= STDERR.
specifies a numeric response variable for the plot.
specifies the statistic for the horizontal axis.
Plot options
specifies the confidence level for the confidence limits.
specifies the value of the ID variable in an attribute map data set.
specifies the order in which the response values are arranged.
specifies how many times observations are repeated for computational purposes.
specifies the label that identifies the line plot in the legend.
processes missing values as a valid category value and creates a line for it.
specifies a name for the plot.
specifies the degree of transparency for the lines and markers.
specifies a character variable that contains URLs for Web pages to be displayed when parts of the plot are selected within an HTML page.
specifies how observations are weighted.
assigns the response variable to the secondary (top) horizontal axis.
assigns the category variable to the secondary (right) vertical axis.

Required Argument

category-variable
specifies the variable that classifies the observations into distinct subsets.

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
Interactions:This option has no effect if you do not specify LIMITSTAT=CLM.

If your plot is overlaid with other categorization plots, then the first ALPHA value that you specify is used for all of the plots.

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.
BREAK
creates a break in the line for each missing value of the response variable.
Notes:The observation is excluded from the graph when there is a missing value for the category variable without the specification of the MISSING option. (No break occurs in the line.)

The observation is excluded from the graph when there is a missing value for the FREQ variable.

CATEGORYORDER= RESPASC | RESPDESC
specifies the order in which the response values are arranged. Specify one of the following values:
RESPASC
sorts the response values in ascending order.
RESPDESC
sorts the response values in descending order.
Default:By default, the plot is sorted in ascending order based on the category values.
Restrictions:This option takes effect only when the plot statement specifies a response variable and the axis for that variable is numeric. If the axis is not numeric, an error is generated and a message is written to the SAS log.

Uniform scaling and response sorting cannot occur on the same axis. If the UNIFORM= option is used in the SGPLOT statement, the UNIFORM option is ignored for the sorted response axis and a note is generated in the log. The UNIFORM= option is applied to the other axes and groups if requested. Note that the UNIFORM= option can selectively apply scaling to only the X or Y axis

Interaction:If a group variable is specified in the plot statement, the response sort option is ignored and a note is generated in the log. (You can use a BY statement in the procedure if you want to group data.)
Note:If CATEGORYORDER is specified in multiple statements, the procedure sorts by the last statement in which it is specified.
CLUSTERWIDTH= numeric-value
specifies the width of the group clusters as a fraction of the midpoint spacing. Specify a value from 0.0 (narrowest) to 1.0 (widest).
Default:0.8
Interaction:This option is applicable only when the GROUP option is specified, when GROUPDISPLAY=CLUSTER, and when the category axis is discrete.
CURVELABEL <=“text-string”>
adds a label for the line. You can also specify the label text. If you do not specify a label, then the label from the response variable is used.
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
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 calculated response are used for the data labels.
DATALABELATTRS= style-element <(options)> | (options)
specifies the appearance of the labels in the plot when you use the DATALABEL= 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: DATALABELATTRS=GraphLabelText
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 GraphDataText 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 GraphDataText style element in the current style.
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 GraphDataText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the label characters are italic (ITALIC) or normal (NORMAL).
Default:The default font style is specified by the FontStyle attribute of the GraphDataText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the label characters are bold (BOLD) or normal (NORMAL).
Default:The default font weight is specified by the FontWeight attribute of the GraphDataText style element in the current style.
Here is an example expression:
DATALABELATTRS=(Color=Green Family=Arial Size=8 Style=Italic Weight=Bold)
Default:The default style element is GraphDataText.
Interaction:This option has no effect unless the DATALABEL option is also specified.
DISCRETEOFFSET= numeric-value
specifies an amount to offset all lines from the discrete category 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 category axis is discrete.
FREQ= numeric-variable
specifies how many times observations are repeated for computational purposes. specifies that 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.
Interaction:If your plot is overlaid with other categorization plots, then the first FREQ variable that you specified is used for all of the plots.
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 more than one categorization plot statement, then all of the plots must specify the same GROUP variable. If you do not specify the same GROUP= option for all of the categorization plots, then the GROUP= option has no effect.
GROUPDISPLAY= CLUSTER | OVERLAY
specifies how to display grouped lines.
CLUSTER
grouped items are drawn adjacent to each other.
OVERLAY
grouped items are drawn at the exact coordinate and might overlap. Each group is represented by unique visual attributes derived from the GraphData1... GraphDatan style elements in the current style.
Default:OVERLAY
Restriction:GROUPDISPLAY=CLUSTER can take effect only when the category axis is discrete. If necessary, use a TYPE=DISCRETE option on the axis statement.
Interaction:This option is ignored unless GROUP= is specified.
GROUPORDER= ASCENDING | DESCENDING | DATA
specifies the ordering of lines within a group.
ASCENDING
displays each group in ascending group value.
DESCENDING
displays each group in descending group value.
DATA
displays each group in data order of the group variable.
Interaction:This option is ignored unless GROUP= is specified.
LEGENDLABEL= “text-string
specifies the label that identifies the line plot in the legend. By default, the label of the response variable is used. If there is no response variable label, then the name of the response variable and the computed statistic (SUM or MEAN) are used. If you do not specify a response variable, then the legend label is “Frequency”.
Interaction:The LEGENDLABEL= option has no effect if you also specify the GROUP= option in the same plot statement.
LIMITATTRS= style-element <(options)> | (options)
specifies the appearance of the limit lines 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 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:The default color is specified by the ContrastColor attribute of the GraphError style element 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:The default line pattern is specified by the LineStyle attribute of the GraphError style element 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:The default line thickness is specified by the LineThickness attribute of the GraphError style element in the current style.
LIMITS= BOTH | LOWER | UPPER
adds limit lines to the plot. Specify one of the following values:
BOTH
adds lower and upper limit lines to the plot.
LOWER
adds lower limit lines to the plot.
UPPER
adds upper limit lines to the plot.
By default, no limit lines are displayed. However, if you specify the LIMITSTAT= option, then the default is BOTH.
Interaction:Limit lines are displayed only when you specify STAT= MEAN.
LIMITSTAT= CLM | STDDEV | STDERR
specifies the statistic for the limit lines. Specify one of the following statistics:
CLM
confidence limits
STDDEV
standard deviation
STDERR
standard error
Default:CLM
Interaction:If you specify the LIMITSTAT= option, then the default value for the LIMITS= option is BOTH.
LINEATTRS= style-element <(options)> | (options)
specifies the appearance of the lines in the line 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 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.
MARKERATTRS= style-element <(options)> | (options)
specifies the appearance of the markers in the plot. This option has no effect unless you also specify the MARKERS 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.
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.
MARKERS
adds markers to the plot.
MISSING
processes missing values as a valid category value and creates a line for it.
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.
NOSTATLABEL
removes the statistic name from the axis and legend labels.
NUMSTD= n
specifies the number of standard units for the limit lines, when you specify LIMITSTAT= STDDEV or LIMITSTAT= STDERR. You can specify any positive number, including decimals.
Default:1
RESPONSE= response-variable
specifies a numeric response variable for the plot. The summarized values of the response variable are displayed for each value on the horizontal axis.
STAT= FREQ | MEAN | SUM
specifies the statistic for the horizontal axis. Specify one of the following statistics:
FREQ
the frequencies for the category variable
MEAN
the mean of the response variable
SUM
the sum of the response variable
Default:If you do not specify the RESPONSE= option, then the FREQ statistic is the default. If you specify RESPONSE=, then the SUM statistic is the default.
TRANSPARENCY= numeric-value
specifies the degree of transparency for the lines and markers. Specify a value from 0.0 (completely opaque) to 1.0 (completely transparent).
Default:0.0
URL= character-variable
specifies a character variable that contains URLs for Web pages to be displayed when parts of the plot are selected within an HTML page.
Default:By default, no HTML links are created.
Interactions:This option affects graphics output that is created through the ODS HTML destination only. For more information about ODS destinations, see Specifying a Destination.

This option has no effect unless you also specify IMAGEMAP in the ODS GRAPHICS statement. For more information, see Using the ODS GRAPHICS Statement.

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.
Interaction:If your plot is overlaid with other categorization plots, then the first WEIGHT variable that you specified is used for all of the plots.
X2AXIS
assigns the response variable to the secondary (top) horizontal axis.
Y2AXIS
assigns the category variable to the secondary (right) vertical axis.