Chapter Contents |
Previous |
Next |
SAS/GRAPH Software: Reference |
The AXIS statement controls the location, values, and appearance of the axes in plots and charts.
Global
AXIS statements specify the characteristics of an axis, including:
AXIS definitions are used only when they are explicitly assigned by an option in a procedure that produces graphs with axes.
Parts of Axes illustrates the terms associated with the various parts of axes.
AXIS<1...99><options>; |
option(s) can be one or more options from any or all of the following categories:
LOGBASE=base | E | PI | |
LOGSTYLE=EXPAND | POWER | |
ORDER=(value-list) |
COLOR=axis-color | |
LENGTH=axis-length <units > | |
NOBRACKETS | |
NOPLANE | |
OFFSET=(<n1 ><,n2 >)<units > | (<n1<units>><,n2<units >>) | |
ORIGIN=<(x><,y >)<units> | (<x<units >><,y<units>>) | |
STYLE=line-type | |
WIDTH=thickness-factor |
MAJOR=(tick-mark-suboption(s) ) | NONE | |
MINOR=(tick-mark-suboption(s) ) | NONE |
LABEL=(text-argument(s) ) | NONE | |
REFLABEL=(text-argument(s) ) | NONE | |
SPLIT="split-char" | |
VALUE=(text-argument(s) ) | NONE |
When the syntax of an option includes units, use one of these:
CELLS | character cells |
CM | centimeters |
IN | inches |
PCT | percentage of the graphics output area |
PT | points |
If you omit units, a unit specification is searched for in this order:
Option | Items Affected |
---|---|
AXIS statement: LABEL=(COLOR=color) REFLABEL=(COLOR=color) VALUE=(COLOR=color) |
axis label reference-line labels major tick mark values |
calling procedure: CTEXT= CAXIS= |
all axis text (AXIS label and major tick mark value descriptions) axis line and major and minor tick marks |
If you omit all color options, the AXIS statement looks for a color specification in this order:
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values |
ANGLE=degrees | |
COLOR=text-color | |
FONT=font | NONE | |
HEIGHT=text-height <units > | |
JUSTIFY=LEFT | CENTER | RIGHT | |
ROTATE=degrees |
See Text Description Suboptions for a complete description.
Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values, Example 2. Specifying Logarithmic Axes , and Example 7. Using BY-group Processing to Generate a Series of Charts |
Featured in: | Example 2. Specifying Logarithmic Axes and Example 9. Combining Graphs and Reports in a Web Page |
Axis Generated with LOGBASE=E and LOGSTYLE=EXPAND
Featured in: | Example 2. Specifying Logarithmic Axes |
LOGSTYLE=EXPAND specifies that the values displayed are the values of the base raised to successive powers and that the minor tick marks are logarithmically placed. For example, if the base is 10, the values displayed are 10, 100, 1000, 10000, and so on. The default is LOGSTYLE=EXPAND. This statement generates an axis like the one in part (a) of Axes Generated with the LOGSTYLE=Option:
axis logbase=10 logstyle=expand;
LOGSTYLE=POWER specifies that the values displayed are the powers to which the base is raised (for example, 1, 2, 3, 4, 5, and so on). For example, this statement generates an axis like the one in part (b) of Axes Generated with the LOGSTYLE=Option:
axis logbase=10 logstyle=power;
Axes Generated with the LOGSTYLE=Option
If you use ORDER= with a logarithmic axis, the values specified by ORDER= must match the style specified by LOGSTYLE=. For example, if you specify a logarithmic axis with a base of 2 and you want to display the first five expanded values, use this statement:
axis logbase=2 logstyle=expand order=(2 4 8 16 32);
If you use LOGSTYLE=POWER, the values in ORDER= must represent the powers to which the base is raised, as in this example:
axis logbase=2 logstyle=power order=(1 2 3 4 5);
If the values that are specified by ORDER= do not match the type of values specified by LOGSTYLE=, the request for a logarithmic axis is ignored.
Featured in: | Example 2. Specifying Logarithmic Axes |
COLOR=tick-color | |
HEIGHT=tick-height <units > | |
NUMBER=number-of-ticks | |
WIDTH=thickness-factor |
See Tick Mark Description Suboptions for complete descriptions. List all suboptions and their values within the parentheses.
AXIS definitions assigned to the group axis of a bar chart by the GAXIS= option ignore MAJOR= because the axis does not use tick marks.
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values , Example 2. Specifying Logarithmic Axes, and Example 7. Using BY-group Processing to Generate a Series of Charts |
COLOR=tick-color | |
HEIGHT=tick-height <units > | |
NUMBER=number-of-ticks | |
WIDTH=thickness-factor |
See Tick Mark Description Suboptions for complete descriptions. List all suboptions and their values within the parentheses.
AXIS definitions assigned to the group axis of a bar chart by the GAXIS= option ignore MINOR= because the axis does not use tick marks.
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values, Example 2. Specifying Logarithmic Axes, and Example 7. Using BY-group Processing to Generate a Series of Charts |
See also: | GROUP= and GAXIS= |
To remove selected axis elements such as lines, values or labels, use specific AXIS statement options. To remove all axis elements except the 3D planes use the NOAXIS option in the procedure. To remove the backplane, use the NOFRAME option in the procedure.
Featured in: | Example 7. Using BY-group Processing to Generate a Series of Charts |
The value of (n1 ) is the distance from the beginning (origin) of the axis line to the first tick mark or middle of the first bar, and the value of (n2 ) is the distance from the end of the axis line to the last tick mark or middle of the last bar.
On a horizontal axis, the (n1) offset is measured from the left end of the axis line and the (n2) offset is measured from the right end. On a vertical axis, the (n1) offset is measured up from the bottom of the axis line and the (n2) offset is measured down from the top of the line.
To specify the same offset for both n1 and n2, use one value, with or without a following comma. For example, either option sets both n1 and n2 to 4 centimeters:
offset=(4 cm) offset=(4 cm,)
To specify different offsets, use two values, with or without a comma separating them. For example,
offset=(4 cm, 2 cm)
To specify only the second offset, use only one value preceded by a comma. This option offsets the last major tick mark or bar 3 centimeters from the right-hand end of the axis line:
offset=(,3 cm)
You can specify units for the n1,n2 pair or for the individual offset values.
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values |
The way you specify value-list depends on the type of variable:
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.
Values must be listed in either ascending or descending order. By default the increment value is 1. You can use a negative integer for increment to specify a value list in descending order. In all forms, multiple n values can be separated by blanks or commas. Here are some examples:
order=(2 4 6) order=(6,4,2) order=(2 to 10 by 2) order=(50 to 10 by -5)
If the specified range is not evenly divisible by the increment value, the highest value displayed on the axis is the last incremental value below the ending value for the range. For example, this value list produces a maximum axis value of 9:
order=(0 to 10 by 3)
'value-1' <...'value-n'> |
If a character variable has an associated format, the specified values must be the formatted values.
Character values can be specified in any order, but the character strings must match exactly the variable values in case and spelling. For example,
order=('Paris' 'London' 'Tokyo')
Observations can be inadvertently excluded if entries in the value-list are misspelled or if the case does not match exactly.
'SAS-value'i <...'SAS-value'i> | |||||||||||||
'SAS-value'i TO 'SAS-value'i <BY interval>
|
These value lists use SAS date and time values:
order=('25MAY98'd '04JUL98'd '07SEP98'd) order=('01JUL97'd to '01AUG97'd) order=('01JUL97'd to '01JAN98'd by week) order=('9:25't to '11:25't by minute) order=('04JUN97:12:00:00'dt to '10JUN9712:00:00'dt by dtday)
With SAS date and time values, use a FORMAT statement so that the tick mark values have an understandable form. For more information on SAS date and time values, see SAS Language Reference: Dictionary.
With any type of value-list, specifying values that are not distributed uniformly or are not in ascending or descending order, generates a warning message in the SAS log. The specified values are spaced evenly along the axis even if the values are not distributed uniformly.
Using ORDER= to restrict the values displayed on the axis may result in clipping. For example, if the data range is 1 to 10 and you specify ORDER=(3 TO 5), only the data values from 3 to 5 appear on the plot or chart. For charts, the omitted values are still included in the statistic calculation.
Note: Values out of range do not always
produce a warning message in the SAS log.
ORDER= overrides the suboption NUMBER= described in Tick Mark Description Suboptions.
ORDER= is not valid with the ASCENDING, DESCENDING and NOZEROS options used with the bar chart statements in the GCHART procedure.
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values, Example 5. Filling the Area between Plot Lines, and Example 7. Using BY-group Processing to Generate a Series of Charts |
If you specify only one value, with or without a comma following it, only the x coordinate is set to that value. For example, this specification sets x to 4 centimeters:
origin=(4 cm,)
If you specify two values, with or without a comma separating them, the first value sets the x coordinate and the second value sets the y coordinate, as in this example:
origin=(2 pct, 4 pct)
If you specify one value preceded by a comma, only the y coordinate is set to that value, as shown here:
origin=(,3 pct)
You can specify units for the x,y pair or for the individual coordinates.
ANGLE=degrees | |
AUTOREF | |
COLOR=text-color | |
FONT=font | NONE | |
HEIGHT=text-height <units > | |
JUSTIFY=LEFT | CENTER | RIGHT | |
POSITION=TOP| MIDDLE| BOTTOM | |
ROTATE=degrees | |
T=n |
See Text Description Suboptions for a complete description.
Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
Berlin, Germany
, and you specify SPLIT=",". The value would appear
on the axis as
Berlin Germany
Note that the split character itself is not displayed.
Axis values specified with VALUE= do not use the split character. For example, suppose you specify this statement:
axis1 spilt="," value=(t1='December, 1999');
The value will appear on the axis on one line as
December, 1999
. However, any other axis values containing a comma would
honor the split character.
Featured in: | Creating Bar Charts with Drill-down for the Web |
See also: | Line Types for examples of the available line types |
Specified text strings are assigned to major tick marks
in order. If you specify only one text string, only the first tick mark value
changes, and all the other tick mark values display the default. If you specify
multiple strings, the first string is the value of the first major tick mark,
the second string is the value of the second major tick mark, and so forth.
For example, to change default tick mark values 1, 2, and 3 to
First
,
Second
, and
Third
, use this option:
value=('First' 'Second' 'Third')
Note: Although VALUE= changes the text displayed
at a major tick mark, it does not affect the actual value represented by the
tick mark. To change the tick mark values, use ORDER=. To change the value
of midpoints in bar charts produced with the GCHART procedure, use the MIDPOINTS=
option in the procedure.
ANGLE=degrees | |
COLOR=text-color | |
FONT=font | NONE | |
HEIGHT=text-height <units > | |
JUSTIFY=LEFT | CENTER | RIGHT | |
ROTATE=degrees | |
TICK=n |
For a complete description, see Text Description Suboptions.
Place text description suboptions before the text strings they modify. Suboptions not followed by a text string affect the default values. To specify and describe the text for individual values or to produce multi-line text, use the TICK= suboption.
Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
Featured in: | Example 2. Specifying Logarithmic Axes, Example 7. Using BY-group Processing to Generate a Series of Charts, and Example 9. Combining Graphs and Reports in a Web Page |
Featured in: | Example 1. Ordering Axis Tick Marks with SAS Datetime Values |
Text description suboptions are used by the LABEL=, REFLABEL=, and VALUE= options to change the color, height, justification, font, and angle of either default text or specified text strings. See LABEL=, REFLABEL=, and VALUE=.
See also: | the ROTATE= suboption |
Featured in: | Creating Bar Charts with Drill-down for the Web |
reflabel=(autoref t=2 "two")
See also: | the T= suboption |
With the REFLABEL= option:
You can use JUSTIFY= to print multiple lines of text by repeating JUSTIFY= before the text string for each line. You can also use JUSTIFY= to specify multi-line text at specified major tick marks. For example, this statement produces an axis label and major tick mark values like those shown in The JUSTIFY= Suboption.
axis label=('Current' justify=c 'Sales Projections') value=(tick=1 'JAN' justify=c '1997' tick=2 'FEB' justify=c '1997' tick=3 'MAR' justify=c '1997' tick=4 'APR' justify=c '1997' tick=5 'MAY' justify=c '1997');
Specify additional suboptions before any string.
See also: | the suboption TICK= |
See also: | the ANGLE= suboption |
reflabel=(autoref t=3 color=red)Suboptions that precede T= affect all the reference-line labels on an axis. Suboptions that follow T= affect only the specified line's label. For example, the following option assigns the color green to all the reference-line labels on an axis, but left-justifies only the third reference line's label:
reflabel(c=green "one" "two" t=3 j=left "three")For the options to be applied to a text string, they must precede the quoted string. In the following option, the j=left is ignored because it follows the string:
reflabel(c=green "one" "two" t=3 "three" j=left)
value=(tick=3 color=red)Suboptions that precede TICK= affect all the major tick mark values. Suboptions that follow TICK= affect only the specified value. For example, the following option makes all the major tick mark values 4 units high and colors all of them blue except for the third one, which is red:
value=(height=4 color=blue tick=3 color=red)
label=(font=swiss height=4 'Weight' justify=right height=3 '(in tons)')
FONT=SWISS applies to both
Weight
and
(in tons
). HEIGHT=4 affects
Weight
, but is respecified
as HEIGHT=3 for
(in tons)
.
JUSTIFY=RIGHT affects only
(in
tons)
.
Tick mark description suboptions are used by MAJOR= and MINOR= to change the color, height, width, and number of the tick marks to which they apply. See MAJOR= and MINOR=.
If you specify a negative number, tick marks are drawn inside the axis.
With MAJOR=, the NUMBER= suboption can be overridden by a major tick mark specification in the procedure, which in turn can be overridden by ORDER=.
With MINOR=, the NUMBER= suboption can be overridden by a minor tick mark specification in the procedure.
NUMBER= is not valid with logarithmic axes.
Using the AXIS Statement |
AXIS statements can be defined anywhere in your SAS program. They are global and remain in effect until redefined, canceled, or until the end of your SAS session. AXIS statements are not applied automatically, and must be explicitly assigned by an option in the procedure that uses them.
You can define up to 99 different AXIS statements. If you define two AXIS statements of the same number, the most recently defined one replaces the previously defined statement of the same number. An AXIS statement without a number is treated as an AXIS1 statement.
Cancel individual AXIS statements by defining an AXIS statement of the same number without options (a null statement):
axis4;
Canceling one AXIS statement does not affect any other AXIS definitions. To cancel all current AXIS statements, use the RESET= option in a GOPTIONS statement:
goptions reset=axis;
Specifying RESET=GLOBAL or RESET=ALL cancels all current AXIS definitions as well as other settings.
To display a list of current AXIS definitions in the LOG window, use the GOPTIONS procedure with the AXIS option:
proc goptions axis nolist; run;
Assigning AXIS Definitions |
Procedure | Statement that generates an axis | Type of axis | Option that assigns an AXIS definition |
---|---|---|---|
GCHART | HBAR | VBAR | group axis midpoint axis response axis | GAXIS= MAXIS= RAXIS= |
GCONTOUR | PLOT | horizontal axis vertical axis | HAXIS= VAXIS= |
GPLOT | PLOT | horizontal axis vertical axis | HAXIS= VAXIS= |
Some types of axes cannot use certain AXIS statement options:
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.