| The GCHART Procedure |
| Requirements: | At least one chart variable is required. |
| Global statements: | LEGEND, PATTERN, TITLE, FOOTNOTE |
| Supports: | Drill-down functionality |
The PIE, PIE3D, and DONUT statements specify the variable or variables that define the categories of data to chart. These statements automatically
calculate the chart statistic for each midpoint (the default is FREQ).
scale each slice to represent its chart statistic. No slice is drawn if the chart statistic for the midpoint is 0.
order the slices by midpoint value in ascending order starting at the three o'clock position and proceeding counterclockwise around the pie.
print the slice name (midpoint value) and slice value (chart statistic) beside each slice.
assign patterns and colors to the slices. The default pie pattern is PSOLID.
You can use statement options to select or order the midpoints (slices), to change the type of chart statistic, and to modify the appearance of the chart, including the content and position of the slice labels, and patterns used by the slices. You can also specify additional variables by which to group, subgroup, or sum the data. Statement options can also produce special effects, such as exploded or invisible slices.
Donut and pie charts allow grouping and subgrouping. Grouping creates two or more separate pie or donut charts that display in rows or columns on one graph. Subgrouping creates a separate ring of slices within the circle for each value of the subgroup variable. The concentric rings of the subgrouped pie or donut chart make it easy to compare slice values between subgroups.
In addition, you can use global statements to modify patterns and legends, as well as add titles, footnotes, and notes to the chart. You can also use an Annotate data set to enhance the chart.
| PIE | PIE3D | DONUT chart-variable(s) </ option(s)>; |
option(s) can be one or more options from any or all of the following categories:
detail pie options (PIE and DONUT only)
grouping and subgrouping options
detail pie slice-labeling options (PIE and DONUT only)
donut-labeling options (DONUT only):
catalog entry description options
| Required Arguments |
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. Separate multiple chart variables with blanks.
| See also: | About Chart Variables |
| Options |
Options in a PIE, PIE3D, or DONUT 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 and Images. For a complete description of the graphics options, see Graphics Options and Device Parameters Dictionary.
draws number-of-columns pies across the procedure output area. ACROSS is ignored unless you also use the GROUP= option.
If number-of-columns calls for more pies than fit horizontally in the graphics output area, no pies are drawn and an error message is written to the SAS log.
If the DOWN= option also is used, the pies are drawn in left-to-right and top-to-bottom order.
| Featured in: | Assigning Patterns and Identifying Midpoints with a Legend |
starts the first slice at the specified angle. A value of 0 for degrees corresponds to the 3 o'clock position. Degrees can be either positive or negative. Positive values move the starting position in the counterclockwise direction; negative values move the starting position clockwise. By default, ANGLE=0. Successive slices are drawn counterclockwise from the starting slice.
specifies a data set to annotate charts produced by the PIE, PIE3D, or DONUT statement.
Note: Annotate coordinate systems 1, 2, 7, and 8 (data system coordinates) are not
valid with pie or donut charts. ![[cautionend]](../common.hlp/images/cautend.gif)
| See also: | Using Annotate Data Sets |
arranges the slices in ascending order of the value of the chart statistic. By default, slices are arranged in ascending order of midpoint value, without regard to size. ASCENDING reorders the slices from smallest to largest. The OTHER slice is still last regardless of its size.
If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoint values may be different for each pie or donut.
ASCENDING overrides any midpoint order that is specified with the MIDPOINTS= option.
specifies one color for all patterns in the chart, regardless of whether the fill is solid or hatch. For the PIE3D statement, the fill is always solid. For the PIE and DONUT statements, if no pattern is specified on the PATTERN statement or with the FILL= option, the procedure starts with the default solid fill and then, beginning with P2N0, uses each default pie hatch pattern with the specified color. For the outline color, the procedure uses the foreground color, which is the first color in the colors lists. Use COUTLINE= to specify a different outline color. CFILL= overrides any other pattern color specification and controls the color of all slices.
| See also: | Controlling Bar Chart Patterns, Colors, and Images and About Patterns |
| Featured in: | Ordering and Labeling Slices in a Pie Chart |
draws the slices clockwise starting at the 12 o'clock position. Although this position implies ANGLE=90, you can use ANGLE= to specify a different starting angle.
| Featured in: | Assigning Patterns and Identifying Midpoints with a Legend |
outlines all slices, rings (subgroups), and legend values (if a legend appears) in the specified color. SAME specifies that the outline color of a slice or a slice segment or a legend value is the same as the interior pattern color.
The default outline color depends on the PATTERN statement:
If you do not specify a PATTERN statement, the default outline color is black for the Java or ActiveX devices. Otherwise, the default outline color is the foreground color (the first color in the colors list).
If a PATTERN statement or the V6COMP graphics options is specified, the default is COUTLINE=SAME.
Note: If you specify empty patterns
(VALUE=PEMPTY in a PATTERN statement), you should not change the outline color
from the default value, SAME, to a single color. Otherwise, all of the outlines
will be one color and you will not be able to distinguish between the empty
areas. ![[cautionend]](../common.hlp/images/cautend.gif)
specifies the color for all text on the chart that is not otherwise assigned a color. Text includes all slice labels, the chart heading, and group headings if grouping is used. CTEXT= also affects the color of the slice label arrows. See Selecting and Positioning Slice Labels.
For the Java and ActiveX devices, the default color is black. For other devices, if you omit CTEXT=, PROC GCHART searches for a color specification in this order:
The MATCHCOLOR option overrides the CTEXT= option for slice labels.
| Featured in: | Subgrouping a Donut or Pie Chart and Assigning Patterns and Identifying Midpoints with a Legend |
arranges the slices in descending order of the value of the chart statistic. By default, slices are arranged in ascending order of midpoint value, without regard to size. DESCENDING reorders the slices from largest to smallest. The OTHER slice is still last, regardless of its size.
If you also use the GROUP= option, the reordering is performed separately for each group, so the order of midpoint values may be different for each pie or donut.
DESCENDING overrides any midpoint order that is specified with the MIDPOINTS= option.
| Featured in: | Assigning Patterns and Identifying Midpoints with a Legend |
specifies the description of the catalog entry for the chart. The maximum length for entry-description is 256 characters. The description does not appear on the chart. By default, the GCHART procedure assigns a description of the form PIE (or PIE3D or DONUT) CHART OF variable, where variable is the name of the chart variable.
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. Refer to the description of the options, and Substituting BY Line Values in a Text String. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed.
The descriptive text is shown in each of the following:
the catalog-entry properties that you can view from the Explorer window
the Table of Contents that is generated when you use CONTENTS= on an ODS statement (see Linking to Output through a Table of Contents), assuming the GCHART output is generated while the contents page is open
the data tip text for web output (depending on the device driver you are using). See Adding Data Tips to Web Presentations for details.
produces a inner pie overlay whose slices show the major components that comprise the outer pie's slice. Variable is the variable whose values are used to construct the detail pie. If you specify the DETAIL= option and either GROUP= or SUBGROUP=, then the DETAIL= option is ignored.
specifies the algorithm to use for displaying the percentage values for the detail pie slices. NONE turns off the display of the percentage values.
determines the size of the detail pie. Percent specifies the percent of the outer pie radius to use as the detail pie radius. The valid range is 25 to 90. The default is 75.
specifies the algorithm to use for displaying the detail variable labels for the inner pie slices. NONE turns off the display of the detail variable labels.
determines if a detail slice is included in the inner pie. Any detail slice comprising percent or more percent of the whole pie is included. The valid range for percent is 0 to 75. The default is 4.
specifies the algorithm to use for displaying the data values for the detail pie slices. NONE turns off the display of the data values.
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 slice 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.
specifies the size of the donut hole in percent of the radius of the whole chart. Values of percent range from 0 to 99. By default, DONUTPCT=25.
| Featured in: | Subgrouping a Donut or Pie Chart |
draws number-of-rows pies vertically in the procedure output area. The DOWN= option is ignored unless you also use the GROUP= option.
If number-of-rows calls for more pies than fit vertically in the graphics area of the output device, no pies are drawn and an error message is written to the SAS log.
If you also use the ACROSS= option, the pies are drawn in left-to-right and top-to-bottom order.
pulls the specified slices slightly out from the rest of the pie for added emphasis. Value-list is the list of midpoint values for the slices to be exploded. See the MIDPOINTS= option for a description of value-list.
The values in the value list must match the existing midpoints exactly, including the case of character midpoints. Any values in the list that do not correspond to existing midpoints are ignored.
When you use EXPLODE=, the radius is reduced to allow room for exploded slices.
EXPLODE= does not work with subgroups.
| Featured in: | Specifying the Sum Statistic for a Pie Chart |
specifies the fill pattern for all slices in the chart:
rotates a solid fill through the colors list as many times as necessary. This is the default.
rotates a single hatch pattern through the colors list as many times as necessary. The Java and ActiveX devices and PIE3D do not support FILL=X.
If you use default device colors (the COLORS= option is omitted), the fill skips the first color in the colors list.
FILL= overrides any pattern that is specified in PATTERN statements.
By default, the outline color is the first color in the colors list. If PATTERN statements are used to specify colors, the slice outline color matches the slice fill color.
By default, the fill patterns take the colors from the current colors list in rotation. If any PATTERN statements have been defined, the colors in the PATTERN definitions are used, in order, before the default color rotation.
| See also: | Controlling Bar Chart Patterns, Colors, and Images and PATTERN Statement |
| Not supported by: | Java (partial), ActiveX (partial) |
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 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. Non-integer values of numeric-variable are truncated to integers.
FREQ= is valid with all chart statistics.
Because you cannot use TYPE=PERCENT or TYPE=FREQ with the SUMVAR= option, you must use FREQ= to calculate percentages and frequencies based on a sum.
The statistics will not be affected by applying a format to numeric-variable.
| See also: | Calculating Weighted Statistics |
organizes the data according to values of group-variable and produces a separate pie (or donut) chart for each unique value of group-variable. Group-variable can be either character or numeric and is always treated as a discrete variable. Missing values for group-variable are treated as a valid group. By default, each group includes only those midpoints with nonzero chart statistic values.
By default, the charts are produced in ascending order of group variable value and each is drawn on a separate page or display. Therefore, the effect of GROUP= is essentially the same as using a BY statement except that GROUP= causes the midpoints with the same value to use the same color and fill pattern. To place more than one pie on a page or display, use the ACROSS= or DOWN= options, or both.
| See also: | BY Statement |
| Featured in: | Grouping and Arranging Pie Charts |
identifies the variable in the input data set whose values create links in the HTML file that is created by the ODS statement. These links are associated with an area of the chart and point to the data or graph that you wish to display when the user drills down on the area. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.
identifies the variable in the input data set whose values create links in the HTML file created by the ODS statement. These links are associated with a legend value and point to the data or graph that you wish to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.
| Not supported by: | Java, ActiveX |
makes the specified slices invisible, as if they had been removed from the pie. Labels are not printed for invisible slices. Value-list is the list of midpoint values for the invisible slices. See the MIDPOINTS= option for a description of value-list.
The values in the value list must match the existing midpoints exactly, including the case of character midpoints. Any values in the list that do not correspond to existing midpoints are ignored.
arranges the midpoints in descending order of the statistic value and draws the slices clockwise starting at the 12 o'clock position. The JSTYLE option has the same effect as specifying both the DESCENDING and CLOCKWISE options.
defines the text that is displayed in the donut hole. Text-argument(s) defines the text or the appearance of the label, or both. Text-argument(s) can be one or more of the following:
provides the text of the label. Enclose each string in quotation marks. Separate multiple strings with blanks.
modifies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be
The Java and ActiveX devices do not support all of the suboptions. See Text Description Suboptions for a complete description.
Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
| Featured in: | Subgrouping a Donut or Pie Chart |
| Not supported by: | Java (partial), ActiveX (partial) |
generates a legend for the slice names (midpoint values) instead of printing them beside the slices. The legend displays each slice name and its associated pattern. This option also suppresses the display of the chart statistic values. To display the chart statistics, use the VALUE= option.
If you use the SUBGROUP= option, the legend is automatically generated. However, because patterning is always by midpoint, the legend still describes the midpoint values, not the subgroups.
Note: If you request a legend and the slices use hatch patterns, the patterns in
the slices are oriented to be visually equivalent to the legend. ![[cautionend]](../common.hlp/images/cautend.gif)
Specifying LEGEND=LEGENDn assigns the specified LEGEND statement to the legend. The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement for more information.
| See also: | LEGEND Statement and SUBGROUP= option |
| Featured in: | Subgrouping a Donut or Pie Chart Assigning Patterns and Identifying Midpoints with a Legend |
| Not supported by: | Java (partial), ActiveX (partial) |
specifies the number of midpoints for a numeric chart variable. The range for each midpoint is calculated automatically.
If you specify LEVELS=ALL, then all unique midpoint values are graphed. If your data contains a large number of unique midpoint values (over 200), you can use the XPIXELS and YPIXELS GOPTIONS to allow the device driver to render a larger (and more readable) graph.
uses the slice pattern color for all slice labels. MATCHCOLOR overrides the color that is specified in the CTEXT= option.
specifies the midpoint values for the slices. The way you specify value-list depends on the type of 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
the lowest midpoint consolidates all data points from negative infinity to the median of the first two midpoints
the highest midpoint consolidates all data points from the median of the last two midpoints up to infinity
all other values in value-list specify the median of a range of values, and 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.
Midpoints that represent small percentages are collected into a generic midpoint named OTHER. See the OTHER= option and the OTHERLABEL= option for more information.
| See also: | About Midpoints |
| Featured in: | Ordering and Labeling Slices in a Pie Chart |
generates default midpoints using the Nelder algorithm (Applied Statistics 25:94-7, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric
accepts a missing value as a valid midpoint for the chart variable. By default, observations with a missing value are ignored. Missing values are always valid for the group and subgroup variable.
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, thenSAS/GRAPH software adds a number to the duplicate name to create a unique name--for example, GCHART1.
suppresses the headings that are normally printed above each pie when you use the GROUP= option.
suppresses the heading that is normally printed at the top of each page or display of output for all devices except Java and ActiveX. For the Java and ActiveX devices, NOHEADING is the default.
| Featured in: | Subgrouping a Donut or Pie Chart |
| Not supported by: | Java, ActiveX |
suppresses the legend that is automatically generated by the SUBGROUP= option. NOLEGEND is ignored if the SUBGROUP= option is not used.
collects all midpoints with chart statistic values less than or equal to percent-of-total into a generic midpoint named OTHER. The value of percent-of-total can be 0 to 100; the default value is 4. Therefore, any slice that represents 4 percent or less of the total is put in the OTHER category.
Note: If you specify a small value for percent-of-total, the GCHART
procedure may not be able to label all of the
small slices. ![[cautionend]](../common.hlp/images/cautend.gif)
The OTHER slice is the last slice in the pie, regardless of the order of the slices. (In other words, it is the slice immediately before the starting slice.)
If only one midpoint falls into the OTHER category, its slice is displayed in its normal position in the pie and retains its original label. For example, suppose a pie has these slices and percent values: Coal 35%, Gas 15%, Hydro 5%, and Oil 45%. If you specify OTHER=5, Hydro remains the third slice instead of becoming the last slice.
| Featured in: | Assigning Patterns and Identifying Midpoints with a Legend and Grouping and Arranging Pie Charts |
specifies the color to use for the OTHER slice. If you omit the OTHERCOLOR= option, GCHART searches for a color specification in this order:
For more information, see Controlling Slice Patterns and Colors.specifies a text string up to 16 characters for the label for the OTHER slice. The default label is OTHER.
| Featured in: | Assigning Patterns and Identifying Midpoints with a Legend |
prints the percentage represented by each slice using the specified labeling method. For a description of the option values, see Selecting and Positioning Slice Labels. By default, PERCENT=NONE (percentage is not displayed).
Whether the slice percent displays with or without decimal places, depends on the range of values across the chart. The only way to control the appearance of these values is to calculate the percentage with a DATA step or statistical procedure and use the resulting data set as input to the GCHART procedure. Assign the variable that contains the calculated percentages to the SUMVAR= option.
| Featured in: | Ordering and Labeling Slices in a Pie Chart and Grouping and Arranging Pie Charts |
controls the position and style of the slice name (midpoint value) for each slice. For a description of the option values, see Selecting and Positioning Slice Labels. By default, SLICE=OUTSIDE (the name is outside of the slice).
| Featured in: | Ordering and Labeling Slices in a Pie Chart and Grouping and Arranging Pie Charts |
divides the chart into concentric rings according to the values of subgroup-variable. For DEVICE=JAVA, subgroups are implemented using drill-down functionality instead of concentric rings. In the resulting graph, you can select a pie slice to display subgroup information. Subgroup-variable can be either character or numeric and is always treated as a discrete variable.
The width of the rings, which is the same for each subgroup, is determined by the radius of the pie and the size of the donut hole, if any.
By default, the subgroup rings are ordered from the outside in, alphabetically (if character) or numerically (if numeric). If the JSTYLE option is also used, the order of the slices within the subgroups is determined by the outermost subgroup. Any inner subgroup that contains a value that is not in the outer subgroup, places the new slice for that value either last or just before the "other" slice, if one is present. That slice order is continued for any remaining subgroups.
Each ring is labeled with its subgroup value; labels are placed to the right of the chart. If the GROUP= option is also used and if all groups contain the same subgroups, then only the first (upper left) chart on each page is labeled. If any group differs in the number of subgroups it contains, then all charts are labeled.
By default the subgroups are outlined in the foreground color. To specify an outline color, use the COUTLINE= option.
SUBGROUP= automatically generates a legend for the midpoint values (not the subgroup values) and suppresses display of the chart statistic. By default the legend appears at the bottom of the chart. To modify the legend, assign a LEGEND definition. To suppress the legend, specify NOLEGEND. To display the chart statistic, use the VALUE= option.
If EXPLODE is also used, it is ignored.
| See also: | Controlling Bar Chart Patterns, Colors, and Images and LEGEND Statement |
| Featured in: | Subgrouping a Donut or Pie Chart and Ordering and Labeling Slices in a Pie Chart |
specifies a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of numeric-variable for each midpoint. The resulting statistics are represented by the size of the slice and displayed beside of each slice.
When you use SUMVAR=, the TYPE= option must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.
| Featured in: | Specifying the Sum Statistic for a Pie Chart |
specifies the chart statistic.
Because you cannot use TYPE=FREQ or TYPE=PERCENT with the SUMVAR= option, you must use FREQ= to calculate percentages or frequencies based on a sum.
| See also: | About Chart Statistics and Calculating Weighted Statistics |
controls the position and style of the slice value (chart statistic) for each slice. For a description of the option values see Selecting and Positioning Slice Labels. By default, VALUE=OUTSIDE (the value is outside the slice).
| Featured in: | Ordering and Labeling Slices in a Pie Chart and Assigning Patterns and Identifying Midpoints with a Legend |
specifies the width of the outline in pixels. WOUTLINE= affects both the slice and the subgroup outlines.
| Not supported by: | Java, ActiveX |
| Text Description Suboptions |
The LABEL= option in the DONUT statement uses text description suboptions to change the color, height, justification, font, and angle of the following text string(s).
specifies the angle at which the baseline of the text string(s) is rotated with respect to the horizontal. A positive value for degrees moves the baseline counterclockwise; a negative value moves it clockwise. By default, ANGLE=0 (horizontal).
| Not supported by: | Java |
specifies the color for the text string(s). The COLOR= suboption stays in effect until another COLOR= specification is encountered. If you omit COLOR=, LABEL= uses the first color in the colors list. It ignores the CTEXT= graphics option. See SAS/GRAPH Colors and Images for details on specifying color.
specifies the font for the text string(s). If you omit FONT=, LABEL= uses the font that is specified by the FTEXT= graphics option. If no font is specified, it uses the default hardware font, NONE. See SAS/GRAPH Fonts for details on specifying font. The Java and ActiveX devices do not support all fonts.
| Not supported by: | Java (partial), ActiveX (partial) |
specifies the height of the text string(s). Text-height is the number of units. If you omit HEIGHT=, LABEL= uses the height that is specified by the HTEXT= graphics option. If no text height is specified and if the default text height is too large for the donut hole, the size of the label is reduced to fit. Units can be CELLS | CM | IN | PCT | PT. If you omit units, HEIGHT= uses the unit that is specified by the GUNIT= graphics option, or the default unit, CELLS.
specifies the alignment of the text string(s). By default, JUSTIFY=CENTER.
| Not supported by: | Java, ActiveX |
specifies the angle at which each character is rotated with respect to the baseline of the text string. The angle is measured from the current text baseline angle specified by the ANGLE= suboption. A positive value for degrees rotates the character counterclockwise; a negative value rotates it clockwise. By default, ROTATE=0 (parallel to the baseline).
| Not supported by: | Java |
| Selecting and Positioning Slice Labels |
By default, each slice is labeled with its midpoint value (slice name) and its chart statistic value (slice value), which are printed outside of the slice. You can control where and how these labels are displayed with the SLICE= and VALUE= options, respectively. In addition, each slice can display the percentage its midpoint contributes to the total chart statistic (slice percent). Use the PERCENT= option to request slice percent.
The SLICE=, VALUE=, and PERCENT= options use the same values:
places the text outside the slice and connects the text to the slice with a line. This labeling method reduces the radius of the pie. The arrow uses the color that is specified by CTEXT= in the PIE, PIE3D, or DONUT statement. If CTEXT= is omitted, the arrow uses the first color in the colors list.
places the text inside the slice. The label overlays the slice fill patterns. This labeling method increases the radius of the pie.
Slice Labeling Methods illustrates these values.
![[Slice Labeling Methods]](./images/gchart07.gif)
The SLICE= and VALUE= options are dependent on each other. If you specify only VALUE= or only SLICE=, the other option automatically uses the same labeling method. PERCENT= is independent of these two.
Be careful about the combinations that you specify. For example, if you specify PERCENT=ARROW and VALUE=OUTSIDE, the line that connects the percentage information to each slice may overlay the statistic value.
If your pie has many slices, the labels may overlap, particularly if there are several small slices together. You can correct the overlapping labels by using
the Graphics Editor to adjust the labels by moving or resizing the text.
MIDPOINTS= to rearrange slices so that small slices are not together.
the HPOS= and VPOS= graphics options to increase the number of cells in your display. ( See About the Graphics Output Area for details.)
| Controlling Slice Patterns and Colors |
Pie and donut charts are always patterned by midpoint. Even when you specify subgrouping, the patterning method does not change from midpoint to subgroup.
Each slice in a pie or donut chart is filled with a pattern. By default, the procedure
fills the slices with pie patterns, beginning with the default fill, PSOLID, and rotating through the colors in the colors list. When the solid patterns are exhausted, the procedure selects the next default pie pattern and rotates it through the colors list. It continues in this fashion until all of the required patterns have been assigned.
Note: PIE3D always uses solid patterns. ![[cautionend]](../common.hlp/images/cautend.gif)
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 the colors in the list to generate the patterns.
outlines slices and subgroup segments using the first color in the colors list. To change the outline color, use the COUTLINE= option.
See About Patterns for more information on how the GCHART procedure assigns default patterns and outlines.
You can control slice patterns and their outlines in several ways.
To select a different fill for the slices, such as empty or hatched, you can
request a single hatched fill pattern for all slices by specifying the FILL=X option on the PIE or DONUT statement. The pattern specified by FILL=X rotates through the colors list as many times as needed to generate all of the patterns that are required by the chart. If you specify a single color with either CFILL= or the graphics option, CPATTERN=, all slices use the same color as well as the same pattern.
specify a pattern with the VALUE= option in the PATTERN statement. Only pie patterns are valid; all other pattern specifications are ignored. For a complete description of all pie patterns, see VALUE= in PATTERN Statement.
If no color options are specified, the procedure rotates each specified fill once through the colors list. Otherwise the PATTERN statement generates one pattern definition for the specified pattern and color. When all of the specified patterns are exhausted, the procedure starts rotating through the default pie patterns, beginning with PSOLID.
To select colors for the slices, you can
specify a single pattern color with the CFILL= option, or with the CPATTERN= graphics option, or with a colors list of one color. For the PIE and DONUT statements, CFILL= starts with the default solid color and uses the foreground color for outlines, whereas CPATTERN= and a colors list of one color skip the solid pattern and, beginning with P2N0, use each pie hatch pattern with the specified color, and use the fill color for the outline color.
specify only COLOR= in one or more PATTERN statements. In this case, the procedure creates a solid pattern for each specified color. When it runs out of PATTERN statements, it returns to the default patterns, beginning with PSOLID, and rotates them each through the colors list. Whenever you specify a PATTERN statement, the default outline color is SAME.
To define specific patterns and colors for the slices, use PATTERN statements and specify both the VALUE= and COLOR= options. If you provide fewer PATTERN definitions than the chart requires, the GCHART procedure uses the default pattern rotation for the slices that are drawn after all of the defined patterns are exhausted.
Whenever you use PATTERN statements, the default outline color changes to SAME. That is, the outline color is the same as the fill color. To change the outline color, use the COUTLINE= option.
See About Patterns for more information on how the GCHART procedure uses patterns and outlines. See PATTERN Statement for a description of default pie patterns.
| Modifying the Statistic Heading and the Group Heading |
By default, the procedure prints a heading at the top of each pie (or donut) chart that indicates the type of statistic charted and the name of the chart variable- for example, SUM of SALES by SITE. You can suppress this heading with the NOHEADING option.
When you use the GROUP= option, a heading is printed above each pie indicating the name of the group variable and its value for the particular pie- for example, SITE=Paris. You can suppress these headings with the NOGROUPHEADING option. You can also suppress the variable name SITE= so that only the value Paris remains. To do this, use a LABEL statement and assign a null value to the variable name, for example,
label site='00'x;
Because the AXIS statement cannot be used by the PIE, PIE3D, and DONUT statements, you should use the FTEXT= and HTEXT= graphics options to control the font and height of text on the chart. Increasing the value of the HTEXT= graphics option decreases the size of the pie if any slice labels are positioned outside.
Copyright 2003 by SAS Institute Inc., Cary, NC, USA. All rights reserved.