proc areadef defines a rectangular area where subsequent scaled plotting will take place.
The size, location of the rectangle are specified, and the
scaling method and range of both X and Y are defined here.
proc areadef may be used any number of times within the same script
to do multiple plots per page, to produce multiple page results, or to
overlay different scales or units on the same plot, but only one plotting
area and scale system is in effect at any one time (referred to as the "current plotting area").
Various scaling types, including linear, log, date, time and category are available for X and Y.
xautorange and yautorange attributes
can be used to perform automatic axis scaling based on the data.
Clickmap and mouseover support
is available for the plotting area grid or as a whole.
The range in X and Y must be specified, either using
xrange / yrange, or
xautorange / yautorange.
If nothing else is specified,
default behaviour is for the standard
plotting area to be used, with linear scaling in x and y.
Location & size of the plotting rectangle
The size and location of the plotting area
on a page (the plotting area) may be specified in one
of these three ways:
- by specifying a rectangle (two points) using the rectangle attribute;
- by specifying plotting area size using
the box attribute and the location using the location attribute.
- by name using the areaname attribute;
You can also make the plot area size vary automatically based on how much data you are plotting
(autowidth and autoheight).
x1 y1 x2 y2
Allows a plotting area to be defined by giving two points:
(x1,y1) is the lower left corner
and (x2,y2) is the upper right corner
(both are in
Example: rectangle: 1.4 4 7.4 8
Allows a plotting area to be defined by giving width and height in
A location attribute should also be given to
specify where to place the box.
Example: box: 1.4 4
Used with the box attribute.
Defines the location of the lower-left corner of the plotting area.
Allows a plotting area to be defined by selecting a
predefined rectangle by
These are most useful when generating plots on standard paper.
Example: areaname: 2hi
[minallowablesize maxallowablesize [align=right]]
If specified, the width of the plotting area will be automatically adjusted based on the X data range.
This allows dynamic unattended plots to be sized appropriately whether the X range is 0 to 5 or 0 to 50.
Plotting area width will be revised
to f times the number of basic units in the range of X, in absolute units.
You can optionally set a minallowablesize and a maxallowablesize (both in absolute units)
that the plot will never be smaller than, or larger than, respectively
Beforehand, the plotting area must be defined using rectangle or some other similar attribute(s),
and the plotting must be large enough to accommodate the largest expected width (otherwise truncation can occur).
rectangle: 1 1 6 3
autowidth: 0.3 3.0 8.0
For example, if there are 12 categories represented in your data, 12 x 0.3 = 3.6, so the resulting
plotting area would be 3.6 inches wide.
If there are 20 categories, 20 x 0.3 = 6.0, and the resulting
plotting area would be 6.0 inches wide.
If there are only six categories, the resulting plot would have been 1.8 inches wide,
however a minimum allowable size of 3.0 inches was specified, so the plot will be 3 inches wide.
If there are 40 categories, the resulting plot would have been 12 inches wide,
however a maximum allowable size of 8.0 inches was specified, so the plot will be 8 inches wide.
align=right (new in 2.40) fixes the right side of the plot, with width adjustments affecting the left side
(but be sure that maxallowablesize doesn't force the left side into negative space).
Remember that with date and datetime scaling the basic unit is the day, and with time
scaling the basic unit is the minute.
[minallowablesize maxallowablesize [valign=top]]
Allows the height of the plotting area to be determined by the data range in Y.
Works similarly to autowidth above.
1 | 0
If using category scaling where the categories are centered (shifted such that the first is at 0.5, the second at 1.5, etc.)
this attribute may be specified as 1 to eliminate the extra space in the plotting area near the maxima. (New in 2.41)
Scaling method & range in X and Y
Defines the type of scaling that will be in effect for the X axis.
Supported types include:
linear the default; continuous linear
log log+1 logarithmic scaling
date scaling based on date values, usually in X
time scaling based on time values, usually in X
datetime for plotting time values over several days
categories bins for categorical data.
The format parameter may be given with
date, time, or datetime, to set the default date/time notation. See
for discussion of the various scale types and units, and the
gallery scale & axis examples.
Example: xscaletype: date yymm
Example: xscaletype: datetime mm/dd/yyyy.hh:mm
Example: xscaletype: categories
Defines the type of scaling for the Y axis.
Same syntax as xscaletype above.
Default is linear.
Occasionally it is useful to revise the plotting units after the initial areadef has been done.
To do this, use the
min max | categories
Defines the plottable range in x. min and max must both be given,
and must both be plottable values with respect to xscaletype.
(To set a continuous range automatically using a data field, use xautorange.)
If log scaling is being used, 0.0 may not given as the minima (but a very small value like 0.01 is ok).
If date, time, log, categories, or other special type of scaling is to be done,
xscaletype must be set appropriately.
If you want, you can specify categories, but this just has the same effect as
setting the scaletype to categories.
Example: if your data ranges in x between
1.5 and 23.5 you might use: xrange: 0 24
Example: xrange: categories
Example: xrange: 01FEB2002 28FEB2002
Example: xrange: 01FEB2002.00:00 04FEB2002.24:00
datafield=dfields .. other subattributes..
This may be used as an alternative to xrange, in order to automatically
find an appropriate range based on the data. dfields are the data field(s) to be scanned.
This attribute has its own
Defines the plottable range in y. See xrange above.
datafield=dfield .. other subattributes..
This may be used as an alternative to yrange, in order to automatically
find an appropriate range based on the data. Similar to xautorange.
This attribute has its own
The old syntax for defining categories within proc areadef is set forth below.
This syntax is deprecated (support may be dropped in a future release). New projects should use
which has additional capabilities and higher capacities.
xcategories ..define a set of categories to be used in X.
ycategories ..define a set of categories to be used in Y.
xextracategory ..allows an extra X axis category to be added explicitly
yextracategory ..allows an extra Y axis category to be added explicitly
catcompmethod ..control the details of how category comparisons are done.
X and Y axes are generated by
; however, axis attributes may be specified from within proc areadef
as a convenience. This usually involves adding a xaxis. or yaxis. prefix
to the attribute name. If axes are defined this way then the plotting area and axes can all be
as a unit.
proc axis attributes for the x axis. Any proc xaxis attributes may be used
from within proc areadef as a convenience, by prefixing the name with xaxis..
proc yaxis options for the y axis. Any proc yaxis attributes may be used
from within proc areadef as a convenience, by prefixing the name with yaxis..
axisline, tic*, minortic*
These proc xaxis/yaxis attributes may be defined within
proc areadef to control both axes.
xscaletype: date dd-Mmm-yyyy
xrange: 01-Jun-2003 15-Jun-2003
yrange: 0 100
xaxis.stubs: inc 3 day
yaxis.label: Percent occupied
Other attributes of the plotting area
Specifies a plot title (not a page title).
Plot title will appear above the upper left corner
of the plotting area by default.
Example: title: Subgroup 24-C
Text details for the plot title.
Example: titledetails: align=R size=9 style=I
Allows a second title to be specified. May be useful to create
a plot header on both left and right.
Text details for the second plot title.
Causes the area background to be filled with color.
Example: areacolor: yellow
| no | yes | bevel
Specifies a box or frame around the plotting area.
Options are: no (no frame), yes (do
a default line frame), bevel for a beveled gray frame,
or a line detail specification,
which results in a frame made of lines with the given characteristics
(A bevel frame will probably clash with tics and stubs
unless these are positioned inward.)
Example 1: frame: none
Example 2: frame: color=red width=4.0
Example 3: frame: bevel
Specifies a line to be drawn along the bottom edge of the plotting
area. This is just a line, not an X axis.
Example: linebottom: yes
Example: linebottom: none
Example: linebottom: width=0.5 color=green
Same as linebottom but specifies a line to be drawn along
the left side. This is just a line, not a Y axis.
Clickmaps and mouseover
is being generated, and the plotting area is being mapped as a grid,
this attribute must be specified to supply a URL template, into which
@@XVAL and/or @@YVAL will be substituted.
You'll also need to set
proc axis's clickmap attribute
to indicate whether the grid will be associated with one axis or both.
See also the
for more details and examples.
Example: clickmapurl: http://abc.com/cgi-bin/details?x=@@XVAL&y=@@YVAL
This attribute can also be used to make the entire plotting area one clickable region.
This will be done if niether @@XVAL nor @@YVAL are found in the template.
If generating a
region encompassing the entire plotting area,
this specifies a mouseover text label.
Example: clickmaplabel: Animals tested without drug effect
Same as clickmaplabel but multiline text. Must be terminated with a blank line.
Adjust (move) the entire clickmap grid by (x, y) in absolute units. (New in 2.41)
Variables set by proc areadef
Areadef will set the variables AREALEFT, AREARIGHT,
AREABOTTOM, and AREATOP
to hold the locations of the plot area edges in
Also, XMIN, XMAX, YMIN, and YMAX are set to the
scaled space boundaries.
Pre-defined plotting area names
Pre-defined plotting area names, used with the areaname: attribute, are:
standard the default
square a square area
whole as much of the page as possible
2hi, 2lo two plots on a page, one above the other
2left, 2right two plots on a page, side by side
3hi, 3mid, 3lo three plots on a page
4ne, 4nw, 4se, 4sw four plots on a page (ne = northeast)