SGPANEL Procedure

HBAR Statement

Creates a bar chart that summarizes the values of a category variable.
Interaction: The HBAR statement can be combined only with other categorization plot statements in the SGPANEL procedure. See Plot Type Compatibility.
About Bar Charts

Creating a Panel of Bar Charts

Syntax

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

Summary of Optional Arguments

Bar options
specifies the width of the bars as a ratio of the maximum possible width.
specifies a special effect to be used on all filled bars.
specifies an amount to offset all bars from the category midpoints.
specifies whether the bars are filled.
specifies the appearance of the fill for the bars.
specifies the appearance of the limit lines in the plot.
specifies which limit lines to display.
specifies the statistic for the limit lines.
processes missing values as valid category value and creates a bar for it.
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 whether the bars have outlines.
specifies a numeric response variable for the plot.
specifies the statistic for the horizontal axis.
Group options
specifies the cluster width as a ratio of the maximum width.
specifies a variable that is used to group the data.
specifies how to display grouped bars.
specifies the ordering of bars within a group.
Label options
displays a label for each data point.
specifies the appearance of the labels in the plot when you use the DATALABEL= option.
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 bar chart in the legend.
specifies a name for the plot.
specifies the degree of transparency for the bars and limits, if displayed.
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.

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.
BARWIDTH= numeric-value
specifies the width of the bars as a ratio of the maximum possible width. The maximum width is equal to the distance between the center of each bar and the centers of the adjacent bars. Specify a value from 0.0 (narrowest) to 1.0 (widest).
For example, if you specify a width of 1, then there is no space between the bars. If you specify a width of .5, then the width of the bars is equal to the space between the bars.
Default:.8

1.0 when the GROUP option is specified and GROUPDISPLAY=CLUSTER

Interaction:When the GROUP option is specified, the bar width is determined by the maximum number of bars in any one group cluster. All bars are drawn with the same width, with the cluster being positioned symmetrically around the midpoint.
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.
Restriction: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.
Requirement:This option requires that you configure the panel to use either one column or one row, depending on the orientation of your charts. Use the ROWS= or the COLUMNS= option in the PANELBY statement. If you do not use this option and your graph contains multiple cells, the specified sort order is not correctly applied to all cells.
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 cluster width as a ratio of the maximum width. Specify a value from 0.0 (narrowest) to 1.0 (widest).
CLUSTERWIDTH is the fraction of the midpoint spacing used by all bars that are clustered around a midpoint (category value). The bar width is applied to the maximum bar spacing divided by the maximum number of bars in any one cluster.
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.
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.
DATASKIN= NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
specifies a special effect to be used on all filled bars. Specify one of the following (the samples were generated using the HTMLBlue style):
NONE
Dataskin NONE
CRISP
Dataskin CRISP
GLOSS
Dataskin GLOSS
MATTE
Dataskin MATTE
PRESSED
Dataskin PRESSED
SHEEN
Dataskin SHEEN
Default:NONE
Interactions:This option has no effect if the applied style uses a fill pattern and FILL is disabled for the style. If the style has both FILL and FILLPATTERN enabled, data skins will work. For more information about fill patterns, see Using Fill Patterns to Distinguish Grouped Bar Charts. For instructions about viewing the contents of style templates, see About Styles and Style Elements.

This option has no effect if you also specify NOFILL.

DISCRETEOFFSET= numeric-value
specifies an amount to offset all bars from the category midpoints. Specify a value from -0.5 (left offset) to +0.5 (right offset).
Default:0.0 (no offset)
FILL | NOFILL
specifies whether the bars are filled. The FILL option shows the fill color for the bars. The NOFILL option hides the fill color for the bars.
Default:FILL
Interactions:Specifying FILL also hides the outlines.

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

FILLATTRS= style-element | (COLOR= color)
specifies the appearance of the fill for the bars. 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 GraphDataDefault 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.
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.
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. The plot elements for each group value are automatically distinguished by different visual attributes.
GROUPDISPLAY= STACK | CLUSTER
specifies how to display grouped bars.
STACK
groups are overlaid without any clustering. Each group is represented by unique visual attributes derived from the GraphData1... GraphDatan style elements in the current style.
CLUSTER
displays group values as separate adjacent bars that replace the single category bar. Each set of group values is centered at the midpoint tick mark for the category.
Default:STACK
Interaction:This option is ignored unless GROUP= is specified.
GROUPORDER= ASCENDING | DESCENDING | DATA
specifies the ordering of bars 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 bar chart in the legend. By default, the label of the RESPONSE= variable is used. If there is no response variable label, the name of the response variable and the computed statistic (SUM or MEAN) is used. If the RESPONSE= option is not used, 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.
Interaction:This option has no effect unless you also specify either the LIMITS= or LIMITSTAT= option.
LIMITS= BOTH | LOWER | UPPER
specifies which limit lines to display. Limits are displayed as heavier line segments with a serif at the end extending from each bar. Upper limits extend to the right of the bar and lower limits extend to the left of the bar. By default, no limits are displayed unless you specify either the LIMITS= or LIMITSTAT= option. If you specify the LIMITSTAT= option only, then LIMITS=BOTH is the default. 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.
Default:By default, no limit lines are displayed. However, if you specify the LIMITSTAT= option, then the default is BOTH.
Interactions:Limit lines are displayed only when you specify STAT= MEAN.

The LIMITS= option has no effect if you also specify the GROUP= option in the plot statement.

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
Interactions:If you specify the LIMITSTAT= option only, then the default value for the LIMITS= option is BOTH.

Limits lines are displayed only when you specify STAT=MEAN.

The LIMITSTAT= option has no effect if you also specify the GROUP= option in the plot statement.

MISSING
processes missing values as valid category value and creates a bar 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
OUTLINE | NOOUTLINE
specifies whether the bars have outlines. The OUTLINE option shows the outlines. The NOOUTLINE option hides the outlines.
Default:OUTLINE
Interactions:Specifying OUTLINE also hides the fill color.

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

RESPONSE= response-variable
specifies a numeric response variable for the plot. The summarized values of the response variable are displayed 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. This is the default value when you do not specify the RESPONSE= option.
MEAN
the mean of the response variable.
SUM
the sum of the response variable. This is the default value when you specify the RESPONSE= option.
Interaction:If you do not specify the RESPONSE= option, then only the FREQ statistic can be used. If you specify the RESPONSE= option, then you can use either the SUM or MEAN statistics.
TRANSPARENCY= numeric-value
specifies the degree of transparency for the bars and limits, if displayed. 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.