Create horizontal or vertical bar charts in which the length or
height of the bars represents the value of the chart statistic for each category
of data.
| Requirements: |
At least one chart variable is required.
|
| Global statements: |
AXIS, LEGEND, PATTERN, TITLE, FOOTNOTE
|
| Supports: |
Drill-down functionality
|
The
HBAR, HBAR3D,
VBAR, and VBAR3D statements specify the variable or variables that define
the categories of data to chart. These statements automatically
You can use statement options to select or order the
midpoints (bars), to control the tick marks on the response axis, to change
the type of chart statistic, to display specific statistics, and to modify
the appearance of the chart. You can also specify additional variables by
which to group, subgroup, or sum the data.
All bar charts allow grouping, which uses an additional
category to organize the bars into groups, and subgrouping, which divides
the bars into segments.
In addition, you can use global statements to modify
the axes (including requesting a logarithmic axis), the bar patterns, and
the legend, as well as add titles, footnotes, and notes to the chart. You
can also use an Annotate data set to enhance the chart.
|
HBAR | HBAR3D | VBAR | VBAR3D chart-variable(s) </
option(s); >
|
option(s) can be one or more options
from any or all of the following categories:
-
chart-variable(s)
-
specifies one or more variables that
define the categories of data to chart. Each chart variable draws a separate
chart. All variables must be in the input data set. Multiple chart variables
must be separated with blanks.
Options in an HBAR, HBAR3D, VBAR, or VBAR3D statement
affect all graphs that are produced by that statement. You can specify as
many options as you want and list them in any order. For details on specifying
colors, see SAS/GRAPH Colors.
For a complete description of the graphics options, see Graphics Options and Device Parameters Dictionary.
-
ANNOTATE=Annotate-data-set
ANNO=Annotate-data-set
-
specifies a data set to annotate
charts produced by the bar chart statement.
-
ASCENDING
-
arranges the bars in ascending order
of the value of the chart statistic. By default, bars are arranged in ascending
order of midpoint value, without regard to the lengths of the bars. ASCENDING
reorders the bars from shortest to longest. In horizontal bar charts the ordering
is top to bottom; in vertical bar charts the ordering is left to right.
If you also use the GROUP= option, the reordering is
performed separately for each group, so the order of the midpoints may be
different for each group.
ASCENDING overrides any midpoint order specified with
the MIDPOINTS= option or specified in the ORDER= option in an AXIS statement
assigned to the midpoint axis.
-
AUTOREF
-
draws a reference line at each major
tick mark on the response axis. To draw reference lines at specific points
on the response axis, use the REF= option.
By default, reference lines in 2D bar charts are drawn
in front of the bars. To draw reference lines behind the bars, use the CLIPREF
option.
By default, reference lines in 3D bar charts are drawn
on the back plane of the axis. To draw reference lines in front of the bars,
use the FRONTREF option.
-
AXIS=AXIS<1...99>
-
See the RAXIS=
option.
-
CAXIS=axis-color
-
specifies a color for the response
and midpoint axis lines and for the default axis area frame. If you omit the
CAXIS= option, PROC GCHART searches for a color specification in this order:
-
the COLOR= option in AXIS
definitions
-
the first color in the colors list (the
default).
-
CFRAME=background-color
CFR=background-color
-
specifies the color with which to
fill the axis area (in 2D bar charts) or the 3D back plane (in 3D bar charts).
The axis area color does not affect the frame color,
which is always the same as the midpoint axis line color and controlled by
the CAXIS= option. By default, the axis area in 2D bar charts is not filled.
CFRAME= is overridden by the NOFRAME option.
Note:
If the background
color, the bar color, and the outline
color are the same, you may not be able to distinguish the bars. ![[cautend]](../common/images/cautend.gif)
-
CERROR=error-bar-color
-
specifies the color of error bars
in bar charts. The default is the color of the response axis, which is controlled
by the CAXIS= option.
-
CFREQ
-
displays the cumulative frequency
statistic in the table of statistics. Default statistics are suppressed when
you request specific statistics but all requested statistics are displayed.
-
CFREQLABEL='column-label' (HBAR and HBAR3D only)
-
specifies the text of the column
label for the CFREQ statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can
be no more than 24 characters. By default, a label with more than one word
will break as close to the center of the line as possible. A double space
in the string forces a line break.
-
CLIPREF
-
clips the reference lines at the
bars. This makes the reference lines appear to be behind the bars. Because
CLIPREF is the default for 3D bar charts, it affects only 2D charts.
-
CLM=confidence-limit
-
draws error bars with the specified
confidence limit. Values for confidence-limit are 50 to 99, inclusive.
The default is 95. By default, CLM= draws the bars using the default ERRORBAR=BOTH.
To change the type of error bar, use the ERRORBAR= option.
-
COUTLINE=bar-outline-color
| SAME
-
outlines all bars or bar segments
and legend values in the subgroup legend (if it appears) using the specified
color. SAME specifies that the outline color of a bar or a bar segment or
a legend value is the same as the interior pattern color.
The default outline color depends on the PATTERN statement:
Note:
For 2D bar charts, if you specify
empty patterns, (VALUE=EMPTY in a PATTERN statement) you should not change
the outline color from the default value, SAME, to a single color. Otherwise
all the outlines will be one color and you will not be able to distinguish
between the empty areas. ![[cautend]](../common/images/cautend.gif)
COUTLINE= is not valid when SHAPE=CYLINDER.
-
CPERCENT
CPCT
-
displays the cumulative percentage
statistic in the table of statistics. Default statistics are suppressed when
you request specific statistics but all requested statistics are displayed.
-
CPERCENTLABEL='column-label' (HBAR and HBAR3D
only)
-
specifies the text of the column
label for the CPERCENT statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can
be no more than 24 characters. By default, a label with more than one word
will break as close to the center of the line as possible. A double space
in the string forces a line break.
-
CTEXT=text-color
-
specifies the color of all text on
the chart that is not otherwise assigned a color. Text includes axis values
and axis labels in the response, midpoint, and group axes; the subgroup legend;
and the displayed statistics. If you omit CTEXT=, PROC GCHART searches for
a color specification in this order:
-
the CTEXT= option in a GOPTIONS statement
-
the first color in the
colors list (the default).
CTEXT= overrides the color specification for the axis
label and the tick mark values in the COLOR= option in an AXIS definition
assigned to an axis.
CTEXT= is overridden by
-
DESCENDING
-
arranges the bars in descending order
of the value of the chart statistic. By default, bars are arranged in ascending
order of midpoint value, without regard to the lengths of the bars. DESCENDING
reorders the bars from longest to shortest. In horizontal bar charts the
ordering is top to bottom; in vertical bar charts the ordering is left to
right. If you also use the GROUP= option, the reordering is performed separately
for each group, so the order of the midpoints may be different for each group.
DESCENDING overrides any midpoint order that is specified
with the MIDPOINTS= option or that is specified in the ORDER= option in an
AXIS statement assigned to the midpoint axis.
-
DESCRIPTION='entry-description'
DES='entry-description'
-
specifies the description of the
catalog entry for the chart. The maximum length for entry-description is 40 characters. The description does not appear on the chart. By
default, the GCHART procedure assigns a description of the form HBAR CHART
OF variable, where variable is the name of the chart
variable.
-
DISCRETE
-
treats a numeric chart variable as
a discrete variable rather than as a continuous variable. The GCHART procedure
creates a separate midpoint and, hence, a separate bar for each unique value
of the chart variable. If the chart variable has a format associated with
it, each formatted value is treated as a midpoint.
The LEVELS= option is ignored when you use DISCRETE.
The MIDPOINTS= option overrides DISCRETE. The ORDER= option in an AXIS statement
that is assigned to the midpoint axis can rearrange or exclude discrete midpoint
values.
-
ERRORBAR=BARS | BOTH | TOP
-
draws error bars that represent the
standard error of the SUMVAR= variable for each midpoint on a horizontal or
vertical bar chart. Values for ERRORBAR= are
-
BARS
-
draws error bars as bars half the
width of the main bars.
-
BOTH
-
draws error bars as two ticks joined
by a line (default).
-
TOP
-
draws the error bar as a tick for
the upper confidence limit that is joined to the top of the bar by a line.
By default, ERRORBAR= uses confidence limits of 95 percent.
You can specify different confidence limits with the CLM= option.
When you use ERRORBAR=, the TYPE= option is normally
MEAN and the sum variable must have at least two non-missing values for each
midpoint. If the GROUP= option is used, each midpoint within a group must
also have two non-missing values.
-
FRAME | NOFRAME
FR |
NOFR
-
specifies whether the 2D axis area
frame or the 3D backplane is drawn. The default is FRAME, which draws a frame
around the axis area (in 2D bar charts) or generates a colored 3D backplane
(in 3D bar charts).
The color of the frame or of the backplane outline is
the color of the midpoint axis, which is determined by the CAXIS= option.
To fill the 2D axis area with a background color, or to specify a color for
the 3D backplane, use the CFRAME= option.
With 2D bar charts, NOFRAME removes the axis frame.
It overrides CFRAME= and also removes the colored fill it specifies.
With 3D bar charts, NOFRAME removes the colored backplane,
leaving the vertical and horizontal axis planes and axes. To remove these
planes, use the NOPLANE option in the AXIS statement. To remove one or more
axis elements, use either the AXIS statement or the NOAXIS option.
If the V6COMP graphics option is in effect, the default
is NOFRAME.
-
FREQ
-
displays the frequency statistic
in the table of statistics. Default statistics are suppressed when you request
specific statistics but all requested statistics are displayed.
-
FREQLABEL='column-label'
(HBAR and HBAR3D only)
-
specifies the text of the column
label for the FREQ statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can
be no more than 24 characters. By default, a label with more than one word
will break as close to the center of the line as possible. A double space
in the string forces a line break.
-
FREQ=numeric-variable
-
specifies a variable whose values
weight the contribution of each observation in the computation of the chart
statistic. Each observation is counted the number of times that is specified
by the value of numeric-variable for that observation. If the
value of numeric-variable is missing, 0, or negative, the observation
is not used in the statistic calculation. Noninteger values of numeric-variable are truncated to integers. FREQ= is valid with all chart statistics.
Because
you cannot use TYPE=PERCENT, TYPE=CPERCENT,
TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use FREQ= to calculate
percentages, cumulative percentages, frequencies, or cumulative frequencies
based on a sum.
-
FRONTREF
-
specifies that reference lines drawn
by the AUTOREF or REF= options should be drawn in front of the bars. By default,
reference lines in 3D bar charts are drawn on the back plane of the axis.
Because FRONTREF is the default for 2D bar charts, it affects only 3D charts.
-
G100
-
calculates the percentage and cumulative
percentage statistics separately for each group. When you use G100, the individual
percentages reflect the contribution of the midpoint to the group and total
100 percent for each group. G100 is ignored unless you also use the GROUP=
option.
By default, the individual percentages reflect the contribution
of the midpoint to the entire chart and total 100 percent for the entire chart.
-
GAXIS=AXIS<1...99>
-
assigns the specified AXIS definition
to the group axis. (A group axis is created when you use the GROUP= option.)
You can use the AXIS definition to modify the order of the groups, the text
of the labels, and appearance of the axis. GAXIS= is ignored if the specified
AXIS definition does not exist.
The AXIS statement options MAJOR= and MINOR= are ignored
in AXIS definitions assigned to the group axis because the axis does not use
tick marks. A warning message is written to the SAS log if these options
appear in the AXIS definition.
To remove groups from the chart, use the ORDER= option
in the AXIS statement.
To suppress the brackets drawn around the values on
the group axis in vertical bar charts, use the NOBRACKETS option in the AXIS
statement.
-
GROUP=group-variable
-
organizes the data according to values
of group-variable. Group-variable can be either
character or numeric and is always treated as a discrete variable.
GROUP= produces a separate group of bars for each unique
value of the group variable. Missing values for group-variable
are treated as a valid group. The groups are arranged in ascending order of
the group variable values.
By default, each group includes all midpoints, even
if no observations for the group fall within the midpoint range, meaning that
no bar is drawn at the midpoint. Use the NOZERO option to suppress midpoints
with no observations.
GROUP= also produces a group axis that
lists the values that distinguish the groups. The group axis has no axis
line but displays the group variable name or label. To modify the group axis,
assign an AXIS definition with the GAXIS= option.
In horizontal bar charts, the group axis is to the left
of the midpoint axis and the groups are arranged from top to bottom, starting
with the lowest value at the top.
In vertical bar charts, the group axis is below the
midpoint axis and the groups are arranged from left to right starting with
the lowest value at the left. If the group label in a vertical bar chart is
narrower than all the bars in the group, brackets are added to the label to
emphasize which bars belong in each group. Group brackets are not displayed
if the space between the group values is less than one and one-half character
cells. Use the NOBRACKETS option in the AXIS statement to suppress the group
brackets.
-
GSPACE=group-spacing
-
specifies the amount of extra space
between groups of bars. Group-space can be any non-negative number.
Units are character cells. Use GSPACE=0 to leave no extra space between adjacent
groups of bars. In this case, the same space appears between groups of bars
as between the bars in the same group.
GSPACE= is ignored unless you also use the GROUP= option.
By default, the GCHART procedure calculates group spacing based on size of
the axis area and the number of bars in the chart.
If the requested spacing results in a chart that is
too large to fit in the space available for the midpoint axis, an error message
is written to the SAS log and no chart is produced.
-
HTML=variable
-
identifies the variable in the input
data set whose values create links in the HTML file created by the ODS HTML
statement. These links are associated with an area of the chart and point
to the data or graph you wish to display when the user drills down on the
area.
-
HTML_LEGEND=variable
-
identifies the variable in the input
data set whose values create links in the HTML file created by the ODS HTML
statement. These links are associated with a legend value and point to the
data or graph you wish to display when the user drills down on the value.
-
INSIDE=statistic (VBAR and
VBAR3D only)
-
displays the values of the specified
statistic inside the bars of a vertical bar chart. Statistic
can be one of the following:
If the bars are subgrouped, only the following statistics
are valid:
With subgroups, PERCENT displays the percent
contribution
of each subgroup to the midpoint value of the bar, based on frequency. The
PERCENT values for each subgroup total the percent contribution of the bar
to the whole. For example, if the percent contribution of the whole bar is
60%, the PERCENT statistic for all the subgroups in that bar will total 60%.
To calculate PERCENT based on the SUMVAR= variable, use the FREQ= and TYPE=
options. For details, see Calculating Weighted Statistics.
SUBPCT displays the percent contribution of each subgroup
to the total bar. The SUBPCT values for each subgroup total the percent contribution
to the whole bar. Because of rounding, the total of the percents may not equal
100.
Only one type of statistic can be printed inside the
bars, but you can specify a second statistic with OUTSIDE=.
-
LEGEND=LEGEND<1...99>
-
assigns the specified LEGEND definition
to the legend generated by the SUBGROUP= option. The LEGEND= option itself
does not generate a legend.
LEGEND= is ignored if
To create a legend based on the chart midpoints instead
of the subgroups, use the chart variable as the subgroup variable:
hbar city / subgroup=city;
-
LEVELS=number-of-midpoints
-
specifies the number of midpoints
for a numeric chart variable. The range for each midpoint is calculated automatically,
using the algorithm in Terrell and Scott (1985). LEVELS= is ignored if
-
MAXIS=AXIS<1...99>
-
assigns the specified AXIS definition
to the midpoint axis. The MAXIS= option is ignored if the specified AXIS
definition does not exist.
-
MEAN
-
displays the mean statistic in the
table of statistics. Default statistics are suppressed when you request specific
statistics, but all requested statistics are displayed. By default, the column
heading includes the name of the variable for which the mean is calculated.
MEAN is ignored unless you also use the SUMVAR= option.
-
MEANLABEL='column-label' (HBAR and HBAR3D
only)
-
specifies the text of the column
label for the MEAN statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can
be no more than 24 characters. By default, a label with more than one word
will break as close to the center of the line as possible. A double space
in the string forces a line break.
-
MIDPOINTS=value-list
-
specifies the midpoint values for
the bars. The way you specify value-list depends on the type
of the chart variable.
-
For numeric chart variables, value-list is either an explicit list of values, or a starting and
an ending value with an interval increment, or a combination of both forms:
If a numeric variable has an associated format, the
specified values must be the unformatted values.
By default, numeric variable values are treated as continuous
(if you omit the DISCRETE option), and each value in value-list
specifies the median of a range of values. In this case, the GCHART procedure
calculates the midpoint values. If you include the DISCRETE option, each
value in value-list specifies a unique numeric value.
-
For character chart variables, value-list is a list of unique
character values enclosed in quotation
marks and separated by blanks:
If a character variable has an associated format, the
specified values must be the formatted values.
For a complete description of value-list,
see the ORDER= option in the AXIS statement.
If the value-list for either type of
variable
specifies so many midpoints that the axis values overwrite each other, the
values may be unreadable. In this case the procedure writes a warning to the
SAS log. On many devices, this problem can be corrected by either adjusting
the size of the text with the HTEXT= graphics option or by increasing the
number of cells in your graphics display using the HPOS= and VPOS= graphics
options.
The ORDER= option in the AXIS statement overrides the
order specified in the MIDPOINTS= option. The bar chart statement options
ASCENDING and DESCENDING also override both MIDPOINTS= and ORDER= in the AXIS
statement.
-
MIDPOINTS=OLD
-
tells the GCHART procedure to calculate
default midpoints using the algorithm used in Release 82.4 and Version 5 of SAS/GRAPH.
MIDPOINTS=OLD is ignored unless the chart variable is numeric type.
-
MINOR=number-of-minor-ticks
-
specifies the number of minor tick
marks between each major tick mark on the response axis.
MINOR= in a bar chart statement overrides the number
of minor tick marks specified in the MINOR= option in an AXIS definition assigned
to the response axis with the RAXIS= option.
-
MISSING
-
accepts a missing value as a valid
midpoint for the chart variable. By default, observations with missing values
are ignored. Missing values are always valid for group and subgroup variables.
-
NAME='entry-name'
-
specifies the name of the catalog
entry for the graph. The maximum length for entry-name is eight
characters. The default name is GCHART. If the name duplicates an existing
entry name, SAS/GRAPH software adds
a number to the duplicate name to create a unique name-- for example,
GCHART1.
-
NOAXIS
-
suppresses all axes, including axis
lines, axis labels, axis values, and all major and minor tick marks. NOAXIS
overrides the GAXIS=, MAXIS=, and RAXIS= options.
To remove selected axis elements such as lines, values
or labels, use specific AXIS statement options.
NOAXIS does not suppress either the default frame or
an axis area fill requested by the CFRAME= option. To remove the axis frame
or the 3D backplane, use the NOFRAME option in the procedure. To remove the
horizontal or vertical axis planes, use the NOPLANE option in the AXIS statement.
-
NOBASEREF
-
suppresses the zero reference line
when the SUM or MEAN chart statistic has negative values.
-
NOLEGEND
-
suppresses the legend that is automatically
generated by the SUBGROUP= option. NOLEGEND is ignored if the SUBGROUP= option
is not used.
-
NOSTATS (HBAR and HBAR3D only)
-
suppresses the table of statistics.
NOSTATS suppresses both the default statistics and specific statistics requested
by the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options.
-
NOZERO
-
suppresses any midpoints for which
there are no corresponding values of the chart variable and, hence, no bar.
NOZERO usually is used with the GROUP= option to suppress midpoints when
not all values of the chart variable are present for every group or if the
chart statistic for the bar is 0.
Note:
If a bar is
omitted and if you have also specified bar labels with the VALUE= option in
an AXIS statement, the labels may be shifted and not displayed with the correct
bar. ![[cautend]](../common/images/cautend.gif)
-
OUTSIDE=statistic (VBAR
and VBAR3D only)
-
displays the values of the specified
statistic above the bars of a vertical bar chart. Statistic can
be one of the following:
Only one type of statistic can be printed
outside the
bars, but you can specify a second statistic with INSIDE=.
-
PATTERNID=BY | GROUP | MIDPOINT |
SUBGROUP
-
specifies the way fill patterns are
assigned. By default, PATTERNID=SUBGROUP. Values for PATTERNID= are as follows:
-
BY
-
changes patterns each time the value
of the BY variable changes. All bars use the same pattern if the GCHART procedure
does not include a BY statement.
-
GROUP
-
changes patterns every time the value
of the group variable changes. All bars in each group use the same pattern,
but a different pattern is used for each group.
-
MIDPOINT
-
changes patterns every time the midpoint
value changes. If you use the GROUP= option, the respective midpoint patterns
are repeated for each group.
-
SUBGROUP
-
changes patterns every time the value
of the subgroup variable changes. The bars must be subdivided by the SUBGROUP=
option for the SUBGROUP value to have an effect. Without SUBGROUP=, all bars
have the same pattern.
Note:
If you use the SUBGROUP= option and specify a PATTERNID= value other than
SUBGROUP, the bar segments use the same pattern and are indistinguishable. ![[cautend]](../common/images/cautend.gif)
-
PERCENT
PCT
-
displays the percentage statistic
in the table of statistics. Default statistics are suppressed when you request
specific statistics but all requested statistics are displayed.
-
PERCENTLABEL='column-label' (HBAR and HBAR3D
only)
-
specifies the text of the column
label for the PERCENT statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can
be no more than 24 characters. By default, a label with more than one word
will break as close to the center of the line as possible. A double space
in the string forces a line break.
-
RAXIS=value-list | AXIS<1...99>
AXIS=value-list | AXIS<1...99>
-
specifies values for the major tick
mark divisions on the response axis or assigns the specified AXIS definition
to the axis. See the MIDPOINTS= option for a description of value-list. By
default, the GCHART procedure scales the response axis automatically and provides
an appropriate number of tick marks.
You can specify negative values, but negative values
are reasonable only when TYPE=SUM or TYPE=MEAN and one or more of the sums
or means are less than 0. Frequency and percentage values are never less
than 0.
For lists of values, a separate major tick mark is created
for each individual value. A warning message is written to the SAS log if
the values are not evenly spaced.
If the values represented by the bars are larger than
the highest tick mark value, the bars are truncated at the highest tick mark.
If you use a BY statement with the PROC GCHART statement,
the same response axes are produced for each BY group when RAXIS=value-list is used or if there is an ORDER= list in the AXIS statement assigned
to the response axis.
-
REF=value-list
-
draws reference lines at the specified
points on the response axis. See the MIDPOINTS= option for a description of
value-list.
Values can be listed in any order, but should be within
the range of values represented by the response axis. A warning is written
to the SAS log if any of the points are off of the axis, and no reference
line is drawn for such points. You can use the AUTOREF option to draw reference
lines automatically at all of the major tick marks. The REF= option is ignored
if you use AUTOREF.
By default, reference lines in 3D bar charts are drawn
on the back plane of the axis. To draw the reference lines in front of the
bars, use the FRONTREF option.
-
SHAPE=3D-bar-shape (HBAR3D
and VBAR3D only)
-
specifies the shape of the bars in
charts that are produced with the HBAR3D and VBAR3D statements. 3D-bar-shape can be one of the following:
The COUTLINE= option is not valid when SHAPE=CYLINDER.
-
SPACE=bar-spacing
-
specifies the amount of space between
individual bars or between the bars within each group if you also use the
GROUP= option. Bar-space can be any non-negative number, including
decimal values. Units are character cells. By default, the GCHART procedure
calculates spacing based on the size of the axis area and the number of bars
on the chart. Use SPACE=0 to leave no space between adjacent bars.
SPACE= is ignored if the specified spacing requests
a chart that is too large to fit in the space available for the midpoint axis,
and a warning message is issued.
-
SUBGROUP=subgroup-variable
-
divides the bars into segments according
to the values of subgroup-variable. Subgroup-variable
can be either character or numeric and is always treated as a discrete variable.
SUBGROUP= creates a separate segment within each bar for every unique value
of the subgroup variable for that midpoint.
If PATTERNID=SUBGROUP (the default setting), each segment
is filled with a different pattern and a legend that provides a key to the
patterns is automatically generated. If the value of PATTERNID= is anything
other than SUBGROUP, the segments are all the same color, the legend is suppressed,
and the subgrouping effect is lost.
By default the legend appears at the bottom of the chart.
To modify the legend, assign a LEGEND definition with the LEGEND= option.
To suppress the legend, specify NOLEGEND.
-
SUM
-
displays the sum statistic in the
table of statistics. Default statistics are suppressed when you request specific
statistics but all requested statistics are displayed. By default, the column
heading includes the name of the variable for which the sum is calculated.
SUM is ignored unless you also use the SUMVAR= option.
-
SUMLABEL='column-label' (HBAR and HBAR3D only)
-
specifies the text of the column
label for the SUM statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can
be no more than 24 characters. By default, a label with more than one word
will break as close to the center of the line as possible. A double space
in the string forces a line break.
-
SUMVAR=summary-variable
-
specifies a numeric variable for
sum or mean calculations. The GCHART procedure calculates the sum or, if
requested, the mean of summary-variable for each midpoint. The
resulting statistics are represented by the length of the bars along the response
axis, and they are displayed at major tick marks.
When you use SUMVAR=, the TYPE= option must be either
SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.
-
TYPE=statistic
-
specifies the chart statistic.
Because you cannot use TYPE=FREQ, TYPE=CFREQ, TYPE=PERCENT,
or TYPE=CPERCENT with SUMVAR=, you must use FREQ= to calculate percentages,
cumulative percentages, frequencies, or cumulative frequencies based on a
sum. See also Calculating Weighted Statistics.
If you specify TYPE=MEAN and use the SUBGROUP= option,
the height or length of the bar represents the mean for the entire midpoint.
The subgroup segments are proportional to the subgroup's contribution to
the sum for the bar. See also SUBGROUP=.
-
WIDTH=bar-width
-
specifies the width of the bars.
By default, the GCHART procedure selects a bar width that accommodates the
midpoint values displayed on the midpoint axis using a hardware font and a
height of one cell. Units for bar-width are character cells.
The value for bar-width must be greater than 0, but it does
not have to be an integer, for example,
vbar site / width=1.5;
If the requested bar width results in a chart that is
too large to fit in the space available for the midpoint axis, the procedure
issues a warning in the log and ignores the WIDTH= specification. If the specified
width is too narrow, the procedure may display the midpoint values vertically.
-
WOUTLINE=bar-outline-width
-
specifies the width of the outline
in pixels. WOUTLINE= affects both the bar and the subgroup outlines.
In
bar charts, the scale of values of the chart statistic is displayed on the
response axis. By default, the response axis is divided into evenly spaced
intervals identified with major tick marks that are labeled with the corresponding
statistic value. Minor tick marks are evenly distributed between the major
tick marks unless a log axis has been requested. For sum and mean statistics,
the major tick marks are labeled with values of the SUMVAR= variable (formatted
if the variable has an associated format). The response axis is also labeled
with the statistic type.
You can display the chart statistic for each bar either above
or inside the bars of a vertical bar chart by using the OUTSIDE= or INSIDE=
option in the VBAR or VBAR3D statement. The bars must be wide enough to accommodate
the text. You can adjust the width of the bars with the WIDTH= option. To
change the size of the text, use the HTEXT= graphics option.
Logarithmic axes can be specified
with the AXIS statement. See AXIS Statement
for a complete discussion.
In addition to displaying one statistic graphically on the response axis,
the HBAR and HBAR3D statements print a table of statistic values to the right
of the bars. When the value of TYPE= is FREQ, CFREQ, PERCENT, or CPERCENT,
the frequency, cumulative frequency, percentage, and cumulative percentage
statistics are printed next to the bars by default. When TYPE=SUM, the frequency
and sum statistic values are printed by default. When TYPE=MEAN, the frequency
and mean statistic values are printed by default. For sum and mean, the name
of the SUMVAR= variable is added to the heading for the column of values.
You can use the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options to select
only certain statistics. Without the SUMVAR= option, only the frequency,
cumulative frequency, percentage, and cumulative percentage statistics can
be printed. With SUMVAR=, all statistics, including the sum and mean, can
be printed. You can suppress all statistics with the NOSTATS option.
To change the column labels for any statistic in the
table, use one or more of the statistic column label options: FREQLABEL=,
CFREQLABEL=, PERCENTLABEL=, CPERCENTLABEL=, SUMLABEL=, and MEANLABEL=.
To control the font and size of the text in the table
of statistics, use the HTEXT= and FTEXT= graphics options.
To rearrange character or discrete numeric
midpoint values or
to select ranges for numeric values, use the MIDPOINTS= option. Remember
that although changing the number of midpoints for numeric variables may change
the range of values for individual midpoints, it does not change the range
of values for the chart as a whole. For details, see About Midpoints.
Like MIDPOINTS=, the ORDER= option in
the AXIS statement
can rearrange the order of the midpoints or suppress the display of discrete
numeric or character values. However, ORDER= cannot calculate the midpoints
for a continuous numeric variable, or exclude values from the calculations.
For details, see the description of the ORDER= option.
Each bar in a bar chart is filled with a pattern. By
default,
the procedure
See About Patterns
for more information on how the GCHART procedure assigns default patterns
and outlines.
To override the default patterns and select fills and colors for the bars
or bar segments, use the PATTERN statement. Only bar/block patterns are valid;
all other pattern fills are ignored. For a complete description of all bar/block
patterns, see VALUE= in
PATTERN Statement.
Whenever you use PATTERN statements, the default pattern
outline color changes to SAME. That is, the outline color is the same as the
fill color. To specify the outline color, use the COUTLINE= option (see COUTLINE=).
The PATTERNID= option controls when the pattern changes. By default, PATTERNID=SUBGROUP.
Therefore, when you use the SUBGROUP= option to subdivide the bars, the pattern
automatically changes each time the subgroup value changes, and each subdivision
of the bar displays a different pattern. As a result, the number of values
for the SUBGROUP= variable determines the number of bar patterns on the chart.
If you do not subdivide the bars, all bars use the same pattern.
Instead of changing the pattern for each subgroup, you
can change the pattern for each midpoint, each group, or each BY group by
changing the value of PATTERNID=. See the PATTERNID= option for details.
By default, axis
elements use the first color in the colors list or the colors that are specified
by AXIS statement color options. However, action statement options can also
control the color of the axis lines, text, and frame.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.