CHART Procedure

BLOCK Statement

Produces a block chart.
Producing Block Charts for BY Groups


Required Argument

specifies the variables for which PROC CHART produces a block chart, one chart for each variable.

Optional Arguments

specifies the values for the response axis, where value-expression is a list of individual values, each separated by a space, or a range with a uniform interval for the values. For example, the following range specifies tick marks on a bar chart from 0 to 100 at intervals of 10: hbar x / axis=0 to 100 by 10;
Restrictions:Values must be uniformly spaced, even if you specify them individually.

For frequency charts, values must be integers.

Interactions:For BLOCK charts, AXIS= sets the scale of the tallest block. To set the scale, PROC CHART uses the maximum value from the AXIS= list. If no value is greater than 0, then PROC CHART ignores the AXIS= option.

If you use AXIS= and the BY statement, then PROC CHART produces uniform axes over BY groups.

Values in value-expression override the range of the data.
For example, if the data range is 1 to 10 and you specify a range of 3 to 5, then only the data in the range 3 to 5 appears on the chart. Values out of range produce a warning message in the SAS log.
specifies a data set variable that represents a frequency count for each observation. Normally, each observation contributes a value of one to the frequency counts. With FREQ=, each observation contributes its value of the FREQ= value.
Restriction:If the FREQ= values are not integers, then PROC CHART truncates them.
Interaction:If you use SUMVAR=, then PROC CHART multiplies the sums by the FREQ= value.
produces side-by-side charts, with each chart representing the observations that have a common value for the GROUP= variable. The GROUP= variable can be character or numeric and is assumed to be discrete. For example, the following statement produces a frequency bar chart for men and women in each department:
   vbar gender / group=dept;
Missing values for a GROUP= variable are treated as valid levels.
specifies that the sum of percentages for each group equals 100. By default, PROC CHART uses 100% as the total sum. For example, if you produce a bar chart that separates males and females into three age categories, then the six bars, by default, add to 100%. However, with G100, the three bars for females add to 100%, and the three bars for males add to 100%.
Interaction:PROC CHART ignores G100 if you omit GROUP=.
specifies the number of bars that represent each chart variable when the variables are continuous.
MIDPOINTS=midpoint-specification | OLD
defines the range of values that each bar, block, or section represents by specifying the range midpoints.
The value for MIDPOINTS= is one of the following:
specifies midpoints, either individually, or across a range at a uniform interval. For example, the following statement produces a chart with five bars. The first bar represents the range of values of X with a midpoint of 10. The second bar represents the range with a midpoint of 20, and so on:
   vbar x / midpoints=10 20 30 40 50;
Here is an example of a midpoint specification for a character variable:
   vbar x / midpoints='JAN' 'FEB' 'MAR';
Here is an example of specifying midpoints across a range at a uniform interval:
   vbar x / midpoints=10 to 100 by 5;
specifies an algorithm that PROC CHART used in previous versions of SAS to choose midpoints for continuous variables. The old algorithm was based on the work of Nelder (1976). The current algorithm that PROC CHART uses if you omit OLD is based on the work of Terrell and Scott (1985).
Default:Without MIDPOINTS=, PROC CHART displays the values in the SAS System's normal sorted order.
specifies that missing values are valid levels for the chart variable.
suppresses the default header line printed at the top of a chart.
suppresses printing of the subgroup symbol or legend table.
Interaction:PROC CHART ignores NOSYMBOL if you omit SUBGROUP=.
subdivides each bar or block into characters that show the contribution of the values of variable to that bar or block. PROC CHART uses the first character of each value to fill in the portion of the bar or block that corresponds to that value, unless more than one value begins with the same first character. In that case, PROC CHART uses the letters A, B, C, and so on, to fill in the bars or blocks. If the variable is formatted, then PROC CHART uses the first character of the formatted value.
The characters used in the chart and the values that they represent are given in a legend at the bottom of the chart. The subgroup symbols are ordered A through Z and 0 through 9 with the characters in ascending order.
PROC CHART calculates the height of a bar or block for each subgroup individually and then rounds the percentage of the total bar up or down. So the total height of the bar can be higher or lower than the same bar without the SUBGROUP= option.
Interaction:If you use both TYPE=MEAN and SUBGROUP=, then PROC CHART first calculates the mean for each variable that is listed in the SUMVAR= option. It then subdivides the bar into the percentages that each subgroup contributes.
specifies the variable for which either values or means (depending on the value of TYPE=) PROC CHART displays in the chart.
Interaction:If you use SUMVAR= and you use TYPE= with a value other than MEAN or SUM, then TYPE=SUM overrides the specified TYPE= value.
Tip:Both HBAR and VBAR charts can print labels for SUMVAR= variables if you use a LABEL statement.
specifies the character or characters that PROC CHART uses in the bars or blocks of the chart when you do not use the SUBGROUP= option.
Default:asterisk (*)
Interaction:If the SAS system option OVP is in effect and if your printing device supports overprinting, then you can specify up to three characters to produce overprinted charts.
specifies what the bars or sections in the chart represent. The statistic is one of the following:
specifies that each bar, block, or section represent the cumulative frequency.
specifies that each bar, block, or section represent the cumulative percentage.
specifies that each bar, block, or section represent the frequency with which a value or range occurs for the chart variable in the data.
specifies that each bar, block, or section represent the mean of the SUMVAR= variable across all observations that belong to that bar, block, or section.
Interaction:With TYPE=MEAN, you can compute only MEAN and FREQ statistics.
specifies that each bar, block, or section represent the percentage of observations that have a given value or that fall into a given range of the chart variable.
specifies that each bar, block, or section represent the sum of the SUMVAR= variable for the observations that correspond to each bar, block, or section.
Default:FREQ (unless you use SUMVAR=, which causes a default of SUM)
Interaction:With TYPE=SUM, you can compute only SUM and FREQ statistics.


Statement Results

Because each block chart must fit on one output page, you might have to adjust the SAS system options LINESIZE= and PAGESIZE= if you have a large number of charted values for the BLOCK variable and for the variable specified in the GROUP= option.
The following table shows the maximum number of charted values of BLOCK variables for selected LINESIZE= (LS=) specifications that can fit on a 66-line page.
Maximum Number of Bars of BLOCK Variables
GROUP= Value
LS= 132
LS= 120
LS= 105
LS= 90
LS= 76
LS= 64
If the value of any GROUP= level is longer than three characters, then the maximum number of charted values for the BLOCK variable that can fit might be reduced by one. BLOCK level values truncate to 12 characters. If you exceed these limits, then PROC CHART produces a horizontal bar chart instead.