Previous Page | Next Page

The GCHART Procedure

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


Description

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

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:


Required Arguments

chart-variable(s)

specifies one or more variables that define the categories of data to chart. Each chart variable draws a separate chart. All variables must be in the input data set. Separate multiple chart variables with blanks.

See also: About Chart Variables

Options

Options in a 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 SAS/GRAPH Colors and Images.

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

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.  [cautionend]

Alias: ANNO=
See also: Using Annotate Data Sets
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 might be different for each group.

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

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 in the pattern statement or with the FILL= option, the procedure starts with the default solid fill and then, beginning with P2N0, uses each default star hatch pattern with the specified color. For the outline color, the procedure uses the default color, which is retrieved from the current style, or, if the NOGSTYLE option is specified, it uses the first color in the device's color list. Use the COUTLINE= option to specify a different outline color. The CFILL= option overrides any other pattern color specification and controls the color of all slices.

Style reference: Color attribute of the GraphData1 element.
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 and outline color are both specified in the current style. However, if the NOGSTYLE option is specified, then the default circle color is the first color in the device's color list (the foreground color), and the default slice outline color is determined as follows:

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

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

Style reference: Color attribute of the GraphOutlines element.
Featured in: Charting a Discrete Numeric Variable in a Star Chart
See also: Selecting Patterns for the Star Charts and About Patterns
CTEXT=text-color

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

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

  2. the color specified by the CTEXT= option in the STAR statement

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

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

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

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

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

Style reference: Color attributes for the GraphLabelText and the GraphValueText elements.
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 might be different for each group.

The DESCENDING option 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='descriptionn'

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 Substituting BY Line Values in a Text String. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed.

The descriptive text is shown in each of the following:

  • the "description" portion of the Results window

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

  • the Description field of the PROC GREPLAY window

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

Alias: DES=
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: Charting a Discrete Numeric Variable in a Star Chart
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 list of colors available in the default style as many times as necessary. SOLID is the default.

X

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

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

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

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

Style reference: Color attribute of the GraphData1 element.
Featured in: Charting a Discrete Numeric Variable in a Star Chart
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.

The FREQ= option 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 are not affected by applying a format to numeric-variable.

See also: Calculating Weighted Statistics
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 a legend value and point to the data or graph that you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.

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

identifies the variable in the input data set whose values create links in the HTML file that is created by the ODS statement. These links are associated with an area of the chart and point to the data or graph that you want to display when the user drills down on the area. Only star charts with slices support drill-down functionality. There is no limit on the length of the variable.

See also: Overview of Enhancing Web Presentations.
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.

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

  • The SUBGROUP= option 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 for more information.

Featured in: Grouping and Subgrouping a Block Chart
Restriction: Partially supported by Java ActiveX
See also: SUBGROUP= and LEGEND Statement
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). The LEVELS= option is ignored if any of the following are true:

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

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

    • The lowest midpoint consolidates all data points from negative infinity to the median of the first two midpoints.

    • The highest midpoint consolidates all data points from the median of the last two midpoints up to infinity.

    • All other values in value-list specify the median of a range of values, and the GCHART procedure calculates the midpoint values.

    If you include the DISCRETE option, each value in value-list specifies a unique numeric value.

  • For character chart variables, value-list is a list of unique character values enclosed in quotation marks and separated by blanks:

    'value-1' <...'value-n'>

    If a character variable has an associated format, the specified values must be the formatted values.

For a complete description of value-list, see the ORDER= option in the AXIS statement.

See also: About Midpoints
MIDPOINTS=OLD

generates default midpoints using the Nelder algorithm (Applied Statistics 25:94-7, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric

MISSING

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

NAME='entry-name'

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

See also: About Filename Indexing
NOCONNECT

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

Featured in: Charting a Discrete Numeric Variable in a Star Chart
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: Charting a Discrete Numeric Variable in a Star Chart
NOLEGEND

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

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. 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. 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 the STARMIN= option 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 the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.

Featured in: Specifying the Sum Statistic in a Star Chart
TYPE=statistic

specifies the chart statistic.

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

    FREQ

    frequency (the default)

    PERCENT PCT

    percentage

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

    SUM

    sum (the default)

    MEAN

    mean

Because you cannot use TYPE=FREQ or TYPE=PERCENT with the SUMVAR= option, you must use FREQ= to calculate percentages or frequencies based on a sum.

See also: About Chart Statistics and Calculating Weighted Statistics
VALUE=ARROW | INSIDE | NONE | OUTSIDE

controls the position and style of the slice value (chart statistic) for each slice. For a description of the option values, see Selecting and Positioning Spine and Slice Labels. By default, VALUE=OUTSIDE (the value is outside of the slice).

WOUTLINE=slice-outline-width

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

Style reference: LineThickness attribute of the GraphOutlines element.

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 the CTEXT= option in the STAR statement. If you omit the CTEXT= option, the arrow uses the color defined by the current style.

INSIDE

places the text inside the star circle.

NONE

suppresses the text.

OUTSIDE

places the text outside the star circle.

Slice Labeling Methods 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. The PERCENT= option 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 might 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. Because the system option GSTYLE is in effect by default, the procedure uses the current style's default patterns and outlines when producing output. By default, the procedure does the following:

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


Controlling patterns

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

See About Patterns for more information on how the GCHART procedure uses patterns and outlines. See PATTERN Statement for a description of default 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 Graphics Options and Device Parameters Dictionary.

Previous Page | Next Page | Top of Page