SAS Institute. The Power to Know

SAS/GRAPH(R) 9.2: Statistical Graphics Procedures Guide

space
Previous Page | Next Page

The SGPLOT Procedure

XAXIS, X2AXIS, YAXIS, Y2AXIS Statements


specify the axis options for each plot axis.


Description

The XAXIS, X2AXIS, YAXIS, and Y2AXIS statements specify options for the plot axes. You can control the features of the axis (for example, the axis label, grid lines, and minor tick marks) and you can also control the structure of the axis (for example, the data range, data type, and tick mark values).

The XAXIS, X2AXIS, YAXIS, and Y2AXIS statements correspond to the axes as follows:

XAXIS

specifies options for the X axis.

X2AXIS

specifies options for the X2 axis.

YAXIS

specifies options for the Y axis.

Y2AXIS

specifies options for the Y2 axis.


Syntax

XAXIS option(s);
X2AXIS option(s);
YAXIS option(s);
Y2AXIS option(s);

option(s) can be one or more options from the following:

DISCRETEORDER= DATA | FORMATTED | UNFORMATTED

DISPLAY= ALL | NONE | (options)

FITPOLICY= policy-value

GRID

INTEGER

LABEL= "text-string "

LOGBASE= 2 | 10 | e

LOGSTYLE= LINEAR | LOGEXPAND | LOGEXPONENT

MIN= numeric-value

MINOR

MAX= numeric-value

NOTIMESPLIT

REFTICKS

TYPE= DISCRETE | LINEAR | LOG | TIME

VALUES= ( value-1 < ... value-n > )

VALUESHINT


Options

DISCRETEORDER= DATA | FORMATTED | UNFORMATTED

specifies the order in which discrete tick values are placed on the axis. Specify one of the following values:

DATA

places the values in the order that they appear in the data.

FORMATTED

sorts the formatted values in ascending character order.

UNFORMATTED

sorts the unformatted values in ascending character order.

Default: DATA
Restriction: This option affects only box plots, dot plots, bar charts, and line charts, or for any axis where TYPE=DISCRETE.
DISPLAY= ALL | NONE | (options)

specifies which features of the axis are displayed. ALL displays all of the features of the axis. NONE specifies that none of the features of the axis are displayed. You can also hide specific features:

NOLABEL

hides the axis label

NOLINE

hides the axis line

NOTICKS

hides the tick marks on the axis

NOVALUES

hides the tick mark values on the axis

Default: ALL
FITPOLICY= policy-value

specifies the method that is used to fit tick mark values on a horizontal axis when there is not enough room to draw them normally. Select one of the following values:

ROTATE

rotates the value text 45 degrees. This is the default for discrete axes.

ROTATETHIN

attempts to use ROTATE, and then THIN to fit the values.

STAGGER

shifts the values up and down.

STAGGERROTATE

attempts to use STAGGER, and then ROTATE to fit the values.

STAGGERTHIN

attempts to use STAGGER, and then THIN to fit the values.

THIN

removes some of the values from the axis. This is the default for linear and time axes.

Note:   This option does not affect vertical axes; only the THIN fit policy is used for vertical axes.  [cautionend]

GRID

creates grid lines at each tick on the axis.

INTEGER

specifies that only integers are used for tick mark values. This option affects only linear axes.

LABEL= "text-string"

specifies a label for the axis.

LOGBASE= 2 | 10 | e

specifies the base value for the logarithmic scale.

Default: 10
Interaction: This option has no effect unless you also specify TYPE=LOG.
LOGSTYLE= LINEAR | LOGEXPAND | LOGEXPONENT

specifies how to scale and format the values for the major tick marks for logarithmic axes. Specify one of the following values:

LOGEXPAND

places the tick marks at integer powers of the base. For example, if you specified LOGBASE=2, the tick marks might be at 1, 2, 4, 8, 16. See Graph Axes with LOGEXPAND.

Graph Axes with LOGEXPAND

[Example of an Axis with LOGEXPAND]

LOGEXPONENT

places the tick marks at integer powers of the base, but identifies the values by the exponent. For example, if you specified LOGBASE=10, the tick marks might be at 1, 10, 100, 1000, but the tick values would read 0, 1, 2, 3. See An Axis with LOGEXPONENT.

An Axis with LOGEXPONENT

[Example of an Axis with LOGEXPONENT]

LINEAR

places the tick marks at uniform linear intervals, but spaces them logarithmically. In some cases an intermediate tick mark is placed between the first and second marks.

For example, if the data on this axis range from 14 to 1154, and you specify LOGBASE=10, then the tick marks might be at 10, 40, 200, 400, 600, 800, 1000, 1200. See An Axis with LINEAR.

An Axis with LINEAR

[Example of an Axis with LINEAR]

Default: LOGEXPAND
Interaction: This option has no effect unless you also specify TYPE=LOG.
MAX= numeric-value

specifies the maximum value for the axis.

Interaction: This option has no effect if you specify the VALUES= option and you do not also specify the VALUESHINT option.
Restriction: This option affects linear and time axes only .
MIN= numeric-value

specifies the minimum value for the axis.

Interaction: This option has no effect if you specify the VALUES= option and you do not also specify the VALUESHINT option.
Restriction: This option affects linear and time axes only .
MINOR

adds minor tick marks to the axis.

Interaction: This option has no effect if you specify the VALUES= option.
Restriction: This option has no effect on discrete axes.
NOTIMESPLIT

prevents a time axis from splitting the time, date, or datetime values into two rows.

Restriction: This option applies to time axes only.
REFTICKS

adds tick marks to axis that is opposite from the specified axis. For example, if you specify the REFTICKS option on the XAXIS statement, then tick marks are added to the X2 axis.

Note:   This option has no effect if the target axis already contains data.  [cautionend]

TYPE= DISCRETE | LINEAR | LOG | TIME

specifies the type of axis. Specify one of the following values:

DISCRETE

specifies an axis with discrete values. If a character variable is assigned to an axis, then the default type for that axis is discrete. Additionally, all categorization plots use a discrete axis for the category variable.

LINEAR

specifies a linear scale for the axis. This is the default axis type for numeric variables that do not have date or time formats.

LOG

specifies a logarithmic scale for the axis. This axis type is never a default.

TIME

specifies a time scale for the axis. If the variable assigned to an axis has a time, date, or datetime format associated with it, then time is the default axis type.

VALUES= ( value-1 < ...value-n >)

specifies the values for the ticks on the axis.

Restrictions: This option has no effect on discrete and logarithmic axes.

If your VALUES= option creates more than 1000 values, then the option has no effect.

VALUESHINT

specifies that the minimum and maximum axis values are determined independently of the values you specify in the VALUES= option. The values from the VALUES= option are displayed only if they are located between the minimum and maximum values.

Note:   This option has no effect unless you also specify the VALUES= option.  [cautionend]

space
Previous Page | Next Page | Top of Page