SAS Institute. The Power to Know

SAS/GRAPH(R) 9.2: Statistical Graphics Procedures Guide

space
Previous Page | Next Page

The SGPLOT Procedure

VBAR Statement


Creates a vertical bar chart that summarizes the values of a category variable.
Interaction: The VBAR statement can be combined only with other categorization plot statements in the SGPLOT procedure. See Plot Content.
Featured in: Creating a Bar-Line Chart


Syntax

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

option(s) can be one or options from the following categories:

  • Bar options:

    ALPHA= numeric-value

    BARWIDTH= numeric-value

    FILL | NOFILL

    FILLATTRS= style-element < (fill-options) >| (fill-options)

    FREQ= numeric-variable

    LIMITS= BOTH | LOWER | UPPER

    LIMITSTAT= CLM | STDDEV | STDERR

    MISSING

    NUMSTD= n

    OUTLINE | NOOUTLINE

    RESPONSE= response-variable

    STAT= FREQ | MEAN | SUM

    URL= character-variable

    WEIGHT= numeric-variable

  • Plot options:

    GROUP= variable

    LEGENDLABEL= "text-string"

    NAME= "text-string"

    TRANSPARENCY= numeric-value


Required Arguments

category-variable

specifies the variable that classifies the observations into distinct subsets.


Options

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 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.

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 between .1 and 1.

For example, if you specify a width of 1, then there is no distance 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
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
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. For more information about specifying colors, see SAS/GRAPH Colors and Images in the SAS/GRAPH Software: Reference, Volumes 1 and 2.

Note:   This option has no effect if you specify the NOFILL option.  [cautionend]

Default: For ungrouped data, the default color is specified by the Color attribute of the GraphDataDefault style element in the current style.

For ungrouped data, the default color is specified by the Color attribute of the GraphData1... GraphDatan style elements in the current style.

FREQ= numeric-variable

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. The plot elements for each group value are automatically distinguished by different visual attributes.

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.
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.

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 only, then the default value for the LIMITS= option is BOTH.

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

MISSING

processes missing values as a 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.

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
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 vertical axis.

STAT= FREQ | MEAN | SUM

specifies the statistic for the vertical 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.

If you do not specify the RESPONSE= option, then only FREQ can be used. If you specify RESPONSE=, then you can use either SUM or MEAN.

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

adds HTML links to each bar in the plot. Specify the name of a variable that contains URLs.

For each unique category value, the first URL value is used for all instances of the category value. When you use the GROUP= option, the first URL value for each category value and group value combination is used.

WEIGHT= numeric-variable

specifies that 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.

space
Previous Page | Next Page | Top of Page