Overlay-type
layouts (OVERLAY, OVERLAYEQUATED, and PROTOTYPE, for example) build
a composite from one or more
GTL-statements.
Within
overlay-type layouts, if you do not explicitly set axis features in
your template statements, the GTL automatically determines them. It
sets the axis features based on the layout(s) and plot(s) in the layout
block and the data that are associated with the template at run time.
If only
one plot statement within an overlay-type layout generates an axis,
then determining axis features is straight forward: the features are
derived directly from the plot type and the columns that are used
for the plot data. For example, if a LAYOUT OVERLAY block contains
a single SCATTERPLOT and the X variable specifies a numeric column
of children’s weights, the default X-axis type is LINEAR. The
default X-axis label is the column label of the WEIGHT variable. If
the WEIGHT variable has no defined label, the column name is used
as a label.
When an
overlay-type layout contains multiple plots that generate axes, the
GTL can determine default axis features for the shared axes. Alternatively,
you can use the PRIMARY= option on one of the plot statements to specify
which plot you want the GTL to use. The following code fragment explicitly
specifies that the SCATTERPLOT of children’s weights be used
to determine axis features within the layout:
layout overlay;
scatterplot x=weight ... / primary=true;
...
-
If no plot in an overlay-type layout
is designated as primary, the data columns associated with the first
plot that generates an axis are considered primary on a per-axis basis.
-
If PRIMARY=TRUE for a plot within
an overlay-type layout, that plot’s data columns and data type
determine the default axis features. An explicitly specified primary
plot determines the default axis features regardless of where that
plot statement occurs within the layout block.
-
Only one plot can be primary on
a per-axis basis. If multiple plots specify PRIMARY=TRUE for the same
axis, the last one encountered is considered primary.
The following
SCATTERPLOT specifies a string variable on the X= argument:
layout overlay;
scatterplot x=name ... / primary=true;
...
In this
case, the default X-axis type is DISCRETE and the X-axis label is
the column label of NAME, or the column name if no label exists.
If a SCATTERPLOT’s
X= argument specifies a column that has a SAS DATETIME format, the
default X-axis type is TIME and the default X-axis label is the column
label or name of the datetime column:
layout overlay;
scatterplot x=date ... / primary=true;
...
For some
plot types, the default axis type does not directly correlate to the
specified column’s data type. For example, the following code
fragment specifies a BARCHART for the numeric column AGE:
layout overlay;
barchart x=age ... / primary=true;
...
Because
a BARCHART requires a discrete X axis, the default X-axis type in
this case is DISCRETE, in spite of the fact that column AGE is numeric.
The X-axis label is the column label of AGE, or the column name if
no label exists.
Finally,
consider a HISTOGRAM that is set as the primary plot in the layout
and that bins data values:
layout overlay;
histogram weight / binaxis=true primary=true;
...
In this
case, the default X-axis type is LINEAR, but the histogram’s
data bins are used by default as the basis for the axis tick marks.