## GSCALE Call

**calculates round numbers for labeling axes**
**CALL GSCALE(** *scale, **x*, nincr<, nicenum><,
fixed-end>**);**

The inputs to the GSCALE subroutine are as follows:
*scale*
- is a returned vector containing the scaled minimum data
value, the scaled maximum data value, and a grid increment.

*x*
- is a numeric matrix or literal.

*nincr*
- is the number of intervals desired.

*nicenum*
- is numeric and provides up to ten numbers to use for scaling.
By default,
*nicenum* is (1,2,2.5,5).

*fixed-end*
- is a character argument and specifies
which end of the scale is held fixed.
The default is
`X`

.

The GSCALE subroutine obtains simple (round) numbers with
uniform grid interval sizes to use in scaling a linear axis.
The GSCALE subroutine implements algorithm
463 of Collected Algorithms from CACM.
The scale values are integer multiples of the interval size.
They are returned in the first
argument, a vector with three elements.
The first element is the scaled minimum data value.
The second element is the scaled maximum data value.
The third element is the grid increment.
The required input parameters are *x*, a matrix of data
values, and *nincr*, the number of intervals desired.
If *nincr* is positive, the scaled range
includes approximately *nincr* intervals.
If *nincr* is negative, the scaled range
includes exactly ABS(*nincr*) intervals.
The *nincr* parameter cannot be zero.

The *nicenum* and *fixed-end* arguments are optional.
The *nicenum* argument provides up to ten numbers, all between
1 and 10 (inclusive of the end points), to be used for scaling.
The default for *nicenum* is 1, 2, 2.5, and 5.
The linear scale with this set of numbers is
a scale with an interval size that is the product of
an integer power of 10 and 1, 2, 2.5, or 5.
Changing these numbers alters the rounding of the scaled values.

For *fixed-end*, `U`

fixes the upper end;
`L`

fixes the lower end; `X`

allows both ends to vary from the data values.
The default is `X`

.
An example using the GSCALE subroutine follows:

/* scalemat is set to {0,1000,100} */
call gscale(scalmat, {1 1000}, 10);

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.