Previous Page | Next Page

The GCHART Procedure

PIE, PIE3D, and DONUT Statements


Create pie or donut charts in which the size of a pie slice represents the value of the chart statistic for that category of data in relation to the total chart statistic for all categories.
Requirements: At least one chart variable is required.
Global statements: LEGEND, PATTERN, TITLE, FOOTNOTE
Supports: Drill-down functionality


Description

The PIE, PIE3D, and DONUT statements specify the variable or variables that define the categories of data to chart. These statements automatically do the following:

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.


Syntax

PIE | PIE3D | DONUT chart-variable(s) </ option(s)>;

option(s) can be one or more options from any or all of the following categories:


Required Arguments

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. 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.

ACROSS=number-of-columns

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 you also use the DOWN= option, the pies are drawn in left-to-right and top-to-bottom order.

ANGLE=degrees

starts the first slice at the specified angle. A value of 0 for degrees corresponds to the three 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.

ANNOTATE=Annotate-data-set

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]

Alias: ANNO=
See also: Using Annotate Data Sets
ASCENDING

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. The ASCENDING option 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 might be different for each pie or donut.

The ASCENDING option overrides any midpoint order that is specified with the MIDPOINTS= option.

CFILL=fill-color

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 in 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 default color, which is retrieved from the current style, or, if the NOGSTYLE option is specified, it uses the first color in the device's color list. Use the COUTLINE= option to specify a different outline color. The CFILL= option overrides any other pattern color specification and controls the color of all slices.

Style reference: Color attribute of the GraphData1 element.
Featured in: Ordering and Labeling Slices in a Pie Chart
See also: Controlling Bar Chart Patterns, Colors, and Images and About Patterns
CLOCKWISE

draws the slices clockwise starting at the twelve o'clock position. Although this position implies ANGLE=90, you can use the ANGLE= option to specify a different starting angle.

COUTLINE=slice-outline-color | SAME

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 in the PATTERN statement:

  • If you do not specify a PATTERN statement, the default outline color is the color of the current style.

  • If you specify the NOGSTYLE option and no PATTERN statement, the default outline color is black for the Java or ActiveX devices. Otherwise, the default outline color is the foreground color. If you specify an EMPTY PATTERN statement, then the default outline color is the same as the fill color.

Style reference: Color attribute of the GraphOutlines element.
Featured in: Specifying the Sum Statistic for a Pie Chart, Subgrouping a Donut or Pie Chart. and
See also: Controlling Slice Patterns and Colors and About Patterns
CTEXT=text-color

specifies a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GCHART procedure looks for the text color in the following order:

  1. the colors specified for labels and values on assigned AXIS and LEGEND statements, which override the CTEXT= option specified on the PIE/DONUT statement

  2. the color specified by the CTEXT= option in the PIE/DONUT statement

  3. the color specified by the CTEXT= option in a GOPTIONS statement

  4. the color specified in the current style or, if the NOGSTYLE option is specified, then the default color is black for the Java and ActiveX devices and the first color in the color list for all other devices

The LEGEND statement's VALUE= color is used for legend values, and its LABEL= color is used for legend labels.

The AXIS statement's VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement specifies only general axis colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specification and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks.

Note:   If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement.  [cautionend]

Style reference: Color attributes of the GraphValueText and the GraphLabelText elements.
Featured in: Subgrouping a Donut or Pie Chart.
DESCENDING

arranges the slices in descending order of the value of the chart statistic. By default, slices are arranged in ascending order of alphabetical or numeric midpoint value, without regard to size or summary statistic. 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 might be different for each pie or donut.

DESCENDING overrides any midpoint order that is specified with the MIDPOINTS= option.

DESCRIPTION='description'

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 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 "description" portion of the Results window.

  • the catalog-entry properties that you can view from the Explorer window.

  • the Description field of the PROC GREPLAY window.

  • the data tip text for the entire chart area for web output (depending on the device driver you are using). See Data Tips for Web Presentations for details.

Alias: DES=
DETAIL=variable (PIE and DONUT only)

produces an 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.

DETAIL_PERCENT=BEST|NONE (PIE and DONUT only)

specifies the algorithm to use for displaying the percentage values for the detail pie slices. NONE turns off the display of the percentage values.

DETAIL_RADIUS=percent (PIE and DONUT only)

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.

DETAIL_SLICE=BEST|NONE (PIE and DONUT only)

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.

DETAIL_THRESHOLD=percent (PIE and DONUT only)

determines whether 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.

DETAIL_VALUE=BEST|NONE (PIE and DONUT only)

specifies the algorithm to use for displaying the data values for the detail pie slices. NONE turns off the display of the data values.

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 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.

DONUTPCT=percent (DONUT only)

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
DOWN=number-of-rows

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.

EXPLODE=value-list

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.

When used with subgroups, the EXPLODE= option is supported only by the ActiveX and Java devices.

Featured in: Specifying the Sum Statistic for a Pie Chart
FILL=SOLID | X

specifies the fill pattern for all slices in the chart:

SOLID S

rotates a solid fill through the color list of the current style as many times as necessary. SOLID is the default.

X

rotates a single hatch pattern through the list of colors defined in the current style. If the NOGSTYLE option is specified, it rotates the hatch pattern through the device color list as many times as necessary. If you do not specify the colors= goption, the fill skips the first color in the color list.

FILL= overrides any pattern that is specified in PATTERN statements.

By default, the outline color is the color defined by the current style, or the first color in the device's color list if the NOGSTYLE option is specified. If PATTERN statements are used to specify colors, the slice outline color matches the slice fill color.

If any PATTERN statements have been defined, the colors in the PATTERN definitions are used, in order, before the default style color rotation.

Style reference: Color attribute of the GraphData1 element.
Restriction: Partially supported by Java and ActiveX
See also: Controlling Bar Chart Patterns, Colors, and Images and PATTERN Statement
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 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 the FREQ= option to calculate percentages and frequencies based on a sum.

The statistics are not affected by applying a format to numeric-variable.

See also: Calculating Weighted Statistics
GROUP=group-variable

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 the GROUP= option is essentially the same as using a BY statement except that the GROUP= option 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.

Featured in: Grouping and Arranging Pie Charts
See also: BY Statement
HTML=variable

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 want to display when the user drills down on the area.

See also: Overview of Enhancing Web Presentations.
HTML_LEGEND=variable

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 want 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. If either subgroups or the DETAIL= option are specified, then the HTML_LEGEND= option is ignored.

Restriction: Not supported by Java and ActiveX.
See also: Overview of Enhancing Web Presentations.
INVISIBLE=value-list

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.

JSTYLE

arranges the midpoints in descending order of the statistic value and draws the slices clockwise starting at the twelve o'clock position. The JSTYLE option has the same effect as specifying both the DESCENDING and CLOCKWISE options.

LABEL=(text argument(s)) (DONUT only)

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:

'text-string'

provides the text of the label. Enclose each string in quotation marks. Separate multiple strings with blanks.

text-description-suboption

modifies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be

ANGLE=degrees

COLOR=color

FONT=font

HEIGHT=text-height <units>

JUSTIFY=LEFT | CENTER | RIGHT

ROTATE=degrees

The Java and ActiveX devices do not support all of the suboptions. See Text Description Suboptions for Donut 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
Restriction: Partially supported by Java and ActiveX
LEGEND | LEGEND=LEGEND<1...99>

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]

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.

Featured in: Subgrouping a Donut or Pie Chart
Restriction: Partially supported by Java and ActiveX
See also: LEGEND Statement.
LEVELS=number-of-midpoints|ALL

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 enable the device driver to render a larger (and more readable) graph.

The LEVELS= option is ignored if any of the following is true:

  • The chart variable is character type.

  • The MIDPOINTS= option is used.

MATCHCOLOR

uses the slice pattern color for all slice labels. MATCHCOLOR overrides the color that is specified in the CTEXT= option.

MIDPOINTS=value-list

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:

    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.

    If you omit the DISCRETE option, then numeric values are treated as continuous, which means that the following is true by default:

    • 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, then 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:

    '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.

Midpoints that represent small percentages are collected into a generic midpoint named OTHER. See the OTHER= option and the OTHERLABEL= option for more information.

Featured in: Ordering and Labeling Slices in a Pie Chart
See also: About Midpoints
MIDPOINTS=OLD

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

MISSING

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.

NAME='entry-name'

specifies the name of the GRSEG catalog entry and the name of the graphics output file, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GCHART. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique name-for example, GCHART1.

See also: About Filename Indexing
NOGROUPHEADING

suppresses the headings that are normally printed above each pie when you use the GROUP= option.

NOHEADING

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
Restriction: Not supported by Java and ActiveX
NOLEGEND

suppresses the legend that is automatically generated by the SUBGROUP= option. NOLEGEND is ignored if the SUBGROUP= option is not used.

OTHER=percent-of-total

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 might not be able to label all of the small slices.  [cautionend]

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.

OTHERCOLOR=color

specifies the color to use for the OTHER slice. If you omit the OTHERCOLOR= option, GCHART searches for a color specification in this order:

  1. the CFILL= option

  2. the COLOR= option in a PATTERN statement

  3. the COLOR= in a GOPTIONS statement

  4. the color of the current style, or, the first color in the device's color list if the NOGSTYLE option is specified

For more information, see Controlling Slice Patterns and Colors.
Style reference: Color attribute of the GraphData1 to GraphDataN element, depending on the number of slices in the pie.
OTHERLABEL='text-string'

specifies a text string up to 16 characters for the label for the OTHER slice. The default label is OTHER.

PERCENT=ARROW | INSIDE | NONE | OUTSIDE

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
PLABEL=(text argument(s))

defines the text that is displayed on the pie slice label. 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:

'text-string'

provides the text of the label. Enclose each string in quotation marks. Separate multiple strings with blanks.

text-description-suboption

modifies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be

COLOR=color

FONT=font

HEIGHT=text-height <units>

The Java and ActiveX devices do not support all of the suboptions. See Text Description Suboptions for Donut 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.
Style reference: Font Attributes of the GraphValueText element.
RADIUS=value

specifies the radius of the pie and donut in GCHART. RADIUS=n, where n is the pie radius in character cells.

SLICE=ARROW | INSIDE | NONE | OUTSIDE

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
SUBGROUP=subgroup-variable

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.

The SUBGROUP= option 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.

Featured in: Subgrouping a Donut or Pie Chart and Ordering and Labeling Slices in a Pie Chart
See also: Controlling Bar Chart Patterns, Colors, and Images and LEGEND Statement
SUMVAR=summary-variable

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
TYPE=statistic

specifies the chart statistic.

  • If the SUMVAR= option is not used, statistic can be one of the following:

    FREQ

    frequency (the default)

    PERCENT PCT

    percentage

  • If SUMVAR= is used, statistic can be one of the following:

    SUM

    sum (the default)

    MEAN

    mean

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
VALUE=ARROW | INSIDE | NONE | OUTSIDE

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 Chartn
WOUTLINE=slice-outline-width

specifies the width of the outline in pixels. WOUTLINE= affects both the slice and the subgroup outlines.

Style reference: LineThickness attribute of the GraphOutlines element.
Restriction: Not supported by Java and ActiveX

Text Description Suboptions for Donut

The LABEL= option in the DONUT statement and the PLABEL= option in the PIE statement uses text description suboptions to change the attributes of the following text string or strings that follow the suboption.

ANGLE=degrees

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).

Alias: A=degrees
Valid in: DONUT
Restriction: Not supported by Java
COLOR=color

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 color defined by the current style. It ignores the CTEXT= graphics option. See SAS/GRAPH Colors and Images for details on specifying color.

Alias: C=color
Valid in: DONUT, PIE, PIE3D
Restriction: Not supported by Java
FONT=font
F=font

specifies the font for the text string or strings. 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 Specifying Fonts in SAS/GRAPH Programs for details on specifying font. The Java and ActiveX devices do not support all fonts.

Alias: F=font
Valid in: DONUT, PIE, PIE3D
Restriction: Partially supported by Java and ActiveX
HEIGHT=text-height <units>

specifies the height of the text string or strings. 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.

Alias: H=text-height <units>
Valid in: DONUT, PIE, PIE3D
Restriction: Not supported by Java and ActiveX
JUSTIFY=LEFT | CENTER | RIGHT

specifies the alignment of the text string or strings. By default, JUSTIFY=CENTER.

Alias: J=LEFT
Restriction: Not supported by Java and ActiveX
ROTATE=degrees

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).

Valid in: DONUT
Restriction: 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:

ARROW

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 the CTEXT= option in the PIE, PIE3D, or DONUT statement. If the CTEXT= option is omitted, the arrow uses the color defined by the current style.

INSIDE

places the text inside the slice. The label overlays the slice fill patterns. This labeling method increases the radius of the pie.

NONE

suppresses the text.

OUTSIDE

places the text outside of the slice.

Slice Labeling Methods illustrates these values.

Slice Labeling Methods

[Slice Labeling Methods]

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 might overlay the statistic value.

If your pie has many slices, the labels might overlap, particularly if there are several small slices together. You can correct the overlapping labels by using any of the following options:


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.


Default patterns and outlines

Each slice in a pie or donut chart is filled with a pattern. Because the system option GSTYLE is in effect by default, the procedure will use the current style's default patterns and outlines when producing output. By default, the procedure does the following:

See About Patterns for more information on how the GCHART procedure assigns default patterns and outlines.


Controlling patterns

You can control slice patterns and their outlines in several ways.

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.

Previous Page | Next Page | Top of Page