Procedure Syntax


Requirements: At least one BLOCK, HBAR, HBAR3D, VBAR, VBAR3D, PIE, PIE3D, DONUT, or STAR statement is required.

Global statements: AXIS, FOOTNOTE, GOPTIONS, LEGEND, PATTERN, TITLE

Reminder: The procedure can include the BY, FORMAT, LABEL, and WHERE statements as well as the SAS/GRAPHNOTE statement.

Supports:

  • RUN- group processing

    Output Delivery System (ODS)

PROC GCHART <DATA= input-data-set >

  • <ANNOTATE= Annotate-data-set >

    <GOUT=< libref .> output-catalog >

    <IMAGEMAP= output-data-set >;

BLOCK chart-variable(s) </ option(s) >;

HBAR HBAR3D VBAR VBAR3D chart-variable(s) </ option(s) >;

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

STAR chart-variable(s) </ option(s) >;

PROC GCHART Statement

Identifies the data set containing the chart variables . Optionally specifies annotation and an output catalog.

Requirements: An input data set is required.

Syntax

  • PROC GCHART <DATA= input-data-set >

    • <ANNOTATE= Annotate-data-set >

      <GOUT=< libref .> output-catalog >

      <IMAGEMAP= output-data-set >;

Options

PROC GCHART statement options affect all graphs produced by the procedure.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate all graphs that are produced by the GCHART procedure. To annotate individual graphs, use ANNOTATE= in the action statement.

    See also: Chapter 24, Using Annotate Data Sets, on page 587

DATA= input-data-set

  • specifies the SAS data set that contains the variable(s) to chart. By default, the procedure uses the most recently created SAS data set.

    See also: SAS Data Sets on page 29 and About Chart Variables on page 779

GOUT=< libref .> output-catalog

  • specifies the SAS catalog in which to save the graphics output that is produced by the GCHART procedure. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary library called WORK and creates the catalog if it does not exist.

    See also: Storing Graphics Output in SAS Catalogs on page 53

IMAGEMAP= output-data-set

  • creates a temporary SAS data set that is used to generate an image map in an HTML output file. The information in the image map data set includes the shape and coordinates of the elements in the graph and drill-down URLs that have been associated with those elements. The drill-down URLs are provided by one or two variables in the input data set. These variables are identified to the GCHART procedure with the HTML= and/or HTML_LEGEND= options.

    The %IMAGEMAP macro generates the image map in the HTML output file. The macro takes two arguments, the name of the image map data set and the name or fileref of the HTML file, as shown in the following example:

     %imagemap(imgmapds, myimgmap.html); 

    Not supported by: Java, ActiveX

BLOCK Statement

Creates block charts in which the height of the blocks represents the value of the chart statistic for each category of data.

Requirements: At least one chart variable is required.

Global statements: LEGEND, PATTERN, TITLE, FOOTNOTE

Supports: Drill-down functionality

Description

The BLOCK statement specifies the variable or variables that define the categories of data to chart. This statement automatically

  • determines the midpoints

  • calculates the chart statistic for each midpoint (the default is FREQ)

  • scales the blocks according to the statistic value

  • assigns patterns and colors to the block faces and the grid; the default block pattern is solid.

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:

  • reduce the size of the character cells defined for the output device by specifying larger values for the HPOS= and VPOS= graphics options

  • decrease the size of the chart text with the HTEXT= graphics option.

See About the Graphics Output Area on page 34 for details.

Syntax

  • BLOCK chart-variable(s) </ option(s) >;

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

  • appearance options

    • 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

  • midpoint options

    • DISCRETE

      GROUP= group-variable

      LEVELS= number-of-midpoints

      MIDPOINTS= value-list

      MIDPOINTS=OLD

      MISSING

      SUBGROUP= subgroup-variable

  • statistic options

    • 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

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. The values of a chart variable used with the BLOCK statement have a maximum length of 13.

    See also: About Chart Variables on page 779

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 Chapter 6, SAS/GRAPH Colors and Images, on page 91. For a complete description of the graphics options, see Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate charts produced by the BLOCK statement.

    Note: Annotate coordinate systems 1, 2, 7, and 8 (data system coordinates) are not valid with block charts.

    See also: Chapter 24, Using Annotate Data Sets, on page 587

BLOCKMAX= max-value

  • specifies the chart statistic value of the tallest block on the chart. This option lets you produce a series of block charts using the same scale. All blocks are rescaled as if max-value were the maximum value on the chart.

    Not supported by: Java, ActiveX

CAXIS= grid-color

  • specifies the color for the midpoint grid. By default, the midpoint grid uses the foreground color (usually the first color in the colors list).

    Featured in: Example 2 on page 844

COUTLINE= block-outline-color SAME

  • outlines all blocks or all block segments and legend values in the subgroup legend (if it appears) using the specified color. SAME specifies that the outline color of a block or a block 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 you specify the PATTERN statement or the V6COMP graphics option, the default is COUTLINE=SAME.

  • 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 on page 794 and About Patterns on page 784

    Featured in: Example 2 on page 844

    Not supported by: Java (partial), ActiveX (partial)

CTEXT= text-color

  • specifies a color for all text on the chart. Text includes the values and labels for the midpoint grid, the subgroup legend, and the descriptive statistic values. 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:

    1. the CTEXT= option in a GOPTIONS statement

    2. the first color in the colors list (the default).

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

DESCRIPTION= entry-description

DES= entry-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 BLOCK 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 on page 222, and Substituting BY Line Values in a Text String on page 226. 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 Table of Contents that is generated when you use CONTENTS= on an ODS statement (see Linking to Output through a Table of Contents on page 495), assuming the GCHART output is generated while the contents page is open

    • the Description field of the PROC GREPLAY window

    • the data tip text for web output (depending on the device driver you are using). See Adding Data Tips to Web Presentations on page 568 for details.

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 grid square and block 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.

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

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

    See also: Calculating Weighted Statistics on page 783

G100

  • calculates the percentage and cumulative percentage statistics separately for each group. When you use G100, the individual percentages reflect the contribution of the midpoint to the group and total 100 percent for each group. G100 is ignored unless you also use the GROUP= option.

    By default, the individual percentages reflect the contribution of the midpoint to the entire chart and total 100 percent for the entire chart.

GROUP= group-variable

  • organizes the data according to the values of group-variable . Group-variable can be either character or numeric and is always treated as a discrete variable. The group variable can have up to 12 different values.

    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: Example 2 on page 844

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

HTML_LEGEND= 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 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

LEGEND=LEGEND<1...99>

  • assigns the specified LEGEND definition to the legend generated by the SUBGROUP= option. The LEGEND= option itself does not generate a legend.

    LEGEND= is ignored if

    • SUBGROUP= is not used.

    • the specified LEGEND definition is not in effect.

    • the NOLEGEND option is used.

    • the PATTERNID= option is set to any value other than SUBGROUP; that is, the value of PATTERNID= is BY or GROUP or MIDPOINT.

  • 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; 
  • The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 151 for more information.

    See also: SUBGROUP= on page 793 and LEGEND Statement on page 151

    Featured in: Example 2 on page 844

    Not supported by: Java (partial), ActiveX (partial)

LEVELS= number-of-midpoints

  • specifies the number of midpoints for the numeric chart variable. The range for each midpoint is calculated automatically using the algorithm described in Terrell and Scott (1985). LEVELS= is ignored if

    • the chart variable is character type.

    • the DISCRETE option is used.

    • the MIDPOINTS= option is used.

MIDPOINTS= value-list

  • specifies the midpoint values for the blocks. 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.

      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:

      • 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= on page 130 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 on page 780

    Featured in: Example 2 on page 844

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 missing values are ignored. Missing values are always valid for the group and subgroup variables.

NAME= entry-name

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

NOHEADING

  • suppresses the heading describing the type of statistic. For the Java and ActiveX devices, NOHEADING is the default. For other devices, by default the heading is printed at the top of each block chart.

    Featured in: Example 2 on page 844

    Not supported by: Java, ActiveX

NOLEGEND

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

PATTERNID=BY GROUP MIDPOINT SUBGROUP

  • specifies the way fill patterns are assigned. By default, PATTERNID=SUBGROUP. Values for PATTERNID= are as follows :

    BY

    • changes patterns each time the value of the BY variable changes. All blocks use the same pattern if the GCHART procedure does not include a BY statement.

  • GROUP

    • changes patterns every time the value of the group variable changes. All blocks in each group (row) use the same pattern, but a different pattern is used for each group.

  • MIDPOINT

    • changes patterns every time the midpoint value changes. If you use the GROUP= option, the respective midpoint patterns are repeated for each group.

  • SUBGROUP

    • changes patterns every time the value of the subgroup variable changes. The blocks must be subdivided by the SUBGROUP= option for the SUBGROUP value to have an effect. Without SUBGROUP=, all block faces have the same pattern.

  • 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 on page 794

    Featured in: Example 7 on page 856

SUBGROUP= subgroup-variable

  • divides the blocks into segments according to the values of subgroup-variable . Subgroup-variable can be either character or numeric and is always treated as a discrete variable. SUBGROUP= creates a separate segment within each block for every unique value of the subgroup variable for that midpoint.

    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 on page 151

    Featured in: Example 2 on page 844

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 height of the blocks in each square. The values of a summary variable used with the BLOCK statement have a maximum length of 8.

    When you use SUMVAR=, the TYPE= option value must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.

    Featured in: Example 1 on page 842

TYPE= statistic

  • specifies the chart statistic.

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

      FREQ

      • frequency (the default)

    • CFREQ

      • cumulative frequency

    • PERCENT PCT

      • percentage

    • CPERCENT CPCT

      • cumulative percentage

    • If SUMVAR= is used, statistic can be either:

      SUM

      • sum (the default)

    • MEAN

      • mean

  • Because you cannot specify the statistics PERCENT, CPERCENT, FREQ, or CFREQ in conjunction with the SUMVAR= option, you must use FREQ= to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. See also Calculating Weighted Statistics on page 783.

    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 on page 782

    Featured in: Example 2 on page 844

WOUTLINE= block-outline-width

  • specifies the width of the block outline in pixels.

    Not supported by: Java

Controlling Block Chart Patterns and Colors

Default patterns and outlines

In a block chart, only the front faces of the blocks display patterns. By default, the procedure

  • fills the block faces with bar/block patterns, beginning with the default fill, SOLID, and rotating it through the colors list. When the solid patterns are exhausted, the procedure selects the next default bar/block pattern and rotates it through the colors list. It continues in this fashion until all of the required patterns have been assigned.

    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.

  • outlines blocks and block segments using the first color in the colors list.

  • colors the midpoint grid with the first color in the colors list.

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

User-defined patterns

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 the description of PATTERN statement option VALUE= on page 171.

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= on page 789 option.

When patterns change

The PATTERNID= option controls when the pattern changes. By default, PATTERNID=SUBGROUP. Therefore, when you use the SUBGROUP= option to subdivide the blocks, the pattern automatically changes each time the subgroup value changes, and each subdivision of the block displays a different pattern. As a result, the number of values for the SUBGROUP= variable determines the number of block patterns on the chart. If you do not subdivide the blocks, all blocks use the same pattern.

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 the PATTERNID= option. See the PATTERNID= on page 793 option for details.

Axis color

By default, axis elements use the first color in the colors list. To change the grid color, use the CAXIS= option. To change the axis text color, use the CTEXT= option.

Controlling Block Chart Text

To control the font and size of text on the chart, use the FTEXT= and HTEXT= graphics options. See Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261 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 Example 2 on page 844.

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. Figure 29.13 on page 796 shows an example of a chart with 0 and negative statistic values.

click to expand
Figure 29.13: Block Chart with 0 and Negative Statistic Values

HBAR, HBAR3D, VBAR, and VBAR3D Statements

Create horizontal or vertical bar charts in which the length or height of the bars represents the value of the chart statistic for each category of data.

Requirements: At least one chart variable is required.

Global statements: AXIS, LEGEND, PATTERN, TITLE, FOOTNOTE

Supports: Drill-down functionality

Description

The HBAR, HBAR3D, VBAR, and VBAR3D statements specify the variable or variables that define the categories of data to chart. These statements automatically

  • determine the midpoints

  • calculate the chart statistic for each midpoint (the default is FREQ)

  • scale the response axis and the bars according to the statistic value

  • determine bar width and spacing

  • assign patterns to the bars; the default bar/block pattern is SOLID.

  • draw a frame around the axis area using the first color in the colors list.

You can use statement options to select or order the midpoints (bars), to control the tick marks on the response axis, to change the type of chart statistic, to display specific statistics, and to modify the appearance of the chart. You can also specify additional variables by which to group, subgroup, or sum the data.

All bar charts allow grouping, which uses an additional category to organize the bars into groups, and subgrouping, which divides the bars into segments.

In addition, you can:

  • use global statements to modify the axes (including requesting a logarithmic axis), the bar patterns, and the legend. See Chapter 7, SAS/GRAPH Statements, on page 121 for more information.

  • add titles, footnotes, and notes to the chart. See TITLE, FOOTNOTE, and NOTE Statements on page 210 for more information.

  • use an Annotate data set to enhance the chart. See Chapter 24, Using Annotate Data Sets, on page 587 for more information.

  • display an image in the background of the chart. For HBAR3D and VBAR3D charts, see the IFRAME= option on page 806. For HBAR and VBAR charts, see the IBACK= goption IBACK on page 317.

  • display images in the bars of an HBAR or VBAR chart. See the PATTERN statement IMAGE= option on page 171.

Syntax

  • HBAR HBAR3D VBAR VBAR3D chart-variable(s) </ option(s) >;

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

  • appearance options

    • ANNOTATE= Annotate-data-set

      CAUTOREF= reference-line-color

      CAXIS= axis-color

      CERROR= error-bar-color

      CFRAME= background-color

      COUTLINE= bar-outline-color SAME

      CREF= reference-line-color ( reference-line-color ) reference-line-color-list

      CTEXT= text-color

      FRAME NOFRAME

      GSPACE= group-spacing

      IFRAME= fileref external-file

      IMAGESTYLE = TILE FIT

      LAUTOREF= reference-line-type

      LEGEND=LEGEND<1...99>

      LREF= reference-line-type ( reference-line-type ) reference-line-type-list

      NOLEGEND

      PATTERNID=BY GROUP MIDPOINT SUBGROUP

      SHAPE= 3D-bar-shape (HBAR3D and VBAR3D only)

      SPACE= bar-spacing

      WIDTH= bar-width

      WOUTLINE= bar-outline-width

  • statistic options

    • CFREQ

      CFREQLABEL= column-label NONE (HBAR and HBAR3D only)

      CLM= confidence-level

      CPERCENT

      CPERCENTLABEL= column-label NONE (HBAR and HBAR3D only)

      ERRORBAR=BARS BOTH TOP

      FREQ

      FREQLABEL= column-label NONE (HBAR and HBAR3D only)

      FREQ= numeric-variable

      G100

      INSIDE= statistic

      MEAN

      MEANLABEL= column-label NONE (HBAR and HBAR3D only)

      NOSTATS (HBAR and HBAR3D only)

      OUTSIDE= statistic

      PERCENT

      PERCENTLABEL= column-label NONE (HBAR and HBAR3D only)

      SUM

      SUMLABEL= column-label NONE (HBAR and HBAR3D only)

      SUMVAR= summary-variable

      TYPE= statistic

  • midpoint options

    • DISCRETE

      GROUP= group-variable

      LEVELS= number-of-midpoints ALL

      MIDPOINTS= value-list

      MIDPOINTS=OLD

      MISSING

      RANGE

      SUBGROUP= subgroup-variable

  • axes options

    • ASCENDING

      AUTOREF

      AXIS=AXIS<1...99>

      CLIPREF

      DESCENDING

      FRONTREF (HBAR3D and VBAR3D only)

      GAXIS=AXIS<1...99>

      MAXIS=AXIS<1...99>

      MINOR= number-of-minor- ticks

      NOAXIS

      NOBASEREF

      NOZERO

      RANGE

      RAXIS= value-list AXIS<1...99>

      REF= value-list

  • catalog entry description options

    • DESCRIPTION= entry-description

      NAME= entry-name

  • ODS options

    • HTML= variable

      HTML_LEGEND= variable

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. Multiple chart variables must be separated with blanks.

    See also: About Chart Variables on page 779

Options

Options in an HBAR, HBAR3D, VBAR, or VBAR3D 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 Chapter 6, SAS/GRAPH Colors and Images, on page 91. For details on specifying images, see Specifying Images in SAS/GRAPH Programs on page 106. For a complete description of the graphics options, see Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate charts produced by the bar chart statement.

    See also: Chapter 24, Using Annotate Data Sets, on page 587

ASCENDING

  • arranges the bars in ascending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. ASCENDING reorders the bars from shortest to longest. In horizontal bar charts the ordering is top to bottom; in vertical bar charts the ordering is left to right.

    If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoints may be different for each group.

    ASCENDING overrides any midpoint order specified with the MIDPOINTS= option or specified in the ORDER= option in an AXIS statement assigned to the midpoint axis.

AUTOREF

  • draws a reference line at each major tick mark on the response axis. To draw reference lines at specific points on the response axis, use the REF= option.

    By default, reference lines in 2D bar charts are drawn in front of the bars. To draw reference lines behind the bars, use the CLIPREF option.

    By default, reference lines in 3D bar charts are drawn on the back plane of the axis. To draw reference lines in front of the bars, use the FRONTREF option.

    Featured in: Example 5 on page 850

AXIS=AXIS<1...99>

  • See RAXIS= on page 812.

CAUTOREF= reference-line-color

  • specifies the color of reference lines drawn at major tick marks, as determined by the AUTOREF option. The default color is either the value of the CAXIS= option or the first color in the color list. To specify a line type for these reference lines, use the LAUTOREF= option.

CAXIS= axis-color

  • specifies a color for the response and midpoint axis lines and for the default axis area frame. If you omit the CAXIS= option, PROC GCHART searches for a color specification in this order:

    1. the COLOR= option in AXIS definitions

    2. the first color in the colors list (the default).

  • This option also specifies the default color for all reference lines.

CERROR= error-bar-color

  • specifies the color of error bars in bar charts. The default is the color of the response axis, which is controlled by the CAXIS= option.

CFRAME= background-color

CFR= background-color

  • specifies the color with which to fill the axis area in 2D bar charts or in the backplane in 3D bar charts.

    The axis area color does not affect the frame color, which is always the same as the midpoint axis line color and controlled by the CAXIS= option. By default, the axis area in 2D bar charts is not filled.

    CFRAME= is overridden by the NOFRAME and IFRAME= options.

    Note: If the background color, the bar color, and the outline color are the same, you may not be able to distinguish the bars.

    Featured in: Example 4 on page 848

CFREQ

  • displays the cumulative frequency statistic in the table of statistics and above vertical bars. Default statistics are suppressed when you request specific statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ option is specified.

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

CFREQLABEL= column-label NONE (HBAR and HBAR3D only)

  • specifies the text of the column label for the CFREQ statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify CFREQLABEL=NONE.

    Not supported by: Java, ActiveX

CLIPREF

  • clips the reference lines at the bars. This makes the reference lines appear to be behind the bars. Because CLIPREF is the default for 3D bar charts, it affects only 2D charts.

    Featured in: Example 5 on page 850

CLM= confidence-level

  • specifies the confidence intervals to use when drawing error bars on a bar chart. Values for confidence-level must be greater than or equal to 50 and strictly less than 100. The default is 95. See ERRORBAR= for details on how error bars are computed and drawn.

    Featured in: Example 6 on page 854

COUTLINE= bar-outline-color SAME

  • outlines all bars or bar segments and legend values in the subgroup legend (if it appears) using the specified color. SAME specifies that the outline color of a bar or a bar 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 you specify the PATTERN statement or the V6COMP graphics option, the default is COUTLINE=SAME.

  • Note: For 2D bar charts, 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.

    COUTLINE= is not valid when SHAPE=CYLINDER.

    See also: Controlling Bar Chart Patterns, Colors, and Images on page 816 and About Patterns on page 784

    Featured in: Example 3 on page 846, Example 5 on page 850 and Example 6 on page 854

CPERCENT

CPCT

  • displays the cumulative percentage statistic in the table of statistics and above vertical bars. Default statistics are suppressed when you request specific statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, or PERCENT option is specified.

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

CREF= reference-line-color ( reference-line-color ) reference-line-color-list

CR= reference-line-color ( reference-line-color ) reference-line-color-list

  • specifies colors for reference lines. Specifying a single color without parentheses applies that color to all reference lines, including lines drawn with the AUTOREF and REF= options. Note that the CAUTOREF= option overrides CREF= reference color for reference lines drawn with the AUTOREF option. Specifying a single color in parentheses applies that color only to the first reference line drawn with the REF= option. Specifying a reference color list applies colors in sequence to successive lines drawn with the REF= option. The syntax of the color list is of the form ( color1 color2 colorN ) or ( color1 , color2 , colorN ). The default color for reference lines is either the value of the CAXIS= option or the first color in the color list. To specify line types for these reference lines, use the LREF= option.

CPERCENTLABEL= column-label NONE (HBAR and HBAR3D only)

  • specifies the text of the column label for the CPERCENT statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify CPERCENTLABEL=NONE.

    Not supported by: Java, ActiveX

CTEXT= text-color

  • specifies the color of all text on the chart that is not otherwise assigned a color. Text includes axis values and axis labels in the response, midpoint, and group axes; the subgroup legend; and the displayed statistics. 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:

    1. the CTEXT= option in a GOPTIONS statement

    2. the first color in the colors list (the default).

  • CTEXT= overrides the color specification for the axis label and the tick mark values in the COLOR= option in an AXIS definition assigned to an axis.

    CTEXT= is overridden by

    • the COLOR= suboption of the LABEL= or VALUE= option in a LEGEND definition assigned to the subgroup legend. In this case the suboption determines the color of the legend label or the color of the legend value descriptions, respectively.

    • the COLOR= suboption of a LABEL= or VALUE= option in an AXIS definition assigned to an axis. In this case the suboption determines the color of the axis label or the color of the tick mark values, respectively.

DESCENDING

  • arranges the bars in descending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. DESCENDING reorders the bars from longest to shortest. In horizontal bar charts the ordering is top to bottom; in vertical bar charts the ordering is left to right. If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoints may be different for each group.

    DESCENDING overrides any midpoint order that is specified with the MIDPOINTS= option or that is specified in the ORDER= option in an AXIS statement assigned to the midpoint axis.

DESCRIPTION= entry-description

DES= entry-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 HBAR 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 on page 222, and Substituting BY Line Values in a Text String on page 226. 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 Table of Contents that is generated when you use CONTENTS= on an ODS statement (see Linking to Output through a Table of Contents on page 495), assuming the GCHART output is generated while the contents page is open

    • the Description field of the PROC GREPLAY window

    • the data tip text for web output (depending on the device driver you are using). See Adding Data Tips to Web Presentations on page 568 for details.

  • Featured in: Example 7 on page 856

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 bar 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. The ORDER= option in an AXIS statement that is assigned to the midpoint axis can rearrange or exclude discrete midpoint values.

    Featured in: Example 7 on page 856

ERRORBAR=BARS BOTH TOP

  • draws confidence intervals on a horizontal or vertical bar chart for either of the following:

    • the mean of the SUMVAR= variable for each midpoint if you specify TYPE=MEAN

    • the percentage of observations assigned to each midpoint if you specify TYPE=PCT with no SUMVAR= option.

  • The ERRORBAR= option cannot be used with values of the TYPE= option other than MEAN or PCT. Valid values for ERRORBAR= are:

    BARS

    • draws error bars as bars half the width of the main bars.

  • BOTH

    • draws error bars as two ticks joined by a line (default).

  • TOP

    • draws the error bar as a tick for the upper confidence limit that is joined to the top of the bar by a line.

  • By default, ERRORBAR= uses a confidence level of 95 percent. You can specify different confidence levels with the CLM= option.

    When you use ERRORBAR= with TYPE=PCT, the confidence interval is based on a normal approximation . Let TOTAL be the total number of observations, and PCT be the percentage assigned to a given midpoint. The standard error of the percentage is approximated as

     APSTDERR=100 * SQRT((PCT/100) * (1--(PCT/100)) / TOTAL); 

    Let LEVEL be the confidence level specified using the CLM= option, with a default value of 95. The upper confidence limit for the percentage is computed as

     UCLP = PCT + APSTDERR * PROBIT( 1-(1-LEVEL/100)/2 ); 

    The lower confidence limit for the percentage is computed as

     LCLP = PCT - APSTDERR * PROBIT( 1-(1-LEVEL/100)/2 ); 

    When you use ERRORBAR= with TYPE=MEAN, the sum variable must have at least two non-missing values for each midpoint. If the GROUP= option is used, each midpoint within a group must also have two non-missing values. Let N be the number of observations assigned to a midpoint, MEAN be the mean of those observations, and STD be the standard deviation of the observations. The standard error of the mean is computed as

     STDERR = STD / SQRT(N); 

    Let LEVEL be the confidence level specified using the CLM= option, with a default value of 95. The upper confidence limit for the mean is computed as

     UCLM = MEAN + STDERR * TINV( 1-(1-LEVEL/100)/2, N-1); 

    The lower confidence limit for the mean is computed as

     LCLM = MEAN - STDERR * TINV( 1-(1-LEVEL/100)/2, N-1); 

    If you want the error bars to represent a given number C of standard errors instead of a confidence interval, and if the number of observations assigned to each midpoint is the same, then you can find the appropriate value for the CLM= option by running a DATA step. For example, if you want error bars that represent one standard error (C=1) with a sample size of N , you can run the following DATA step to compute the appropriate value for the CLM= option and assign that value to a macro variable &LEVEL:

     data null;  c = 1;  n = 10;  level = 100 * (1 - 2 * (1 - probt( c, n-1)));  put all;  call symput('level',put(level,best12.));  run; 

    Then when you run the GCHART procedure, you can specify CLM=&LEVEL.

    Note that this trick does not work precisely if different midpoints have different numbers of observations. However, choosing an average value for N may yield sufficiently accurate results for graphical purposes if the sample sizes are large or do not vary much.

    Featured in: Example 6 on page 854

FRAME NOFRAME

FR NOFR

  • specifies whether the 2D axis area frame or the 3D backplane is drawn. The default is FRAME, which draws a frame around the axis area (in 2D bar charts) or generates a colored 3D backplane (in 3D bar charts). Specifying NOFRAME removes the axis area frame from 2D charts, including any background color or image. For 3D charts, NOFRAME removes the backplane color or image, and leaves the vertical and horizontal axis planes and axes. To remove these planes, use the NOPLANE option in the AXIS statement. To remove one or more axis elements, use either the AXIS statement or the NOAXIS option.

    The NOFRAME option overrides the CFRAME= and IFRAME= options and the IBACK= goption IBACK on page 317.

    The color of the frame or backplane outline is the color of the midpoint axis, which is determined by the CAXIS= option.

    If the V6COMP graphics option is in effect, the default is NOFRAME.

    Featured in: Example 7 on page 856 and Example 6 on page 854

FREQ

  • displays the frequency statistic in the table of statistics and above vertical bars. Non-integer values are rounded down to the nearest integer. Default statistics are suppressed when you request specific statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values. This option overrides the CFREQ, PERCENT, CPERCENT, SUM, and MEAN options.

    Featured in: Example 5 on page 850

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

FREQLABEL= column-label NONE (HBAR and HBAR3D only)

  • specifies the text of the column label for the FREQ statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify FREQLABEL=NONE.

    Featured in: Example 5 on page 850 and Example 6 on page 854

    Not supported by: Java, ActiveX

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 that is 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, TYPE=CPERCENT, TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use FREQ= to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum.

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

    See also: Calculating Weighted Statistics on page 783

FRONTREF

  • specifies that reference lines drawn by the AUTOREF or REF= options should be drawn in front of the bars. By default, reference lines in 3D bar charts are drawn on the back plane of the axis.

G100

  • calculates the percentage and cumulative percentage statistics separately for each group. When you use G100, the individual percentages reflect the contribution of the midpoint to the group and total 100 percent for each group. G100 is ignored unless you also use the GROUP= option.

    By default, the individual percentages reflect the contribution of the midpoint to the entire chart and total 100 percent for the entire chart.

GAXIS=AXIS<1...99>

  • assigns the specified AXIS definition to the group axis. (A group axis is created when you use the GROUP= option.) You can use the AXIS definition to modify the order of the groups, the text of the labels, and appearance of the axis. GAXIS= is ignored if the specified AXIS definition does not exist.

    The AXIS statement options MAJOR= and MINOR= are ignored in AXIS definitions assigned to the group axis because the axis does not use tick marks. A warning message is written to the SAS log if these options appear in the AXIS definition.

    The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 124 for more information.

    To remove groups from the chart, use the ORDER= option in the AXIS statement.

    To suppress the brackets drawn around the values on the group axis in vertical bar charts, use the NOBRACKETS option in the AXIS statement.

    See also: AXIS Statement on page 124

    Featured in: Example 7 on page 856

    Not supported by: Java (partial), ActiveX (partial)

GROUP= group-variable

  • organizes the data according to values of group-variable . Group-variable can be either character or numeric and is always treated as a discrete variable.

    GROUP= produces a separate group of bars for each unique value of the group variable. Missing values for group-variable are treated as a valid group. The groups are arranged in ascending order of the group variable values.

    By default, each group includes all midpoints, even if no observations for the group fall within the midpoint range, meaning that no bar is drawn at the midpoint. Use the NOZERO option to suppress midpoints with no observations.

    GROUP= also produces a group axis that lists the values that distinguish the groups. The group axis has no axis line but displays the group variable name or label. To modify the group axis, assign an AXIS definition with the GAXIS= option.

    In horizontal bar charts, the group axis is to the left of the midpoint axis and the groups are arranged from top to bottom, starting with the lowest value at the top.

    In vertical bar charts, the group axis is below the midpoint axis and the groups are arranged from left to right starting with the lowest value at the left. If the group label in a vertical bar chart is narrower than all the bars in the group, brackets are added to the label to emphasize which bars belong in each group. Group brackets are not displayed if the space between the group values is less than one and one-half character cells. Use the NOBRACKETS option in the AXIS statement to suppress the group brackets.

    Featured in: Example 7 on page 856

GSPACE= group-spacing

  • specifies the amount of extra space between groups of bars. Group-space can be any non-negative number. Units are character cells. Use GSPACE=0 to leave no extra space between adjacent groups of bars. In this case, the same space appears between groups of bars as between the bars in the same group.

    GSPACE= is ignored unless you also use the GROUP= option. By default, the GCHART procedure calculates group spacing based on size of the axis area and the number of bars in the chart.

    If the requested spacing results in a chart that is too large to fit in the space available for the midpoint axis, an error message is written to the SAS log and no chart is produced.

    Featured in: Example 7 on page 856

HTML= 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 an area of the chart and point to the data or graph 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.

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

IFRAME= fileref external-file

  • identifies the image file you wish to fill the backplane frame of your three-dimensional bar charts. See also the IMAGESTYLE= option and Placing a Backplane Image on Graphs with Frames on page 115.

    This option is overridden by the NOIMAGEPRINT goption IMAGEPRINT on page 318.

    To fill the backplane frame of two-dimensional bar charts, see the IBACK= goption IBACK on page 317.

    Not supported by: Java

IMAGESTYLE= TILE FIT

  • for three-dimensional bar charts, specifies whether to use multiple instances of an image to fill the backplane frame (TILE) or to stretch a single instance of an image to fill the backplane frame (FIT). The TILE value is the default. See also the IFRAME= option. Java supports only TILE.

    Not supported by: Java (partial)

INSIDE= statistic

  • displays the values of the specified statistic inside the bars. For the Java and ActiveX devices, this option is valid for both horizontal and vertical bar charts. For other devices, this option is only valid for vertical bar charts.

    Statistic can be one of the following:

    • FREQ

    • CFREQ

    • CPERCENT CPCT

    • MEAN

    • PERCENT PCT

    • SUM

  • If the bars are subgrouped, only the following statistics are valid:

    • FREQ

    • PERCENT PCT

    • SUBPCT

    • SUM

  • With subgroups, PERCENT displays the percent contribution of each subgroup to the midpoint value of the bar, based on frequency. The PERCENT values for each subgroup total the percent contribution of the bar to the whole. For example, if the percent contribution of the whole bar is 60%, the PERCENT statistic for all the subgroups in that bar will total 60%. To calculate PERCENT based on the SUMVAR= variable, use the FREQ= and TYPE= options. For details, see Calculating Weighted Statistics on page 783.

    SUBPCT displays the percent contribution of each subgroup to the total bar. The SUBPCT values for each subgroup total the percent contribution to the whole bar. Because of rounding, the total of the percents may not equal 100.

    Featured in: Example 4 on page 848 Example 7 on page 856

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

LAUTOREF= reference-line-type

  • specifies the line type for reference lines at major tick marks, as determined by the AUTOREF option. Line types are specified as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. The default value is 1. To specify a color for these reference lines, use the CAUTOREF= option.

LEGEND=LEGEND<1 99>

  • assigns the specified LEGEND definition to the legend generated by the SUBGROUP= option. The LEGEND= option itself does not generate a legend.

    LEGEND= is ignored if

    • SUBGROUP= is not used.

    • the specified LEGEND definition is not in effect.

    • the NOLEGEND option is used.

    • the PATTERNID= option is set to any value other than SUBGROUP; that is, the value of PATTERNID= is BY or GROUP or MIDPOINT.

  • To create a legend based on the chart midpoints instead of the subgroups, use the chart variable as the subgroup variable:

     hbar city / subgroup=city; 

    The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 151 for more information.

    See also: LEGEND Statement on page 151 and SUBGROUP= on page 813 option

    Featured in: Example 4 on page 848

LEVELS= number-of-midpoints ALL

  • specifies the number of midpoints for a numeric chart variable. The range for each midpoint is calculated automatically, using the algorithm in Terrell and Scott (1985).

    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.

    LEVELS= is ignored if

    • the chart variable is character type

    • the DISCRETE option is used

    • the MIDPOINTS= option is used.

LREF= reference-line-type ( reference-line-type reference-line-type-list )

LR= reference-line-type ( reference-line-type reference-line-type-list )

  • specifies line types for reference lines. Line types are specified as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. Specifying a line type without parentheses applies that type to all reference lines drawn with the AUTOREF and REF= options. Note that the LAUTOREF= option overrides LREF= reference-line-type for reference lines drawn with the AUTOREF option. Specifying a single line type in parentheses applies that line type to the first reference line drawn with the REF= option. Specifying a line type list applies line types in sequence to successive reference lines drawn with the REF= option. The syntax of the line-type list is of the form ( type1 type2 typeN ). The default line type is specified by the AXIS statement's STYLE= option. By default, STYLE=1, a solid line. To specify colors for these reference lines, use the CREF= option.

    Not supported by: Java

MAXIS=AXIS<1 99>

  • assigns the specified AXIS definition to the midpoint axis. The MAXIS= option is ignored if the specified AXIS definition does not exist.

    The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 124 for more information.

    See also: AXIS Statement on page 124 and About Midpoints on page 780

    Featured in: Example 4 on page 848

    Not supported by: Java (partial), ActiveX (partial)

MEAN

  • displays the mean statistic in the table of statistics and above vertical bars. By default, the column heading in the table includes the name of the variable for which the mean is calculated. Default statistics are suppressed when you request specific statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, CPERCENT, or SUM option is specified. MEAN is ignored unless you also use the SUMVAR= option.

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

MEANLABEL= column-label NONE (HBAR and HBAR3D only)

  • specifies the text of the column label for the MEAN statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify MEANLABEL=NONE.

    Featured in: Example 6 on page 854

    Not supported by: Java, ActiveX

MIDPOINTS= value-list

  • specifies the midpoint values for the bars. The way you specify value-list depends on the type of the chart 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.

      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:

      • 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= on page 130 option in the AXIS statement.

    If the 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, this problem can be corrected by either adjusting the size of the text with the HTEXT= graphics option or by increasing the number of cells in your graphics display using the HPOS= and VPOS= graphics options.

    The ORDER= option in the AXIS statement overrides the order specified in the MIDPOINTS= option. The bar chart statement options ASCENDING and DESCENDING also override both MIDPOINTS= and ORDER= in the AXIS statement.

    See also: About Midpoints on page 780

    Featured in: Example 5 on page 850

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.

MINOR= number-of-minor-ticks

  • specifies the number of minor tick marks between each major tick mark on the response axis.

    MINOR= in a bar chart statement overrides the number of minor tick marks specified in the MINOR= option in an AXIS definition assigned to the response axis with the RAXIS= option.

MISSING

  • accepts a missing value as a valid midpoint for the chart variable. By default, observations with missing values are ignored. Missing values are always valid for group and subgroup variables.

NAME= entry-name

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

    Featured in: Example 7 on page 856

NOAXIS

  • suppresses all axes, including axis lines, axis labels, axis values, and all major and minor tick marks. If you specify an axis definition with the GAXIS, MAXIS=, or RAXIS= options, then the axes are generated as defined in the AXIS statement, but then all lines, labels, values, and tick marks are suppressed. Therefore, axis statement options such as ORDER=, LENGTH, and OFFSET= will still be used.

    To remove only selected axis elements such as lines, values or labels, use specific AXIS statement options.

    NOAXIS does not suppress either the default frame or an axis area fill requested by the CFRAME= option. To remove the axis frame or the 3D backplane, use the NOFRAME option in the procedure. To remove the horizontal or vertical axis planes, use the NOPLANE option in the AXIS statement.

NOBASEREF

  • suppresses the zero reference line when the SUM or MEAN chart statistic has negative values.

NOLEGEND

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

NOSTATS (HBAR and HBAR3D only)

  • suppresses the table of statistics. NOSTATS suppresses both the default statistics and specific statistics requested by the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options.

    Not supported by: Java

NOZERO

  • suppresses any midpoints for which there are no corresponding values of the chart variable and, hence, no bar. NOZERO usually is used with the GROUP= option to suppress midpoints when not all values of the chart variable are present for every group or if the chart statistic for the bar is 0.

    Note: If a bar is omitted and if you have also specified bar labels with the VALUE= option in an AXIS statement, the labels may be shifted and not displayed with the correct bar.

    Featured in: Example 7 on page 856

    Not supported by: Java

OUTSIDE= statistic

  • displays the values of the specified statistic above the bars. For the Java and ActiveX devices, this option is valid for both horizontal and vertical bar charts. For other devices, this option is only valid for vertical bar charts.

    Statistic can be one of the following:

    • FREQ

    • CFREQ

    • PERCENT PCT

    • CPERCENT CPCT

    • SUM

    • MEAN

  • Featured in: Example 4 on page 848 and Example 7 on page 856

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

PATTERNID=BY GROUP MIDPOINT SUBGROUP

  • specifies the way fill patterns are assigned. By default, PATTERNID=SUBGROUP. Values for PATTERNID= are as follows:

    BY

    • changes patterns each time the value of the BY variable changes. All bars use the same pattern if the GCHART procedure does not include a BY statement.

  • GROUP

    • changes patterns every time the value of the group variable changes. All bars in each group use the same pattern, but a different pattern is used for each group.

  • MIDPOINT

    • changes patterns every time the midpoint value changes. If you use the GROUP= option, the respective midpoint patterns are repeated for each group.

  • SUBGROUP

    • changes patterns every time the value of the subgroup variable changes. The bars must be subdivided by the SUBGROUP= option for the SUBGROUP value to have an effect. Without SUBGROUP=, all bars have the same pattern.

  • Note: If you use the SUBGROUP= option and specify a PATTERNID= value other than SUBGROUP, the bar segments use the same pattern and are indistinguishable.

    See also: Controlling Bar Chart Patterns, Colors, and Images on page 816

    Featured in: Example 4 on page 848 and Example 7 on page 856

PERCENT

PCT

  • prints the percentages of observations having a given value for the chart variable in the table of statistics and above vertical bars. Default statistics are suppressed when you request specific statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ or CFREQ option is specified.

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

PERCENTLABEL= column-label NONE (HBAR and HBAR3D only)

  • specifies the text of the column label for the PERCENT statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify PERCENTLABEL=NONE.

    Not supported by: Java, ActiveX

RANGE

  • displays on the axis of the chart the range of numeric values represented by each bar. In the graphics output, the starting value of each range is indicated with the less-than symbol (<), and the ending value is indicated with the greater-than-or-equal-to symbol (>=). The RANGE option has no affect on axes that represent character data. By default, the values shown on the axis are determined by the value of the MIDPOINTS= option on page 809. If specified, the DISCRETE option on page 802 overrides the RANGE option.

RAXIS= value-list AXIS<1...99>

AXIS= value-list AXIS<1...99>

  • specifies values for the major tick mark divisions on the response axis or assigns the specified AXIS definition to the axis. See the MIDPOINTS= option on page 809 for a description of value-list . By default, the GCHART procedure scales the response axis automatically and provides an appropriate number of tick marks.

    You can specify negative values, but negative values are reasonable only when TYPE=SUM or TYPE=MEAN and one or more of the sums or means are less than 0. Frequency and percentage values are never less than 0.

    For lists of values, a separate major tick mark is created for each individual value. A warning message is written to the SAS log if the values are not evenly spaced .

    If the values represented by the bars are larger than the highest tick mark value, the bars are truncated at the highest tick mark.

    If you use a BY statement with the PROC GCHART statement, the same response axes are produced for each BY group when RAXIS= value-list is used or if there is an ORDER= list in the AXIS statement assigned to the response axis.

    The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 124 for more information.

    See also: AXIS Statement on page 124

    Featured in: Example 4 on page 848 and Example 7 on page 856

    Not supported by: Java (partial), ActiveX (partial)

REF= value-list

  • draws reference lines at the specified points on the response axis. See the MIDPOINTS= option on page 809 for a description of value-list .

    Values can be listed in any order, but should be within the range of values represented by the response axis. A warning is written to the SAS log if any of the points are off of the axis, and no reference line is drawn for such points. You can use the AUTOREF option to draw reference lines automatically at all of the major tick marks.

    By default, reference lines in 3D bar charts are drawn on the back plane of the axis. To draw the reference lines in front of the bars, use the FRONTREF option.

SHAPE= 3D-bar-shape (HBAR3D and VBAR3D only)

  • specifies the shape of the bars in charts that are produced with the HBAR3D and VBAR3D statements. 3D-bar-shape can be one of the following:

    • BLOCK B (the default)

    • CYLINDER C

    • HEXAGON H

    • PRISM P

    • STAR S

  • The COUTLINE= option is not valid when SHAPE=CYLINDER.

  • Featured in: Example 7 on page 856

SPACE= bar-spacing

  • specifies the amount of space between individual bars or between the bars within each group if you also use the GROUP= option. Bar-space can be any non-negative number, including decimal values. Units are character cells. By default, the GCHART procedure calculates spacing based on the size of the axis area and the number of bars on the chart. Use SPACE=0 to leave no space between adjacent bars.

    SPACE= is ignored if

    • you specify the WIDTH= option and are using the Java or ActiveX devices.

    • the specified spacing requests a chart that is too large to fit in the space available for the midpoint axis. In this case, a warning message is issued.

  • Featured in: Example 4 on page 848 and Example 7 on page 856

SUBGROUP= subgroup-variable

  • divides the bars into segments according to the values of subgroup-variable . Subgroup-variable can be either character or numeric and is always treated as a discrete variable. SUBGROUP= creates a separate segment within each bar for every unique value of the subgroup variable for that midpoint.

    If PATTERNID=SUBGROUP (the default setting), each segment is filled with a different pattern and a legend that provides 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 on page 151

    Featured in: Example 4 on page 848, Example 7 on page 856 and Example 5 on page 850

SUM

  • displays the sum statistic in the table of statistics and above vertical bars. By default, the column heading in the table includes the name of the variable for which the sum is calculated. Default statistics are suppressed when you request specific statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, or CPERCENT option is specified. SUM is ignored unless you also use the SUMVAR= option.

    See also: About Chart Statistics on page 782, Displaying Statistics in Horizontal Bar Charts on page 815, and Displaying Statistics in Vertical Bar Charts on page 815

SUMLABEL= column-label NONE (HBAR and HBAR3D only)

  • specifies the text of the column label for the SUM statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify SUMLABEL=NONE.

    Not supported by: Java, ActiveX

SUMVAR= summary-variable

  • specifies a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of summary-variable for each midpoint. The resulting statistics are represented by the length of the bars along the response axis, and they are displayed at major tick marks.

    When you use SUMVAR=, the TYPE= option must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.

    Featured in: Example 3 on page 846 and Example 6 on page 854

TYPE= statistic

  • specifies the chart statistic.

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

      FREQ

      • frequency (the default)

    • CFREQ

      • cumulative frequency

    • PERCENT PCT

      • percentage

    • CPERCENT CPCT

      • cumulative percentage

    • If SUMVAR= is used, statistic can be:

      SUM

      • sum (the default)

    • MEAN

      • mean

  • Because you cannot use TYPE=FREQ, TYPE=CFREQ, TYPE=PERCENT, or TYPE=CPERCENT with the SUMVAR= option, you must use FREQ= to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. See also Calculating Weighted Statistics on page 783.

    If you specify TYPE=MEAN and use the SUBGROUP= option, the height or length of the bar represents the mean for the entire midpoint. The subgroup segments are proportional to the subgroup's contribution to the sum for the bar. See also SUBGROUP= on page 813.

    See also: About Chart Statistics on page 782 for a complete description of statistic types

    Featured in: Example 6 on page 854

WIDTH= bar-width

  • specifies the width of the bars. By default, the GCHART procedure selects a bar width that accommodates the midpoint values displayed on the midpoint axis using a hardware font and a height of one cell . Units for bar-width are character cells. The value for bar-width must be greater than 0, but it does not have to be an integer, for example,

     vbar site / width=1.5; 

    If the requested bar width results in a chart that is too large to fit in the space available for the midpoint axis, the procedure issues a warning in the log and ignores the WIDTH= specification. If the specified width is too narrow, the procedure may display the midpoint values vertically.

    Featured in: Example 4 on page 848

WOUTLINE= bar-outline-width

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

    Not supported by: Java

The Chart Statistic and the Response Axis

In bar charts, the scale of values of the chart statistic is displayed on the response axis. By default, the response axis is divided into evenly spaced intervals identified with major tick marks that are labeled with the corresponding statistic value. Minor tick marks are evenly distributed between the major tick marks unless a log axis has been requested. For sum and mean statistics, the major tick marks are labeled with values of the SUMVAR= variable (formatted if the variable has an associated format). The response axis is also labeled with the statistic type.

Specifying Logarithmic Axes

Logarithmic axes can be specified with the AXIS statement. See AXIS Statement on page 124 for a complete discussion.

Displaying Statistics in Horizontal Bar Charts

For graphs generated with the Java and ActiveX devices, default statistics are not generated, but you can display one statistic at the end of each bar. To specify the statistic, specify the FREQ, CFREQ, PERCENT, CPERCENT, SUM, or MEAN option.

For graphs generated with other devices, the HBAR and HBAR3D statements print a table of statistic values to the right of the bars. When the value of TYPE= is FREQ, CFREQ, PERCENT, or CPERCENT, the frequency, cumulative frequency, percentage, and cumulative percentage statistics are printed next to the bars by default. When TYPE=SUM, the frequency and sum statistic values are printed by default. When TYPE=MEAN, the frequency and mean statistic values are printed by default. However, if you use the FREQ, CFREQ, PERCENT, CPERCENT, SUM, or MEAN options to request specific statistics, the default statistics are not printed.

For sum and mean, the name of the SUMVAR= variable is added to the heading for the column of values.

Specifying the Table of Statistics

You can use the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options to select only certain statistics. Without the SUMVAR= option, only the frequency, cumulative frequency, percentage, and cumulative percentage statistics can be printed. With SUMVAR=, all statistics, including the sum and mean, can be printed. You can suppress all statistics with the NOSTATS option.

To change the column labels for any statistic in the table, use one or more of the statistic column label options: FREQLABEL=, CFREQLABEL=, PERCENTLABEL=, CPERCENTLABEL=, SUMLABEL=, and MEANLABEL=.

To control the font and size of the text in the table of statistics, use the HTEXT= and FTEXT= graphics options.

Displaying Statistics in Vertical Bar Charts

Statistic values on vertical bar charts are not printed by default, so you must explicitly request a statistic with the FREQ, CFREQ, PERCENT, CPERCENT, SUM, MEAN, INSIDE=, or OUTSIDE= option.

For graphs generated with the Java and ActiveX devices, you can display one statistic for each bar. For graphs generated with other devices, you can display up to two statistics. Statistics can be displayed either above the bars or inside the bars.

To specify a statistic that you want to display above the bars, specify the statistic option (FREQ, CFREQ, PERCENT, CPERCENT, SUM, or MEAN) or specify OUTSIDE= statistic . To specify a statistic that you want to display inside the bars, specify INSIDE= statistic .

For graphs generated with the Java and ActiveX devices, the OUTSIDE= option overrides INSIDE=, and INSIDE= overrides the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options. For graphs generated with other devices, the individual statistic options override the OUTSIDE= option.

If more than one statistic option is specified, only the highest priority statistic is displayed. The priority order, from highest to lowest, is as follows:

  1. FREQ

  2. CFREQ

  3. PERCENT

  4. CPERCENT

  5. SUM

  6. MEAN

The bars must be wide enough to accommodate the text. You can adjust the width of the bars with the WIDTH= option. To control the font and size of the text, use the HTEXT= and FTEXT= graphics options.

Ordering and Selecting Midpoints

To rearrange character or discrete numeric midpoint values or to select ranges for numeric values, use the MIDPOINTS= option. Remember that although changing the number of midpoints for numeric variables may change the range of values for individual midpoints, it does not change the range of values for the chart as a whole. For details, see About Midpoints on page 780.

Like MIDPOINTS=, the ORDER= option in the AXIS statement can rearrange the order of the midpoints or suppress the display of discrete numeric or character values. However, ORDER= cannot calculate the midpoints for a continuous numeric variable, or exclude values from the calculations. For details, see the description of the ORDER= on page 130 option.

Controlling Bar Chart Patterns, Colors, and Images

Default Patterns and Outlines

Each bar in a bar chart is filled with a pattern. By default, the procedure

  • fills the bars with bar/block patterns, beginning with the default fill, SOLID, and rotating it through the colors list. When the solid patterns are exhausted, the procedure selects the next default bar/block pattern and rotates it through the colors list. It continues in this fashion until all of the required patterns have been assigned.

    Note: 3D bar charts always uses solid patterns.

    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 bars and bar segments using the first color in the colors list.

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

User-Defined Patterns

To override the default patterns and select fills and colors for the bars or bar 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= on page 171 in PATTERN Statement on page 169.

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 (see COUTLINE= on page 800).

When Patterns Change

The PATTERNID= option controls when the pattern changes. By default, PATTERNID=SUBGROUP. Therefore, when you use the SUBGROUP= option to subdivide the bars, the pattern automatically changes each time the subgroup value changes, and each subdivision of the bar displays a different pattern. As a result, the number of values for the SUBGROUP= variable determines the number of bar patterns on the chart. If you do not subdivide the bars, all bars use the same pattern.

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= on page 811 option for details.

Axis Color

By default, axis elements use the first color in the colors list or the colors that are specified by AXIS statement color options. However, action statement options can also control the color of the axis lines, text, and frame.

To change the color of...

Use this option...

the axis text

CTEXT=

the axis lines

CAXIS=

the area within the frame

CFRAME=

Adding Images to Bar Charts

You can apply images to the bars and to the backplane frame of two-dimensional bar charts developed with the HBAR and VBAR statements. In three “dimensional bar charts, you can apply images to the backplane frame. For details, see Specifying Images in SAS/GRAPH Programs on page 106.

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

  • determine the midpoints.

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

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:

  • appearance options

    • ANNOTATE= Annotate-data-set

      CFILL= fill-color

      COUTLINE= slice-outline-color SAME

      DETAIL_RADIUS= percent (PIE and DONUT only)

      EXPLODE= value-list

      FILL=SOLID X

      INVISIBLE= value-list

      NOHEADING

      WOUTLINE= slice-outline-width

  • statistic options

    • FREQ= numeric-variable

      SUMVAR= summary-variable

      TYPE= statistic

  • midpoint options

    • DISCRETE

      LEVELS= number-of-midpoints ALL

      MIDPOINTS= value-list

      MIDPOINTS=OLD

      MISSING

      OTHER= percent-of-total

  • detail pie options (PIE and DONUT only)

    • DETAIL= variable

      DETAIL_THRESHOLD= percent

  • grouping and subgrouping options

    • ACROSS= number-of-columns

      DOWN= number-of-rows

      GROUP= group-variable

      NOGROUPHEADING

      SUBGROUP= subgroup-variable

  • slice-ordering options

    • ANGLE= degrees

      ASCENDING

      CLOCKWISE

      DESCENDING

      JSTYLE

  • slice-labeling options

    • CTEXT= text-color

      LEGEND LEGEND=LEGEND<1...99>

      MATCHCOLOR

      NOLEGEND

      OTHERLABEL= text-string

      PERCENT=ARROW INSIDE NONE OUTSIDE

      SLICE=ARROW INSIDE NONE OUTSIDE

      VALUE=ARROW INSIDE NONE OUTSIDE

  • detail pie slice-labeling options (PIE and DONUT only)

    • DETAIL_PERCENT=BESTNONE

      DETAIL_SLICE=BESTNONE

      DETAIL_VALUE=BESTNONE

  • donut-labeling options (DONUT only):

    • DONUTPCT= percent

      LABEL=( text argument(s) )

  • catalog entry description options

    • DESCRIPTION= entry-description

      NAME= entry-name

  • ODS options

    • HTML= variable

      HTML_LEGEND= variable

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 on page 779

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 Chapter 6, SAS/GRAPH Colors and Images, on page 91. For a complete description of the graphics options, see Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261.

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

    Featured in: Example 11 on page 875

ANGLE= degrees

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

ANNOTATE= Annotate-data-set

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

    See also: Chapter 24, Using Annotate Data Sets, on page 587

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

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 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 on page 816 and About Patterns on page 784

    Featured in: Example 10 on page 873

CLOCKWISE

  • 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: Example 11 on page 875

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

    See also: Controlling Slice Patterns and Colors on page 831 and About Patterns on page 784

    Featured in: Example 8 on page 869, Example 9 on page 872 and Example 11 on page 875

CTEXT= text-color

  • 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 on page 830.

    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:

    1. the CTEXT= option in a GOPTIONS statement

    2. the first color in the colors list (the default).

  • The MATCHCOLOR option overrides the CTEXT= option for slice labels.

  • Featured in: Example 9 on page 872 and Example 11 on page 875

DESCENDING

  • 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: Example 11 on page 875

DESCRIPTION= entry-description

DES= entry-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 the description of the options on page 222, and Substituting BY Line Values in a Text String on page 226. 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 Table of Contents that is generated when you use CONTENTS= on an ODS statement (see Linking to Output through a Table of Contents on page 495), assuming the GCHART output is generated while the contents page is open

    • the Description field of the PROC GREPLAY window

    • the data tip text for web output (depending on the device driver you are using). See Adding Data Tips to Web Presentations on page 568 for details.

DETAIL= variable (PIE and DONUT only)

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

DETAIL_PERCENT=BESTNONE (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=BESTNONE (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 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.

DETAIL_VALUE=BESTNONE (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: Example 9 on page 872

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= on page 826 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: Example 8 on page 869

FILL=SOLID X

  • specifies the fill pattern for all slices in the chart:

    SOLID S

    • rotates a solid fill through the colors list as many times as necessary. This is the default.

  • X

    • 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 on page 816 and PATTERN Statement on page 169

    Not supported by: Java (partial), ActiveX (partial)

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 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 on page 783

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 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 on page 141

    Featured in: Example 12 on page 877

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

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

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 on page 826 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 12 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 on page 829 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: Example 9 on page 872

    Not supported by: Java (partial), ActiveX (partial)

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.

    Specifying LEGEND=LEGEND n assigns the specified LEGEND statement to the legend. The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 151 for more information.

    See also: LEGEND Statement on page 151 and SUBGROUP= option on page 828

    Featured in: Example 9 on page 872 Example 11 on page 875

    Not supported by: Java (partial), ActiveX (partial)

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

    LEVELS= is ignored if

    • the chart variable is character type

    • the DISCRETE option is used

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

      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:

      • 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 on page 130 in the AXIS statement.

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

    See also: About Midpoints on page 780

    Featured in: Example 10 on page 873

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

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: Example 9 on page 872

    Not supported by: Java, 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 may not be able to label all of the small slices.

    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: Example 11 on page 875 and Example 12 on page 877

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 default color list.

  • For more information, see Controlling Slice Patterns and Colors on page 831.

OTHERLABEL= text-string

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

    Featured in: Example 11 on page 875

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 on page 830. 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: Example 10 on page 873 and Example 12 on page 877

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 on page 830. By default, SLICE=OUTSIDE (the name is outside of the slice).

    Featured in: Example 10 on page 873 and Example 12 on page 877

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.

    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 on page 816 and LEGEND Statement on page 151

    Featured in: Example 9 on page 872 and Example 10 on page 873

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: Example 8 on page 869

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 on page 782 and Calculating Weighted Statistics on page 783

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 on page 830. By default, VALUE=OUTSIDE (the value is outside the slice).

    Featured in: Example 10 on page 873 and Example 11 on page 875

WOUTLINE= slice-outline-width

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

ANGLE= degrees

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

    Not supported by: Java

COLOR= color

C= 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 first color in the colors list. It ignores the CTEXT= graphics option. See Chapter 6, SAS/GRAPH Colors and Images, on page 91 for details on specifying color .

FONT= font

F= font

  • 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 Chapter 5, SAS/GRAPH Fonts, on page 75 for details on specifying font . The Java and ActiveX devices do not support all fonts.

    Not supported by: Java (partial), ActiveX (partial)

HEIGHT= text-height < units >

H= text-height < units >

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

JUSTIFY=LEFT CENTER RIGHT

J=L C R

  • specifies the alignment of the text string(s). By default, JUSTIFY=CENTER.

    Not supported by: Java, 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).

    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 CTEXT= in the PIE, PIE3D, or DONUT statement. If CTEXT= is omitted, the arrow uses the first color in the colors list.

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.

Figure 29.14 on page 831 illustrates these values.

click to expand
Figure 29.14: 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 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

  • FTEXT= graphics option to decrease the size of the labels.

  • the Graphics Editor to adjust the labels by moving or resizing the text.

  • ANGLE= to change the orientation of the pie.

  • MIDPOINTS= to rearrange slices so that small slices are not together.

  • OTHER= to group more midpoints into the OTHER category.

  • the HPOS= and VPOS= graphics options to increase the number of cells in your display. ( See About the Graphics Output Area on page 34 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.

Default patterns and outlines

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.

    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 on page 784 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.

  • 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= on page 174 in PATTERN Statement on page 169.

      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 on page 821.

See About Patterns on page 784 for more information on how the GCHART procedure uses patterns and outlines. See PATTERN Statement on page 169 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.

STAR Statement

Creates star charts in which the length of the spines represents the value of the chart statistic for each category of data or midpoint.

Requirements: At least one chart variable is required.

Global statements: FOOTNOTE, PATTERN, TITLE,

Supports: Drill-down functionality (slices only)

Not supported by: Java, ActiveX

Description

The STAR statement specifies the variable or variables that define the categories of data to chart. This statement automatically

  • determines the midpoints.

  • calculates the chart statistic for each midpoint (the default is FREQ).

  • scales each spine or slice to represent the chart statistic. Slices or spines are drawn for all midpoints where the value of the chart statistic is greater than the value that is specified in the STARMIN= option.

  • arranges the spines or slice counterclockwise around the star in ascending order of midpoint value, starting at the three o clock position.

  • prints the midpoint value and chart statistic beside each spine or slice.

  • assigns patterns to the slices.

If all the data to be charted with the STAR statement are positive, the center of the star represents 0 and the outside circle represents the maximum value. If negative values are calculated for the chart statistic, the center represents the minimum value in the data. You can specify other values for the center and outside of the circle with the STARMIN= and STARMAX= options.

You can also use statement options to select or order the midpoints, to change the type of chart statistic, and to modify the appearance of the chart, including the content and position of the spine or slice labels, and patterns that fill the slice. You can specify additional variables by which to group or sum the data.

Star charts allow grouping, which creates two or more separate charts that display in rows or columns on one graph.

In addition, you can use global statements to modify patterns as well as add titles, footnotes, and notes to the chart. You can also use an Annotate data set to enhance the chart.

Syntax

  • STAR chart-variable(s) </ option(s) >;

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

  • appearance options

    • ANGLE= degrees

    • ANNOTATE= Annotate-data-set

    • CFILL= fill-color

    • COUTLINE= star-outline-color SAME

    • FILL=SOLID X

    • NOCONNECT

    • STARMAX= max-value

    • STARMIN= min-value

    • WOUTLINE= slice-outline-width

  • statistic options

    • FREQ= numeric-variable

    • SUMVAR= summary-variable

    • TYPE= statistic

  • midpoint options

    • DISCRETE

    • LEVELS= number-of-midpoints

    • MIDPOINTS= value-list

    • MIDPOINTS=OLD

    • MISSING

  • grouping options

    • ACROSS= number-of-columns

    • DOWN= number-of-rows

    • GROUP= group-variable

  • labeling options

    • CTEXT= text-color

    • MATCHCOLOR

    • NOGROUPHEADING

    • NOHEADING

    • PERCENT=ARROW INSIDE NONE OUTSIDE

    • SLICE=ARROW INSIDE NONE OUTSIDE

    • VALUE=ARROW INSIDE NONE OUTSIDE

  • catalog entry description options

    • DESCRIPTION= entry-description

    • NAME= entry-name

  • ODS options

    • HTML= variable

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 on page 779

Options

Options in a STAR statement affect all of the 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 Chapter 6, SAS/GRAPH Colors and Images, on page 91.

ACROSS= number-of-columns

  • draws number-of-columns stars across the procedure output area. ACROSS= is ignored unless you also use the GROUP= option. If number-of-columns calls for more stars than fit horizontally in the graphics area of the output device, no stars are drawn and an error message is written to the SAS log.

    If you also use the DOWN= option, the star charts 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 3 o clock position. Degrees can be either positive or negative. Positive values move the starting position counterclockwise; negative values move the starting position clockwise.

    If the star chart uses spines instead of slices, degrees specifies the angle of the position halfway between the first spine and the last spine.

    By default, ANGLE=0, which places the first spine or the center of the first slice of the star at the 0 degree position. Successive star spines or slices are drawn counterclockwise from the starting position.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate charts that are produced by the STAR statement.

    Note: Annotate coordinate systems 1, 2, 7, and 8 (data system coordinates) are not valid with star charts.

    See also: Chapter 24, Using Annotate Data Sets, on page 587

CFILL= fill-color

  • specifies one color for all slices in the chart, regardless of whether the fill is solid or hatch. 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 star 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.

COUTLINE= star-outline-color SAME

  • specifies the color for the circle that surrounds the star chart and for the slice outlines or spines.

    SAME specifies that the outline color of a slice is the same as the interior pattern color. Specifying COUTLINE=SAME affects only slice outlines and has no effect on the color of the circle.

  • The default circle color is the first color in the colors list (the foreground color).

  • The default slice outline color depends on the PATTERN statement:

    • If you do not specify the PATTERN statement, the default outline color is the foreground color (the first color in the colors list).

    • If you do not specify the PATTERN statement or the V6COMP graphics options, 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 the outlines will be one color and you will not be able to distinguish between the empty areas.

    See also: Selecting Patterns for the Star Charts on page 840 and About Patterns on page 784

    Featured in: Example 14 on page 880

CTEXT= text-color

  • specifies a color for all text on the chart. Text includes all slice labels, the chart heading, and group headings if grouping is used.

    If you omit CTEXT=, PROC GCHART searches for a color specification in this order:

    1. the CTEXT= option in a GOPTIONS statement

    2. the first color in the colors list (the default).

  • The MATCHCOLOR option overrides the CTEXT= option for star slice labels.

DESCRIPTION= entry-description

DES= entry-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 STAR 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 on page 222, and Substituting BY Line Values in a Text String on page 226. 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 Table of Contents that is generated when you use CONTENTS= on an ODS statement (see Linking to Output through a Table of Contents on page 495), assuming the GCHART output is generated while the contents page is open

    • the Description field of the PROC GREPLAY window.

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 star slice for each unique value of the chart variable. If the variable has a format associated with it, each format value is treated as a separate value.

    The LEVELS= option is ignored when you use the DISCRETE option. The MIDPOINTS= option overrides the DISCRETE option.

    Featured in: Example 14 on page 880

DOWN= number-of-rows

  • draws number-of-rows stars 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 stars than fit vertically in the graphics area of the output device, no stars are drawn and an error message is written to the SAS log.

    If you also use the ACROSS= option, the stars are drawn in left-to-right and top-to-bottom order.

FILL=SOLID X

  • specifies the fill pattern for all slices in the star chart:

    SOLID

    S

    • rotates a solid fill through the colors list as many times as necessary. This is the default.

  • X

    • rotates a single hatch pattern through the colors list as many times as necessary.

  • If you use default device colors (the COLORS= option is omitted), the fill skips the first color in the colors list.

    FILL= overrides any patterns that are specified in PATTERN statements.

    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.

    Featured in: Example 14 on page 880

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 that are 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 on page 783

GROUP= variable

  • organizes the data according to values of group-variable and produces a separate star 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, 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 star chart on a page or display, use the ACROSS= or DOWN= options, or both.

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 wish to display when the user drills down on the area. Only star charts with slices support drill-down functionality. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.

LEVELS= number-of-midpoints

  • specifies number of midpoints for a numeric chart variable. The range for each midpoint is calculated automatically using the algorithm described by Terrell and Scott (1985). LEVELS= is ignored if

    • the chart variable is character type

    • the DISCRETE option is used

    • 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. If the chart uses spines instead of slices, the spine color is used for the slice label and value text.

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.

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

      • '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 on page 130 in the AXIS statement.

    See also: About Midpoints on page 780

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

NAME= entry-name

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

NOCONNECT

  • draws only star spines without connecting lines. By default, the spines are connected to form slices.

    Featured in: Example 14 on page 880

NOGROUPHEADING

  • suppresses the headings normally printed above each star when you use the GROUP= option.

NOHEADING

  • suppresses the heading normally printed at the top of each page or display of star chart output.

    Featured in: Example 14 on page 880

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 Spine and Slice Labels on page 840. By default, PERCENT=NONE (percentage is not displayed).

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 Spine and Slice Labels on page 840. By default, SLICE=OUTSIDE (the name is outside the slice).

STARMAX= max-value

  • scales the chart so that the outside (or edge) of the circle represents the value that is specified by max-value . By default, the value for STARMAX= is the maximum chart statistic value.

STARMIN= min-value

  • scales the chart so that the center of the circle represents the value that is specified by min-value . By default, STARMIN=0. If the chart statistic has negative values, by default the value for STARMIN= is the minimum chart statistic value.

SUMVAR= summary-variable

  • specifies a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of the value of numeric-variable for each midpoint. The resulting statistics are represented by the size of the slice and displayed beside each slice.

    When you use SUMVAR=, the TYPE= option must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.

    Featured in: Example 13 on page 879

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 on page 782 and Calculating Weighted Statistics on page 783

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 Spine and Slice Labels on page 840. By default, VALUE=OUTSIDE (the value is outside of the slice).

WOUTLINE= slice-outline-width

  • specifies the width of the outline in pixels. WOUTLINE= affects the slice outlines.

Selecting and Positioning Spine and Slice Labels

By default, each spine or slice is labeled with its midpoint value and its chart statistic value, which are printed outside of the circle. You can control where and how these labels are displayed with the SLICE= and VALUE= options, respectively. In addition, each spine can display the percentage that its midpoint contributes to the total chart statistic (spine percent). Use the PERCENT= option to request spine percent.

The SLICE=, VALUE=, and PERCENT= options use the same values:

  • ARROW

    • places the text outside of the star circle and connects the text to the circle with a line. The line points to the spine or the center of the slice. The arrow uses the color that is specified by CTEXT= in the STAR statement. If you omit CTEXT=, the arrow uses the first color in the colors list.

  • INSIDE

    • places the text inside the star circle.

  • NONE

    • suppresses the text.

  • OUTSIDE

    • places the text outside the star circle.

  • Figure 29.14 on page 831 illustrates these values.

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

Selecting Patterns for the Star Charts

Star charts are always patterned by midpoint.

Default patterns and outlines

Each slice in a star chart is filled with a pattern. By default, the procedure

  • fills the slices with star 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 star pattern and rotates it through the colors list. It continues in this fashion until all the required patterns have been assigned.

    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.

  • outlines slices using the first color in the colors list. To change the outline color, use the COUTLINE= option.

See About Patterns on page 784 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.

  • 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 STAR statement. The pattern that is specified by FILL=X rotates through the colors list as many times as needed to generate all the patterns 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 star patterns are valid; all other pattern specifications are ignored. For a complete description of all star patterns, see VALUE= on page 174 in PATTERN Statement on page 169.

      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 star 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. If you use CFILL=, the procedure starts with the default solid color and uses the foreground color for outlines. If you use CPATTERN= or a colors list of one color, the procedure skips the default solid fill and, beginning with P2N0, uses each default star hatch pattern with the specified color, and uses 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 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 on page 821.

See About Patterns on page 784 for more information on how the GCHART procedure uses patterns and outlines. See PATTERN Statement on page 169 for a description of default star patterns.

Modifying the Statistic Heading and the Group Heading

By default, the procedure prints a heading at the top of each chart indicating 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 star indicating the name of the group variable and its value for the particular star “ 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, as shown in this example:

 label site='00'x; 

Because the AXIS statement cannot be used by the STAR statement, you should use the FTEXT= and HTEXT= graphics options to control the font and height of text on the chart. Increasing the value of HTEXT= decreases the size of the star if any slice labels are positioned outside. For a description of these graphics options, see Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261.




SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net