Chapter Contents |
Previous |
Next |
The GCHART Procedure |
Requirements: | At least one chart variable is required. |
Global statements: | LEGEND, PATTERN, TITLE, FOOTNOTE |
Supports: | Drill-down functionality |
You can use statement options to select or order the midpoints (blocks), to change the type of chart statistic, and to modify the appearance of the chart. You can also specify additional variables by which to group, subgroup, or sum the data.
Block charts allow grouping, which organizes the blocks into rows based on the values of a group variable, and subgrouping, which subdivides the blocks into segments based on the values of a subgroup variable.
In addition, you can use global statements to modify the block 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.
Note: If you get a message that the chart is too large to
display on your terminal or printer, try one or both of the following:
See About the Graphics Output Area
for a details.
BLOCK chart-variable(s) </ option(s);> |
option(s) can be one or more options from any or all of the following categories:
ANNOTATE=Annotate-data-set | |
BLOCKMAX=max-value | |
CAXIS=grid-color | |
COUTLINE=block-outline-color | SAME | |
CTEXT=text-color | |
LEGEND=LEGEND<1...99> | |
NOHEADING | |
NOLEGEND | |
PATTERNID=BY |GROUP |MIDPOINT |SUBGROUP | |
WOUTLINE=block-outline-width |
DISCRETE | |
GROUP=group-variable | |
LEVELS=number-of-midpoints | |
MIDPOINTS=value-list | |
MIDPOINTS=OLD | |
MISSING | |
SUBGROUP=subgroup-variable |
FREQ=numeric-variable | |
G100 | |
SUMVAR=summary-variable | |
TYPE=statistic |
catalog entry description options
DESCRIPTION='entry-description' | |
NAME='entry-name' |
ODS options
HTML=variable | |
HTML_LEGEND=variable |
Required Arguments |
See also: | About Chart Variables |
Options |
Options in a BLOCK statement affect all graphs 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.
Note: Annotate
coordinate systems 1, 2, 7, and 8 (data system coordinates) are not valid
with block charts.
See also: | The Annotate Data Set |
Featured in: | Grouping and Subgrouping a Block Chart |
The default outline color depends on the PATTERN statement:
Note: 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.
See also: | Controlling Block Chart Patterns and Colors and About Patterns |
Featured in: | Grouping and Subgrouping a Block Chart |
CTEXT= is overridden by the COLOR= suboption of the LABEL= or VALUE= option in a LEGEND definition assigned to the subgroup legend. The suboption determines the color of the legend label or the color of the legend value descriptions, respectively.
The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. For more information, refer to the description of the options, and Substituting BY Line Values in a Text String. The 40-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 40 characters, it is truncated to 40 characters, and then the substitution is performed.
The descriptive text is shown in the "description" portion of each of the following:
The LEVELS= option is ignored when you use DISCRETE. The MIDPOINTS= option overrides DISCRETE.
FREQ= is valid with all chart statistics.
Because you cannot use the PERCENT, CPERCENT, FREQ, or CFREQ statistics with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum.
See also: | Calculating Weighted Statistics |
By default, the individual percentages reflect the contribution of the midpoint to the entire chart and total 100 percent for the entire chart.
GROUP= produces a group grid that contains a separate row of blocks for each unique value of the group variable. Each row contains a square for each midpoint. The groups are arranged from front to back in ascending order of the group variable values. These values are printed to the left of each row; the group variable name or label is printed above the list of group values.
By default, each group includes all midpoints, even if no observations for the group fall within the midpoint range. Missing values for group-variable are treated as a valid group.
Featured in: | Grouping and Subgrouping a Block Chart |
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:
block city / subgroup=city;
See also: | LEGEND Statement and SUBGROUP= |
Featured in: | Grouping and Subgrouping a Block Chart |
n <...n> | |
n TO n <BY increment> | |
n <...n> TO n <BY increment> <n <...n>> |
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
If you include the DISCRETE option, each value in value-list specifies a unique numeric value.
'value-1' <...'value-n'> |
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 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, you can correct crowded values by increasing the number of cells in your graphics display using the HPOS= and VPOS= graphics options.
See also: | About Midpoints |
Featured in: | Grouping and Subgrouping a Block Chart |
Featured in: | Grouping and Subgrouping a Block Chart |
Note: If you use the SUBGROUP= option and specify a PATTERNID= value
other than SUBGROUP, the block segments use the same pattern and are indistinguishable.
See also: | Controlling Block Chart Patterns and Colors |
Featured in: | Creating Bar Charts with Drill-down for the Web |
If PATTERNID=SUBGROUP (the default setting), each segment is filled with a different pattern, and a legend providing 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.
See also: | LEGEND Statement |
Featured in: | Grouping and Subgrouping a Block Chart |
When you use SUMVAR=, the TYPE= option value must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.
Featured in: | Specifying the Sum Statistic in a Block Chart |
Because you cannot specify the statistics PERCENT, CPERCENT, FREQ, or CFREQ in conjunction 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 of the block represents the mean for the entire midpoint. The subgroup segments are proportional to the subgroup's contribution to the sum for the block.
See also: | About Chart Statistics |
Featured in: | Grouping and Subgrouping a Block Chart |
Controlling Block Chart Patterns and Colors |
In a block chart, only the front faces of the blocks display patterns. By default, the procedure
If you use the device's default colors and the first color in the list is either black or white, the procedure does not create a pattern in that color. If you specify a colors list with the COLORS= graphics option, the procedure uses all of the colors in the list to generate the patterns.
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 blocks or block 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.
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.
Controlling Block Chart Text |
To control the font and size of text on the chart, use the FTEXT= and HTEXT= graphics options. See Graphics Options and Device Parameters Dictionary for a description of these options.
Because block charts do not use AXIS statements, you must use a LABEL statement instead to suppress the label for the midpoint variable. See Grouping and Subgrouping a Block Chart.
Displaying Negative or Zero Values |
The relative block heights in the chart represent the scaled value of the chart statistic value for the midpoint. If the statistic has a value of 0 or, in the case of sum and mean, a negative value, the base of the block is drawn in the square for the corresponding midpoint. Block Chart with 0 and Negative Statistic Values shows an example of a chart with 0 and negative statistic values.
Block Chart with 0 and Negative Statistic Values
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.