CHART Procedure

PIE Statement

Produces a pie chart.

Syntax

Required Argument

variable(s)
specifies the variables for which PROC CHART produces a pie chart, one chart for each variable.

Optional Arguments

FREQ=variable
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.
LEVELS=number-of-midpoints
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:
midpoint-specification
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;
Example:
OLD
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.
MISSING
specifies that missing values are valid levels for the chart variable.
NOHEADER
suppresses the default header line printed at the top of a chart.
Alias:NOHEADING
SUMVAR=variable
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.
TYPE=statistic
specifies what the bars or sections in the chart represent. The statistic is one of the following:
CFREQ
specifies that each bar, block, or section represent the cumulative frequency.
CPERCENT
specifies that each bar, block, or section represent the cumulative percentage.
Alias:CPCT
FREQ
specifies that each bar, block, or section represent the frequency with which a value or range occurs for the chart variable in the data.
MEAN
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.
PERCENT
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.
SUM
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.

Details

Statement Results

PROC CHART determines the number of slices for the pie in the same way that it determines the number of bars for vertical bar charts. Any slices of the pie accounting for less than three print positions are grouped together into an "OTHER" category.
The pie's size is determined only by the SAS system options LINESIZE= and PAGESIZE=. By default, the pie looks elliptical if your printer does not print 6 lines per inch and 10 columns per inch. To make a circular pie chart on a printer that does not print 6 lines and 10 columns per inch, use the LPI= option in the PROC CHART statement. See the description of LPI=value for the formula that gives you the proper LPI= value for your printer.
If you try to create a PIE chart for a variable with more than 50 levels, then PROC CHART produces a horizontal bar chart instead.