SGPLOT Procedure

X2AXIS Statement

Specifies the axis options for the X2 axis. You can control the features of the axis (for example, the axis label, grid lines, and minor tick marks). You can also control the structure of the axis (for example, the data range, data type, and tick mark values).

Syntax

X2AXIS option(s);

Summary of Optional Arguments

Axis options
specifies the order in which discrete tick values are placed on the axis.
specifies which features of the axis are displayed.
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.
creates grid lines at each tick on the axis.
specifies that only integers are used for tick mark values.
specifies the tick interval for a time axis.
specifies a label for the axis.
specifies the appearance of the axis labels.
specifies the base value for the logarithmic scale.
specifies how to scale and format the values for the major tick marks for logarithmic axes.
specifies the maximum value for the axis.
specifies the minimum value for the axis.
adds minor tick marks to a log or time axis.
prevents a time axis from splitting the time, date, or datetime values into two rows.
specifies an offset that follows the highest data value on the axis.
specifies an offset that precedes the lowest data value on the axis.
adds tick marks to axis that is opposite from the specified axis.
specifies that the tick values are displayed in reverse (descending) order.
Specifies a threshold for displaying one more tick mark at the high end of the axis.
Specifies a threshold for displaying one more tick mark at the low end of the axis.
specifies the format for the axis tick values.
specifies the type of axis.
specifies the appearance of the axis tick value labels.
specifies the values for the ticks on an axis.
specifies that the minimum and maximum axis values are determined independently of the values that you specify in the VALUES= option.

Optional Arguments

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 in which they appear in the data.
FORMATTED
sorts the formatted values in ascending character order.
UNFORMATTED
sorts the unformatted values in ascending character order.
Default:UNFORMATTED
Restriction:This option affects only box plots, dot plots, bar charts, and line plots, 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 has no effect if used with the vertical (Y or Y2) axes; only the THIN fit policy is used for vertical axes.
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.
INTERVAL= interval-value
specifies the tick interval for a time axis. Specify one of the following values:
AUTO
determines the tick interval automatically based on the data.
SECOND
places ticks one second apart. The default tick value format is TIME8.
MINUTE
places ticks one minute apart. The default tick value format is TIME8.
HOUR
places ticks one hour apart. The default tick value format is TIME8.
DAY
places ticks one day apart. The default tick value format is DATE9.
WEEK
places ticks one week apart. The default tick value format is DATE9.
TENDAY
places ticks ten days apart. The default tick value format is DATE9.
SEMIMONTH
places ticks at the first and sixteenth day of each month. The default tick value format is DATE9.
MONTH
places ticks one month apart. The default tick value format is MONYY7.
QUARTER
places ticks three months apart. The default tick value format is YYQC6.
SEMIYEAR
places ticks six months apart. The default tick value format is MONYY7.
YEAR
places ticks one year apart. The default tick value format is YEAR4.
Default:AUTO
LABEL= “text-string
specifies a label for the axis.
LABELATTRS= style-element <(options)> | (options)
specifies the appearance of the axis labels. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can also specify suboptions to override specific appearance attributes.
options can be one or more of the following:
COLOR= color
specifies the color of the label characters. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the Color attribute of the GraphLabelText style element in the current style. For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.
FAMILY= “font-family
specifies the font family for the label characters. The SAS ODS styles use TrueType system fonts. For more information, see TrueType Fonts Supplied by SAS in SAS Language Reference: Concepts.
Default:The default font family is specified by the FontFamily attribute of the GraphLabelText style element in the current style.
Restriction:You cannot specify a list of font family names.
SIZE= n <units>
specifies the font size of the label characters. You can also specify the unit of measurement. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:The default font size is specified by the FontSize attribute of the GraphValueText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the label characters are italic or normal.
Default:The default font style is specified by the FontStyle attribute of the GraphLabelText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the label characters are bold or normal.
Default:The default font weight is specified by the FontWeight attribute of the GraphLabelText style element in the current style.
Interaction:This option has no effect unless CURVELABEL is also specified.
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.
Restriction:This option affects linear, log, and time axes only.
Interaction:This option has no effect if you specify the VALUES= option and you do not also specify the VALUESHINT option.
MIN= numeric-value
specifies the minimum value for the axis.
Restriction:This option affects linear, log, and time axes only.
Interaction:This option has no effect if you specify the VALUES= option and you do not also specify the VALUESHINT option.
MINOR
adds minor tick marks to a log or time axis.
Restriction:This option has no effect on linear or discrete axes.
Interaction:This option has no effect if you specify the VALUES= option.
NOTIMESPLIT
prevents a time axis from splitting the time, date, or datetime values into two rows.
Restriction:This option applies to time axes only.
OFFSETMAX= numeric-value
specifies an offset that follows the highest data value on the axis. Specify a value between 0 and 1.
The value represents the offset as a proportion to the total length of the axis. For a continuous axis, the offset follows the highest data value or highest tick value, whichever is greater. For a discrete axis, the offset is applied to the end of the axis farther from the origin.
Default:The offset space is determined automatically based on the data values, tick mark values, markers, and labels that are inside of the plot area.
OFFSETMIN= numeric-value
specifies an offset that precedes the lowest data value on the axis. Specify a value between 0 and 1.
The value represents the offset as a proportion to the total length of the axis. For a continuous axis, the offset precedes the lowest data value or lowest tick value, whichever is less. For a discrete axis, the offset is applied to the end of the axis nearer to the origin.
Default:The offset space is determined automatically based on the data values, tick mark values, markers, and labels that are inside of the plot area.
REFTICKS
adds tick marks to axis that is opposite from the specified axis. For example, if you specify the REFTICKS option in 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.
REVERSE
specifies that the tick values are displayed in reverse (descending) order.
THRESHOLDMAX= numeric-value
Specifies a threshold for displaying one more tick mark at the high end of the axis.
THRESHOLDMIN= numeric-value
Specifies a threshold for displaying one more tick mark at the low end of the axis.
TICKVALUEFORMAT= DATA | SAS-format
specifies the format for the axis tick values. You can either specify a SAS format or specify DATA, which indicates that the format from the axis variable is used.
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. In addition, 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, except when the data is discrete or when the numeric variable has a date or time format.
LOG
specifies a logarithmic scale for the axis. This axis type is never a default.
Interaction:A logarithmic scale cannot be used with linear regression plots (REG statement where DEGREE=1).
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.
VALUEATTRS= style-element <(options)> | (options)
specifies the appearance of the axis tick value labels. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can also specify suboptions to override specific appearance attributes.
options can be one or more of the following:
COLOR= color
specifies the color of the label characters. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the Color attribute of the GraphValueText style element in the current style. For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.
FAMILY= “font-family
specifies the font family for the label characters. The SAS ODS styles use TrueType system fonts. For more information, see TrueType Fonts Supplied by SAS in SAS Language Reference: Concepts.
Default:The default font family is specified by the FontFamily attribute of the GraphValueText style element in the current style.
Restriction:You cannot specify a list of font family names.
SIZE= n <units>
specifies the font size of the label characters. You can also specify the unit of measurement. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:The default font size is specified by the FontSize attribute of the GraphValueText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the label characters are italic or normal.
Default:The default font style is specified by the FontStyle attribute of the GraphValueText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the label characters are bold or normal.
Default:The default font weight is specified by the FontWeight attribute of the GraphValueText style element in the current style.
VALUES= ( values-list )
specifies the values for the ticks on an axis.
For values on a linear axis, the values list can be one of the following:
value <...value-n>
creates ticks for specific values. For example, VALUES= (0 50 100) places tick marks at 0, 50, and 100.
value-1 TO value-2 BY increment-value
creates ticks for a range of values. The start of the value range is specified by value-1 and the end of the range is specified by value-2. The increment-value specifies the interval between the ticks. For example, VALUES= (0 to 100 by 50) creates tick marks at 0, 50, and 100.
<value ... value-n>value-1 TO value-2 BY increment-value <value ... value-n>
creates ticks for specific values, and also creates ticks for a range of values. The start of the value range is specified by value-1 and the end of the range is specified by value-2. The increment-value specifies the interval between the ticks.
For example, VALUES= (-5 10 to 50 by 20 75) creates tick marks a -5, 10, 30, 50, and 75.
For values on a time axis, the values list can be one of the following:
value <...value-n>
creates ticks for specific values. For example, VALUES= ("25MAY08"d "04JUL08"d "23AUG08"d) places tick marks at 25MAY08, 04JUL08, and 23AUG08.
value-1 TO value-2 BY increment-value
creates ticks for a range of values. The start of the value range is specified by value-1 and the end of the range is specified by value-2. The increment-value specifies the interval between the ticks. For example, VALUES= ("01JAN08"d to "01MAY08"d by month) creates tick marks at 01JAN08, 01FEB08, 01MAR08, 01APR08, and 01MAY08.
For a list of the interval values that you can specify, see the INTERVAL= option.
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.

Interaction:If a custom format is applied to the value, the raw value is plotted first and then formatted.
VALUESHINT
specifies that the minimum and maximum axis values are determined independently of the values that 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.
Interaction:This option has no effect unless you also specify the VALUES= option.