SAS Institute. The Power to Know

SAS/GRAPH(R) 9.2 Reference

Previous Page | Next Page

SAS/GRAPH Statements

AXIS Statement

The AXIS statement controls the location, values, and appearance of the axes in plots and charts.

Used by:

GBARLINE, GCHART, GCONTOUR, GPLOT, GRADAR, and G3D procedures

Restriction: For the G3D procedure, the AXIS statement is supported by the JAVA and ActiveX devices only.

Global


Description

AXIS statements specify the following characteristics of an axis:

  • the way the axis is scaled

  • how the data values are ordered

  • the location and appearance of the axis line and the tick marks

  • the text and appearance of the axis label and major tick mark values

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.

Parts of Axes

[Parts of Axes]


Syntax

AXIS<1...99><options>;

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

  • axis scale options:

    INTERVAL=EVEN | UNEVEN | PARTIAL

    LOGBASE=base | E | PI

    LOGSTYLE=EXPAND | POWER

    ORDER=(value-list)

  • appearance options:

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

    STAGGER

    STYLE=line-type

    WIDTH=thickness-factor

  • tick mark options:

    MAJOR=(tick-mark-suboption(s) ) | NONE

    MINOR=(tick-mark-suboption(s) ) | NONE

  • text options:

    LABEL=(text-argument(s) ) | NONE

    REFLABEL=(text-argument(s) ) | NONE

    SPLIT="split-char"

    VALUE=(text-argument(s) ) | NONE


Options

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:

  1. The GUNIT= option in a GOPTIONS statement

  2. the default unit, CELLS.

COLOR=axis-color

specifies the color for all axis components (the axis line, all tick marks, and all text) unless you include a more explicit AXIS statement color specification. The following table lists the SAS/GRAPH statement options that can be used to override the COLOR= specification. The table also lists the name of the style reference associated with each of the options.

Option Graph Element Style Reference
AXIS statement:

LABEL=

(COLOR=color)

axis label GraphLabelText
REFLABEL=

(COLOR=color)

reference-line labels
VALUE=

(COLOR=color)

major tick mark values GraphValueText
calling

procedure:



CTEXT= all axis text

(AXIS label and

major tick mark

value descriptions)

GraphLabelText
CAXIS= axis line and major

and minor tick

marks

GraphAxisLines

If you omit all color options, the AXIS statement looks for a color specification in this order:

  1. The CTEXT= graphics option in a GOPTIONS statement.

  2. If the CTEXT= option is not used, the color of all axis components is the color of the default style.

Alias: C=
Featured in: Example 1. Ordering Axis Tick Marks with SAS Datetime Values
INTERVAL=EVEN | UNEVEN | PARTIAL

The INTERVAL option affects the LOGBASE option on the AXIS statement. Specifying the option INTERVAL=UNEVEN and LOGBASE=10, permits non-base10 values to be specified for the ORDER option, while retaining a logarithmic scale for the axis.

Note:   PARTIAL is an alias for UNEVEN. They have the same effect.  [cautionend]

Restriction: Not supported by Java and ActiveX
LABEL=(text-argument(s)) | NONE

modifies an axis label. Text-argument(s) defines the appearance or the text of an axis label, or both. NONE suppresses the axis label. Text-argument(s) can be one or more of these:

"text-string"

provides up to 256 characters of label text. By default, the text of the axis label is either the variable name or a previously assigned variable label. Enclose each string in quotes. 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=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.

Style Reference: Color attribute of the GraphLabelText style element
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
Restriction: Partially supported by Java and ActiveX.
LENGTH=axis length <units >

specifies the length of the axis in number of units. If you request a length that cannot fit the display, an error message is issued and no graph is drawn.

This option is not supported by the GRADAR Procedure.

Style Reference: Color attribute of the GraphLabelText graph element.
Restriction: Not supported by Java.
Featured in: Example 2. Specifying Logarithmic Axes and Example 9. Combining Graphs and Reports in a Web Page .
LOGBASE=base | E | PI

scales the axis values logarithmically according to the value specified. Base must be greater than 1. The number of minor tick marks is a function of the logbase, and is calculated as the logbase minus 2. For example, if logbase=10, there are 8 minor tick marks. If logbase=2, then there are no minor tick marks. Because the value of logbase=e (2.718281828) is so close to 2, it also results in no minor tick marks. How the values are displayed on the axis depends on the LOGSTYLE= option. For example, LOGBASE=10 with the default LOGSTYLE=EXPAND generates an axis like the one in Axis Generated with LOGBASE=10 and LOGSTYLE=EXPAND.

Axis Generated with LOGBASE=10 and LOGSTYLE=EXPAND

[Axis Generated with LOGBASE=E and LOGSTYLE=EXPAND]

This option is not supported by the GRADAR Procedure.

Featured in: Example 2. Specifying Logarithmic Axes
Restriction: Not supported by Java
LOGSTYLE=EXPAND | POWER

specifies whether the values displayed on the logarithmic axis are the values of the base or the values of the power. LOGSTYLE= is meaningful only when you use LOGBASE=.

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

[Axis Generated with the LOGSTYLE= option]

If you use the ORDER= option with a logarithmic axis, the values specified by the ORDER= option must match the style specified by the LOGSTYLE= option. 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 the ORDER= option 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.

This option is not supported by the GRADAR Procedure.

Featured in: Example 2. Specifying Logarithmic Axes
Restriction: Not supported by Java
MAJOR=(tick-mark-suboption(s) ) | NONE

modifies the major tick marks. Tick-mark-suboption(s) defines the color, size, and number of the major tick marks. NONE suppresses all major tick marks, although the values represented by those tick marks are still displayed. Tick-mark-suboption can be

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.

Note:   By default, tick marks are now placed at three intervals on the spokes of a GRADAR chart. They are placed at the minimum value, maximum value, and at one value in between. The tick marks on the 12 o'clock spoke are also labeled by default.

HEIGHT is not supported by Java or ActiveX. WIDTH is not supported by Java.  [cautionend]

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
Restriction: Partially supported by Java and ActiveX
MINOR=(tick-mark-suboption(s) ) | NONE

modifies the minor tick marks that appear between major tick marks. Tick-mark-suboption(s) defines the color, number, or size of the minor tick marks. NONE suppresses all minor tick marks. Tick-mark-suboption can be

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.

This option is not supported by the GRADAR Procedure.

HEIGHT is not supported by Java or ActiveX.

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
Restriction: Partially supported by Java and ActiveX
NOBRACKETS

suppresses the printing of group brackets drawn around the values on the group axis in a bar chart. NOBRACKETS applies only to the group axis of bar charts.

This option is not supported by the GRADAR Procedure.

See also: GROUP= and GAXIS=
Restriction: Not supported by Java and ActiveX
NOPLANE

removes either the horizontal or vertical three-dimensional axis plane in bar charts produced by the HBAR3D and VBAR3D statements. NOPLANE affects only the axis to which the AXIS statement applies.

To remove selected axis elements such as lines, values or labels, use specific AXIS statement options. To remove all axis elements except the three-dimensional planes use the NOAXIS option in the procedure. To remove the backplane, use the NOFRAME option in the procedure.

This option is not supported by the GRADAR Procedure.

Featured in: Example 7. Using BY-group Processing to Generate a Series of Charts.
OFFSET=(<n1><,n2>)<units > | (<n1<units>><,n2<units>>)

specifies the distance from the first and last major tick marks or bars to the ends of the axis line.

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

This option is not supported by the GRADAR Procedure.

Featured in: Example 1. Ordering Axis Tick Marks with SAS Datetime Values
Restriction: Not supported by Java
ORDER=(value-list )

specifies the order in which data values appear on the axis. The values specified by the ORDER= option are the major tick mark values. You can modify the appearance of these values with the VALUE= option.

The way you specify value-list depends on the type of variable:

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

    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)
  • For character variables, value-list is a list of unique character values enclosed in quotes and separated by blanks:

    "value-1" <..."value-n">

    If a ch