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)
|
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.
STAR chart-variable(s) </
option(s);>
|
option(s) can be one or more options from any or
all of the following categories:
- 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.
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.
-
ACROSS=number-of-columns
- draws number-of-columns
stars across the procedure output area. ACROSS= is ignored unless you also
use the GROUP= option. By default, ACROSS=1. 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.
-
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.
-
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:
- the CTEXT= option in a GOPTIONS statement
- 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 40 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. For more information, refer to the description
of the options, and Substituting BY Line Values in a Text String.
The 40-character limit applies before the substitution takes place for these
options; thus, if in the SAS program the entry-description text exceeds 40
characters, it is truncated to 40 characters, and then the substitution is
performed.
The descriptive text is shown in the "description" portion of each of
the following:
- in the Results window
- among the catalog-entry properties that you can view from the
Explorer window
- in the Table of Contents that is generated when you use CONTENTS=
on an ODS HTML statement (see Linking to Output through a Table of Contents),
assuming the GCHART output is generated while the contents page is open
- in 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.
-
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.
-
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. Noninteger 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.
-
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 HTML 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.
-
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:
If a character variable has an associated format, the
specified values must be the formatted values.
For a complete description of value-list,
see the ORDER= option in the AXIS statement.
-
MIDPOINTS=OLD
- tells the GCHART procedure to calculate
default midpoints using the algorithm that is used in Release 82.4 and Version
5 of SAS/GRAPH. The MIDPOINTS=OLD option
is ignored unless the chart variable is numeric type.
-
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, SAS/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.
-
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.
-
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 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.
-
TYPE=statistic
- specifies the chart statistic.
Because you cannot use TYPE=FREQ or TYPE=PERCENT with
SUMVAR=, you must use FREQ= to calculate percentages or frequencies based
on a sum. See also 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. WOUTLINE= affects both the slice and the subgroup outlines.
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.
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. 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.
Star charts are always patterned by midpoint.
Each slice
in a star chart is filled with a pattern. By default, the procedure
- fills the slices with pie/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 pie/start 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
for more information on how the GCHART procedure assigns default patterns
and outlines.
You can control slice patterns and their outlines in several ways.
- To select a different fill for the slices, such
as empty or hatched, you can
- request a single hatched fill pattern for all
slices by specifying the FILL=X option on the 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 pie/star patterns are valid; all other pattern specifications
are ignored. For a complete description of all pie/star patterns, see VALUE=
in PATTERN Statement.
If no color options are specified, the procedure rotates
each specified fill once through the colors list. Otherwise the PATTERN statement
generates one pattern definition for the specified pattern and color. When
all of the specified patterns are exhausted, the procedure starts rotating
through the default pie/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 pie/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.
See
About Patterns
for more information on how the GCHART procedure uses patterns and outlines.
See PATTERN Statement
for a description of default pie/star patterns.
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.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.