SAS 9.4 Graph Template Language Reference
SAS 9.4 Graph Template Language Reference
4®
SAS® Documentation
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2015. SAS® 9.4 Graph Template Language: Reference, Fourth
Edition. Cary, NC: SAS Institute Inc.
SAS® 9.4 Graph Template Language: Reference, Fourth Edition
Copyright © 2015, SAS Institute Inc., Cary, NC, USA
PART 1 Fundamentals 1
Chapter 1 • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Graph Template Language (GTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Basic Anatomy of an ODS Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Graphical Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Flexible Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
About the Examples in This Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Examples and Resources on the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Overview
New and enhanced statements for the Graph Template Language (GTL) extend the
versatility of the language and introduce new plot types. The following changes are
included in this release:
• new plot statements
• new features for general use
• enhancements to SAS 9.3 statements
There are changes in GTL for SAS 9.4 and subsequent maintenance releases that might
require you to modify your existing SAS GTL programs. These changes can impact SAS
GTL programs that use the DENSITYPLOT or BARCHART statements. Review this
section carefully to determine whether you need to modify your existing SAS GTL
programs for SAS 9.4.
• TEXTPLOT displays text values at specific X and Y locations in the graph. For
information about subsequent enhancements to this statement, see “Plot Statement
Enhancements” on page xiv.
In the third maintenance release of SAS 9.4, the following statement is new:
• HEATMAP creates a plot of color-coded rectangles for the response variable of a
pair of X and Y variables after it bins the data in two dimensions.
In the first maintenance release of SAS 9.4, the following statements are new:
• SYMBOLCHAR defines a marker symbol from a Unicode character value.
• SYMBOLIMAGE defines a marker symbol from a GIF, JPG, or PNG image that is
stored in a file.
You can use these statements to define custom marker symbols for your graphs. For
information about subsequent enhancements to these statements, see “Marker Definition
Statement Enhancements” on page xxxvii.
New Function
In the first maintenance release of SAS 9.4, the TYPEOF function is new. This function
returns the type (numeric or character) of a specified column at run time. You can use the
TYPEOF function to take specific actions in your template at run time based on the input
data type.
pattern constant. When all of the colors have been used, it increments to the next marker
symbol, line pattern, or fill pattern, and then repeats the colors.
Color-priority rotation is enabled in one of the following ways:
• the currently active style sets the Graph:attrPriority attribute to COLOR
• the ATTRPRIORITY=COLOR option is specified in the ODS GRAPHICS
statement, which overrides the Graph:attrPriority style attribute
• the ATTRPRIORITY=COLOR option is specified in the BEGINGRAPH statement
of the template, which overrides the ODS GRAPHICS ATTRPRIORITY= option for
all plots in that template
When none of these conditions are true, the default rotation pattern is used. For more
information, see “BEGINGRAPH Statement Enhancements” on page xi.
Outer Padding
The GTL provides a new OUTERPAD= option that enables you to control the padding
around the outside of layouts, legends, titles, footnotes, and text entries. You can use this
option to modify the outer padding when the default padding is not sufficient. You can
specify a single padding value for all four sides, or you can specify different values for
each side.
ODS Graphics does not support the use of a user-defined ODS escape character to
escape Unicode values in user-defined formats.
BEGINGRAPH Statement Enhancements xi
• The baseline is now drawn by default. To suppress the baseline, use the
BASELINEATTRS= option to set the line thickness to 0.
• DATALABELFITPOLICY= specifies a policy for avoiding collisions among the bar
labels when bar labels are displayed.
• STAT= now supports PROPORTION, which displays proportions in the range 0–1.
• STAT=PCT now displays percentages in the range 0–100 in order to be consistent
with other GTL statements.
Note: In prior SAS releases, the BARCHART statement STAT=PCT option displays
proportional values in the range 0–1. To restore the original STAT=PCT results in
SAS 9.4 and later releases, specify STAT=PROPORTION in your BARCHART
statements instead.
• TIP= now supports NONE, which suppressed data tips and URLs from the plot.
• Starting with the second maintenance release of SAS 9.4, the following
enhancements are valid:
• GROUPORDER= supports REVERSEDATA, which orders the groups within a
category in the reverse group-column data order.
• FILLTYPE= specifies whether the fill color is solid or is a gradient that
transitions from fully opaque to fully transparent.
• SEGMENTLABEL= specifies whether a label is displayed inside each bar
segment.
• SEGMENTLABELATTRS= specifies the text properties of the bar segment label
text.
• SEGMENTLABELFITPOLICY= specifies a policy for fitting the bar segment
labels within the bar segments.
• SEGMENTLABELFORMAT= specifies the text format used to display the bar
segment labels.
• Starting with the third maintenance release of SAS 9.4, the following enhancements
are valid:
• The BARCHART statement now supports a linear category axis or a time
category axis.
• COLORBYFREQ= specifies whether the bar colors are based on the frequency
of the category variable.
• COLORMODEL= specifies a color ramp that is to be used with the
COLORRESPONSE= option or the COLORBYFREQ= option.
• COLORRESPONSE= specifies the column or range attribute variable that is
used to map the bar colors.
• COLORSTAT= specifies the statistic to use for computing the response colors.
• DISPLAYZEROLENGTHBAR= specifies whether zero-length bars are drawn.
• GROUP100= displays the computed response values (FREQ, SUM, or MEAN),
normalized to 100%.
• INTERVALBARWIDTH= specifies the width of the bars in an interval bar chart
as a ratio of the interval width.
BARCHARTPARM:
Plot Statement Enhancements xvii
• CAPSHAPE= now supports NONE, which specifies that no shape is displayed at the
ends of the box whiskers.
• DATALABELSPLIT= specifies whether to split the data labels at specified split
characters.
• DATALABELSPLITCHAR= specifies one or more characters on which the data
labels can be split if needed.
• DATALABELSPLITCHARDROP= specifies whether the split characters are
included in the data labels.
• DATALABELSPLITJUSTIFY= specifies the justification of the strings that are
inside the data label blocks.
• DATASKIN= enhances the visual appearance of the filled boxes.
• TIP= now supports NONE, which suppresses data tips from the plot.
• Starting with the first maintenance release of SAS 9.4, the following enhancements
are valid:
• DISPLAYSTATS= now displays the DATAMAX, DATAMIN, and SUMWGT
statistics.
• LEGENDLABEL= now defaults to the Y= column label or name.
• URL= specifies an HTML page that is displayed when a box or an outlier marker
is selected.
• Starting with the second maintenance release of SAS 9.4, the GROUPORDER=
option supports REVERSEDATA, which orders the groups within a category in the
reverse group-column data order.
• Starting with the third maintenance release of SAS 9.4, when DISPLAY= includes
MEAN, the BOXPLOTPARM statement contributes its mean markers to a discrete
legend when TYPE=MARKER is specified in the DISCRETELEGEND statement.
BUBBLEPLOT:
• DATALABELSPLIT= specifies whether to split the data labels at specified split
characters.
• DATALABELSPLITCHAR= specifies one or more characters on which the data
labels can be split if needed.
• DATALABELSPLITCHARDROP= specifies whether the split characters are
included in the data labels.
• DATALABELSPLITJUSTIFY= specifies the justification of the strings that are
inside the data label blocks.
• TIP= now supports NONE, which suppresses data tips and URLs from the plot.
• Starting with the third maintenance release of SAS 9.4, DRAWORDER= specifies
whether the bubbles are drawn according to bubble size or according to data order.
CONTOURPLOTPARM:
• LEVELS= specifies a list of contour level values.
DENDROGRAM:
• TIP= now supports NONE, which suppresses data tips and URLs from the plot.
DENSITYPLOT:
xx Graph Template Language
• TIP= now supports NONE, which suppresses data tips and URLs from the plot.
• Starting with the second maintenance release of SAS 9.4, the
INCLUDEMISSINGCOLOR= option specifies whether missing values of the color-
group variable or the color-response variable are included in the plot.
• Starting with the third maintenance release of SAS 9.4, the following enhancements
are valid:
• DISCRETEX= specifies whether the X axis is discrete when X= specifies a
numeric column.
• DISCRETEY= specifies whether the Y axis is discrete when Y= specifies a
numeric column.
HIGHLOWPLOT:
• CLIPCAP= specifies whether a special clip cap is displayed to indicate where
clipping occurred.
• CLIPCAPSHAPE= specifies the shape of the arrowhead on the clipped end of a line.
• DATASKIN= enhances the visual appearance of the high-low chart filled bars or
lines.
• ENDCAPDISPLAYPOLICY= specifies the policy for displaying end caps when end
caps are present.
• TIP= now supports NONE, which suppresses data tips from the plot.
• Starting with the second maintenance release of SAS 9.4, the GROUPORDER=
option supports REVERSEDATA, which orders the groups within a category in the
reverse group-column data order.
• Starting with the third maintenance release of SAS 9.4, the following enhancements
are valid:
• COLORMODEL= specifies a color ramp that is used with the
COLORRESPONSE= option.
• COLORRESPONSE= specifies the column or range attribute variable that is
used to map the bar or line colors.
HISTOGRAM:
• DATALABELTYPE= specifies the statistic to display at the end of each bar.
• DATASKIN= enhances the visual appearance of the filled bars.
• WEIGHT= specifies a column that contains a bin-width calculation a priori weight
for each observation of the input data object.
• Starting with the first maintenance release of SAS 9.4, the following enhancements
are valid:
• The number of bins is limited to approximately 10,000. When the limit is
exceeded, SAS automatically adjusts the NBINS= or BINWIDTH= value to set
the number of bins to about 10,000.
• DISPLAY= now supports FILLPATTERN.
• FILLPATTERNATTRS= specifies the appearance of the pattern-filled bar area.
• Starting with the second maintenance release of SAS 9.4, the following
enhancements are valid:
• FILLTYPE= specifies whether the fill color is solid or is a gradient that
transitions from fully opaque to fully transparent.
xxii Graph Template Language
• GROUP= creates a separate bar segment or bar for each unique group value of
the specified column.
• INCLUDEMISSINGGROUP= specifies whether missing values of the group
variable are included in the plot.
• The OUTLINEATTRS= option defaults are now consistent with that of
BARCHART.
HISTOGRAMPARM:
• DATALABELFITPOLICY= specifies a policy for avoiding collisions among the bin
labels when bin labels are displayed.
• DATALABELSPLITCHAR= specifies one or more characters on which the data
labels can be split if needed.
• DATALABELSPLITCHARDROP= specifies whether the split characters are
included in the data labels.
• DATASKIN= enhances the visual appearance of the filled bars.
• TIP= now supports NONE, which suppresses data tips from the plot.
• Starting with the first maintenance release of SAS 9.4, the following enhancements
are valid:
• DISPLAY= now supports FILLPATTERN.
• FILLPATTERNATTRS= specifies the appearance of the pattern-filled bar area.
• Starting with the second maintenance release of SAS 9.4, the FILLTYPE= option
specifies whether the fill color is solid or is a gradient that transitions from fully
opaque to fully transparent.
LINECHART:
• Starting with the second maintenance release of SAS 9.4, the GROUPORDER=
option supports REVERSEDATA, which orders the groups within a category in the
reverse group-column data order.
• Starting with the third maintenance release of SAS 9.4, the following enhancements
are valid:
• COLORMODEL= specifies a color ramp that is used with the
COLORRESPONSE= option.
• COLORRESPONSE= specifies the column or range attribute variable that is
used to map the line, marker, and fill colors.
LINEPARM:
• CURVELABELSPLIT= specifies whether to split the line label at the specified split
characters.
• CURVELABELSPLITCHAR= specifies one or more characters on which the line
label can be split if needed.
• CURVELABELSPLITCHARDROP= specifies whether the split characters are
included in the line label text.
• CURVELABELSPLITJUSTIFY= specifies the justification of the strings that are
inside the line label block.
LOESSPLOT:
• CURVELABELSPLIT= specifies whether to split the curve label at the specified
split characters.
Plot Statement Enhancements xxiii
• ERRORBARCAPSHAPE= specifies whether the error bars have a serif cap. Starting
with the second maintenance release of SAS 9.4, this option defaults to style
reference GraphError:CapStyle.
• FILLEDOUTLINEDMARKERS= specifies whether markers are drawn with both
fills and outlines.
• JITTER= specifies whether to jitter data markers.
• JITTEROPTS= specifies options for managing jittering.
• LABELSTRIP= specifies whether leading and trailing blanks are stripped from
marker characters or fixed-position data labels before they are displayed in the plot.
• MARKERATTRS= now supports transparency.
• MARKERCHARACTERPOSITION= specifies the justification of the marker
characters.
• MARKERFILLATTRS= specifies the appearance of the filled markers.
• MARKEROUTLINEATTRS= specifies the appearance of the marker outlines.
• TIP= now supports NONE, which suppresses data tips and URLs from the plot.
• Starting with the first maintenance release of SAS 9.4,
OUTLINEDMARKERCHARACTERS= specifies whether backlighting or a drop
shadow is applied to the characters that are used as marker symbols in order to
enhance their appearance in the graph.
• Starting with the second maintenance release of SAS 9.4:
• CONTRIBUTEOFFSETS= specifies whether the plot's space requirements
contribute to the calculation of the axis offsets.
• The GROUPORDER= option supports REVERSEDATA, which orders the
groups within a category in the reverse group-column data order.
• The following options are replaced and considered deprecated:
• MARKERCOLORGRADIENT= is replaced with COLORRESPONSE=.
• MARKERSIZERESPONSE= is replaced with SIZERESPONSE=.
• MARKERSIZEMAX= is replaced with SIZEMAX=.
• MARKERSIZEMIN= is replaced with SIZEMIN=.
The new options are functionally the same as the deprecated options and are
more consistent with the other plot statements. The deprecated options are still
honored, but the new options are the preferred options.
• The OUTLINEDMARKERCHARACTERS= option is deprecated. It is still
honored, but the TEXTPLOT statement is now the preferred method for creating
scatter plots using text markers.
• Starting with the third maintenance release of SAS 9.4, SUBPIXEL= specifies
whether subpixel rendering is used for image output when the scatter plot is
rendered.
SCATTERPLOTMATRIX:
• DATALABELSPLIT= specifies whether to split the data labels at specified split
characters.
• DATALABELSPLITCHAR= specifies one or more characters on which the data
labels can be split if needed.
xxvi Graph Template Language
• Starting with the third maintenance release of SAS 9.4, COLORSTAT= specifies the
statistic to use for computing the response colors.
• TICKDISPLAYLIST= specifies the text that is displayed for the tick values that
are defined in the TICKVALUELIST= option.
• TICKVALUEFITPOLICY= supports new fit policies: ROTATE,
ROTATEALWAYS, ROTATELAWAYSDROP, SPLIT, SPLITALWAYS,
SPLITALWAYSTHIN, SPLITTHIN, and SPLITROTATE.
• TICKVALUELIST= specifies the list of tick values that are displayed on the
axis.
• TICKVALUEROTATION= specifies how the tick values are rotated on the X
and X2 axes.
• TICKVALUESPLITCHAR= specifies a list of characters on which the tick
values can be split if needed.
• TICKVALUESPLITJUSTIFY= specifies justification of the strings that are
inside the tick value block.
• TICKVALUESPLITCHARDROP= specifies whether the split characters are
included in the displayed tick values.
• Starting with the third maintenance release of SAS 9.4, TICKVALUEFORMAT=
specifies how to format the values for major tick marks.
• LINEAROPTS= supports the following new features for linear axes:
• MINORGRID= specifies whether grid lines are displayed at the minor tick
values.
• MINORGRIDATTRS= specifies the attributes of the minor grid lines.
• MINORTICKCOUNT= specifies the number of minor ticks that are displayed on
the axis.
• MINORTICKS= specifies whether the minor tick marks are displayed on the
axis.
• TICKDISPLAYLIST= specifies the text that is displayed for the tick values that
are defined in the TICKVALUELIST= option.
• TICKVALUEFITPOLICY= now supports policies NONE and
ROTATEALWAYS.
• TICKVALUEFORMAT= now supports EXTRACTSCALETYPE=, which
enables you to specify the type of scale that you want to extract.
• TICKVALUEROTATION= specifies how the tick values are rotated on the X
and X2 axes.
• Starting with the first maintenance release of SAS 9.4, INCLUDERANGES=
specifies the ranges for a broken axis.
• Starting with the second maintenance release of SAS 9.4:
• The MINORGRID= option defaults to style reference
GraphMinorGridLines:DisplayOpts.
• The MINORGRIDATTRS= option defaults to style element
GraphMinorGridLines in order to visually contrast the major and minor grid
lines.
• The MINORTICKCOUNT= option for linear axes defaults to one minor tick
and two intervals.
• LOGOPTS= supports the following new features for log axes:
xxxii Graph Template Language
• MINORGRID= specifies whether grid lines are displayed at the minor tick
values.
• MINORGRIDATTRS= specifies the attributes of the minor grid lines.
• MINORTICKCOUNT= specifies the number of minor ticks that are displayed on
the axis.
• TICKVALUELIST= specifies the tick values for a log axis as a space-separated
list.
• TICKVALUEPRIORITY= specifies whether the TICKVALUELIST=
specification can extend the axis data range.
• VALUETYPES= specifies how the VIEWMIN=, VIEWMAX=, and
TICKVALUELIST= option values are interpreted.
• Starting with the second maintenance release of SAS 9.4:
• The MINORGRID= option defaults to style reference
GraphMinorGridLines:DisplayOpts.
• The MINORGRIDATTRS= option defaults to style element
GraphMinorGridLines in order to visually contrast the major and minor grid
lines.
• Starting with the third maintenance release of SAS 9.4, TICKVALUEFORMAT=
specifies how to format the values for major tick marks.
• TIMEOPTS= supports the following new features for time axes:
• MINORGRID= specifies whether grid lines are displayed at the minor tick
values.
• MINORGRIDATTRS= specifies the attributes of the minor grid lines.
• MINORTICKINTERVAL= specifies the time interval between minor ticks.
• TICKVALUEFITPOLICY= now supports policies NONE and
ROTATEALWAYS.
• TICKVALUEROTATION= specifies how the tick values are rotated on the X
and X2 axes.
• Starting with the first maintenance release of SAS 9.4, INCLUDERANGES=
specifies the ranges for a broken axis.
• Starting with the second maintenance release of SAS 9.4:
• The MINORGRID= option defaults to style reference
GraphMinorGridLines:DisplayOpts.
• The MINORGRIDATTRS= option defaults to style element
GraphMinorGridLines in order to visually contrast the major and minor grid
lines.
• Starting with the third maintenance release of SAS 9.4,
INTERVALMULTIPLIER= specifies a multiplier to apply to the time interval
that is in effect for the axis.
LAYOUT OVERLAY3D:
• LINEAROPTS= supports the following new features for linear axes:
• MINORGRID= specifies whether grid lines are displayed at the minor tick
values.
• MINORGRIDATTRS= specifies the attributes of the minor grid lines.
Axis Statement Enhancements xxxiii
• LABELSPLITCHAR= specifies one or more characters on which the axis labels can
be split if needed.
• LABELSPLITCHARDROP= specifies whether the split characters are included in
the axis labels.
• LABELSPLITJUSTIFY= specifies the justification of the strings that are inside the
axis label blocks.
• TICKVALUEHALIGN= specifies the horizontal alignment for all of the tick values
that are displayed on the Y and Y2 axes.
• TICKVALUEVALIGN= specifies the vertical alignment for all of the tick values that
are displayed on the X and X2 axes.
• DISCRETEOPTS= supports the following new features for discrete axes:
• TICKDISPLAYLIST= specifies the text that is displayed for the tick values that
are defined in the TICKVALUELIST= option.
• TICKVALUEFITPOLICY= supports new fit policies: ROTATE,
ROTATEALWAYS, ROTATEALWAYSDROP, SPLIT, SPLITALWAYS,
SPLITALWAYSTHIN, and SPLITTHIN.
• TICKVALUELIST= specifies the list of tick values that are displayed on the
axis.
• TICKVALUEROTATION= specifies how the tick values are rotated on the X
and X2 axes.
• TICKVALUESPLITCHAR= specifies a list of characters on which the tick
values can be split if needed.
• TICKVALUESPLITJUSTIFY= specifies justification of the strings that are
inside the tick value block.
• TICKVALUESPLITCHARDROP= specifies whether the split characters are
included in the displayed tick values.
• Starting with the third maintenance release of SAS 9.4, TICKVALUEFORMAT=
specifies how to format the values for major tick marks.
• LINEAROPTS= supports the following new features for linear axes:
• MINORGRID= specifies whether grid lines are displayed at the minor tick
values.
• MINORGRIDATTRS= specifies the attributes of the minor grid lines.
• MINORTICKCOUNT= specifies the number of minor ticks that are displayed on
the axis.
• MINORTICKS= specifies whether the minor tick marks are displayed on the
axis.
• TICKDISPLAYLIST= specifies the text that is displayed for the tick values that
are defined in the TICKVALUELIST= option.
• TICKVALUEFITPOLICY= now supports policies NONE and
ROTATEALWAYS.
• TICKVALUEFORMAT= now supports EXTRACTSCALETYPE=, which
enables you to specify the type of scale that you want to extract.
• TICKVALUEROTATION= specifies how the tick values are rotated on the X
and X2 axes.
Axis Statement Enhancements xxxv
Starting with the first maintenance release of SAS 9.4, the following enhancements are
valid:
• You can now specify the attribute mapping information for a discrete attribute map in
a SAS data set. You now have an alternative to coding your mapping information in
a DISCRETEATTRMAP block in your template. For more information, see SAS
ODS Graphics: Procedures Guide.
• DISCRETEATTRMAP statement:
• DISCRETELEGENDENTRYPOLICY= specifies whether the items that the
associated plot contributes to a discrete legend are items that appear only in the
data or items that are defined only in the attribute map.
• DISCRETEATTRVAR statement:
• ATTRMAP= now accepts a name that is specified in the ID column in a discrete
attribute map data set. This feature enables you to create a discrete attribute map
variable for a discrete attribute map that is defined in a SAS data set. To resolve
the attribute map name in that case, you must specify the name of the attribute
map data set in the DATTRMAP= option in the SGRENDER statement that
renders the graph. For information about discrete attribute map data sets and the
SGRENDER statement DATTRMAP= option, see SAS ODS Graphics:
Procedures Guide.
• VALUE statement:
• FILLATTRS= now supports the TRANSPARENCY= fill option.
• LINEATTRS= now supports the THICKNESS= line option.
• MARKERATTRS= now supports the SIZE=, TRANSPARENCY=, and
WEIGHT= marker options.
Documentation Enhancements
In the second maintenance release of SAS 9.4, SAS Graph Template Language: User's
Guide is reorganized to make it easier to find information about how to use the Graph
Template Language.
1
Part 1
Fundamentals
Chapter 1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2
3
Chapter 1
Overview
• The GTL templates are defined with PROC TEMPLATE. The GTL includes
conditional statements that can be used to determine what graph features are
rendered. It also includes layout statements that specify the arrangement of graph
features, plot statements that request specific plot types (such as histograms and
scatter plots), and text and legend statements that specify titles, footnotes, legends,
and other text-based graph elements.
• The GTL templates are rendered using the SGRENDER procedure, which specifies a
data source that contains appropriate data values and the template to use for
rendering the graph.
• You can also modify predefined GTL templates that the SAS System delivers for use
on the SAS statistical procedures. For information about modifying existing
templates, refer to SAS/STAT user’s guide.
This manual provides a complete reference to the Graph Template Language. For
detailed usage information, consult the SAS Graph Template Language: User's Guide.
Note: If you are also a SAS/GRAPH user, then you might want to consult the SAS
Graph Template Language: User's Guide to learn about some of the distinctions
between ODS Graphics and SAS/GRAPH.
A Quick Example
The data set Sashelp.Class is delivered with the SAS System. It includes data columns
named Height and Weight, which store height and weight measures for a small sample of
subjects. The Graph Template Language can be used to generate a histogram that shows
the distribution of weight recorded in that data set:
histogram weight;
endlayout;
endgraph;
end;
run;
Template Compilation
A GTL template describes the structure and appearance of a graph to be produced,
similar to how a TABLE template describes the organization and content of a table.
All templates are stored, compiled programs. The following source program produces a
simple GTL template named SCATTER:
proc template;
define statgraph scatter;
begingraph;
layout overlay;
scatterplot x=height y=weight;
endlayout;
endgraph;
end;
run;
When this code is submitted, the statement keywords and options are parsed, just as with
any other procedure. If no syntax error is detected, then an output template named
SCATTER is created and stored in the default template folder Sasuser.Templat. No graph
is produced. Note the following:
6 Chapter 1 • Overview
• Any required arguments in the template must be specified. In this example, X= and
Y= in the SCATTERPLOT statement must specify variables for the analysis, but no
checking for the existence of these variables is done at compile time. (Unlike other
SAS procedures, PROC TEMPLATE does not perform a compile and then run
sequence, which includes variable validation.)
• No reference to an input data set appears in the template.
Run-Time Actions
To produce a graph, a GTL template must be bound to a data source using the
SGRENDER procedure. The following example uses SGRENDER to bind the
SCATTER template to the SAS data set Sashelp.Class, which is delivered with the SAS
system:
proc sgrender data=sashelp.class
template=scatter;
run;
Graph
the output produced from all of the statements that are nested in a BEGINGRAPH
statement block. The graph comprises all of the graphics elements in the template
definition.
Title Area
area for one or more titles. This area is always displayed above all cells in the graph.
Footnote Area
area for one or more footnotes. This area is always displayed below all cells in the
graph.
Cell
refers collectively to the area containing the plot areas. In this diagram, there are two
cells, each of which contains two axes for the plot area. A cell can also contain
descriptive text and legends. Graphs are often described as single-cell or multi-cell.
Plot Area
the display area for plot-statement results. This area is bounded by the axes (when
present) and can also contain data labels and other text that annotates the graph.
Axis
refers collectively to the axis line, the major and minor tick marks, the major tick
values, and the axis label.
8 Chapter 1 • Overview
Plots
refers collectively to all plot statements that can be overlaid in the plot area. This
includes graphical items such as fit lines, scatter plots, reference lines, and many
others.
Legend
refers collectively to one or more legend entries, each made up of a graphical value
and a text label. The legend can also have a title and border. Legends can also
display a color ramp corresponding to a continuous response range.
Graphical Layouts
[ˌhaɪəˈr :rkɪkl]:分层
One of most powerful features of the GTL is the syntax built around hierarchical
statement blocks called “layouts.” The outermost layout block determines
• The overall organization of the graph—whether it uses a single-cell or a multi-cell
display.
• What statements are allowed in the block. Generally, layout blocks can contain plots,
lines of text, a legend, or even another layout.
• How the contained statements interact.
Layout Description
REGION General purpose layout for displaying single-cell graphs that does
not use axes.
For example, the following graph is a two-cell graph produced using the LAYOUT
LATTICE statement as the outermost template in the layout.
Graphical Layouts 9
The LAYOUT LATTICE statement is typically used to create a multi-cell layout of plots
that are aligned across columns and rows. In the following template, which produced the
graph, plot statements are specified within nested LAYOUT OVERLAY statements.
Thus, the LATTICE automatically aligns the plot areas and tick display areas in the
plots. The LATTICE layout is a good layout to choose when you want to compare the
results of related plots.
proc template;
define statgraph lattice;
begingraph;
entrytitle "Car Performance Profile";
layout lattice / border=true pad=10 opaque=true
rows=1 columns=2 columngutter=3;
layout overlay;
scatterplot x=horsepower y=mpg_city /
group=origin name="cars";
regressionPlot x=horsepower y=mpg_city / degree=2;
endlayout;
layout overlay;
scatterplot x=weight y=mpg_city / group=origin;
regressionPlot x=weight y=mpg_city / degree=2;
endlayout;
sidebar;
discretelegend "cars";
endsidebar;
endlayout;
endgraph;
end;
run;
For detailed information about each layout, see the chapter for that layout type.
10 Chapter 1 • Overview
Plots
The plots in the GTL are classified in different ways, depending on the context of the
discussion.
Within layout blocks, plots are often classified according to graphical dimension:
whether they are projected in two or three visual dimensions. Thus, plots in the GTL are
often referred to as 2-D or 3-D plots, based on their graphical dimensions, not their data
dimensions.
Relative to their input data, plots are classified according to the statements that calculate
summary statistics from raw input data, and those that use calculated statistics as input
parameters on the plot statement. Thus, many GTL plot statements have two versions:
BARCHART and BARCHARTPARM, HISTOGRAM and HISTOGRAMPARM, and so
on. The main distinction between such plots is the nature of the input data that they
accept:
• The “non-parm” version (for example, BARCHART) computes its values from raw,
unsummarized data. For example, a BARCHART computes the summary values it
needs for the bars in the chart. Such plots are often referred to as “computed plots.”
• The “parm” version (for example, BARCHARTPARM) does not summarize or
compute values from the input data but instead simply renders the input data it is
given. Thus, the input data must be pre-summarized, perhaps by a SAS procedure.
The “parm” version of plots, often referred to as “parameterized plots,” produce the
same result as the non-parm version. However, they do not perform the calculations
or data summarizations needed to achieve the result.
Chapter 5, “Key Concepts for Using Plots,” on page 175 discusses general concepts that
apply across plot types. For detailed information about a particular plot, see the chapter
for that plot.
Axes
The GTL uses various criteria to determine the displayed axis features for a graph.
Generally, axis features are based on the layout type, the order of plot statements in the
layout and the options specified on those statements, the use of “primary” and
“secondary” axes on the plots (when secondary axes are supported), the plot type, the
column(s) of data that contribute to defining the axis range, and the data formats for the
contributing data columns.
Depending on the layout type, 2-D plots can have up to four independent axes that can
be displayed: X, Y, X2, and Y2. The X and Y axes are considered the primary axes, and
the X2 and Y2 axes are considered the secondary axes. By default, the X2 and Y2 axes
are not displayed. When requested, the secondary axes can be displayed as copies of the
primary axes, or data can be mapped separately to them. The following figure identifies
the X, Y, X2, and Y2 axes.
Legends 11
For more information about axis features in GTL, see Chapter 7, “Axis Features in
Layouts,” on page 875.
Legends
Many plot statements support a GROUP= option that partitions the data into unique
values, performs separate analysis, if necessary, and automatically assigns distinct visual
properties to each group value. The visual properties of group values are defined by the
style in effect.
Legends are not automatically displayed for plots with group values. Rather, an
appropriate legend statement must be added to the template to generate the desired
legend. In the following example, a legend is added to display markers and line patterns
that show the association between the group values from a scatter plot and corresponding
linear regression lines. The example shows the mechanism that GTL uses to associate a
legend with its corresponding plot(s): a name is assigned to each plot that must be
represented in the legend, and these names are then used as arguments for the legend
statement (in this case, MERGEDLEGEND).
proc template;
define statgraph scatterfit;
begingraph;
12 Chapter 1 • Overview
For more information about managing legends in GTL, see SAS Graph Template
Language: User's Guide.
Flexible Templates
特征 限制性的
Several features in the GTL can make template definitions less restrictive on input data
and more general in nature. These features enable a single compiled template to produce
many output variations.
变化
layout overlay;
scatterplot x=age y=meanweight /
yerrorlower=eval(meanweight - 2*stderr)
yerrorupper=eval(meanweight + 2*stderr);
seriesplot x=age y=meanweight;
endlayout;
endgraph;
end;
run;
For more information about using expressions, see Chapter 21, “Expressions,” on page
1317. For more information about using functions, see Chapter 22, “Functions,” on page
1321.
The following example defines a template named DYNAMICS that can create a
histogram and density plot for any variable. It defines both macro variables and
dynamics for run-time substitution. No data-dependent information is hard coded in the
template.
Note: You can initialize macro variables with %LET statements and dynamics with
SGRENDER’s DYNAMIC statement.
proc template;
define statgraph dynamics;
mvar SYSDATE9 SCALE;
nmvar BINS;
dynamic VAR VARLABEL;
begingraph;
entrytitle "Histogram of " VAR;
14 Chapter 1 • Overview
%let bins=6;
%let scale=count;
proc sgrender data=sashelp.class
template=dynamics;
dynamic var="Height" varlabel="Height in Inches";
run;
For more information about using dynamics and macro variables, see Chapter 20,
“Dynamics and Macro Variables,” on page 1313.
Conditional Logic
Using conditional logic, you can create templates that have multiple visual results or
output representations, depending on existing conditions. The evaluation of a logical
expression must generate one or more complete statements (not portions of statements).
All conditional logic uses one of the following constructs:
if (condition) if (condition)
statement(s); statement(s);
endif; else
statement(s);
endif;
In the IF statement, condition must be enclosed in parentheses. The condition can be any
standard SAS expression involving arithmetic, logical operators, comparison operators,
Boolean operators, or concatenation operators. The expression can also use SAS DATA
step functions. The expression resolves to a single numeric value, which is true or false.
Output 15
Note that the legend syntax does not have to be made conditional. At run time, each plot
name in the legend is checked. If the plot does not exist, then its name is removed from
the legend name list. If no names appear in the DISCRETELEGEND statement, then the
legend “drops out” and the histogram size is adjusted to fill the remaining space.
For more information about using conditional logic, see Chapter 23, “Conditional
Logic,” on page 1333.
Output
When using the GTL, you focus primarily on defining template definitions that produce
specific graphs and generate a particular output layout. Ultimately, you must also
customize the graphical environment to get the exact output that you desire. The ODS
GRAPHICS statement is available for customizing the graphical environment, and ODS
styles enable you to manage the output appearance.
The following ODS GRAPHICS statement uses the HEIGHT= and WIDTH= options to
set an aspect ratio for the output image.
ods graphics on / height=175px width=200px;
proc sgrender data=sashelp.class
template=scatter;
run;
ods graphics off;
For more information about using the ODS GRAPHICS statement in GTL, see SAS
Graph Template Language: User's Guide. For a more complete discussion of the ODS
GRAPHICS statement, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
ODS Styles
When any graphics template is executed, there is always an ODS style in effect that
governs the appearance of the output. The following ODS statement sends graphics
output to the RTF output destination using the LISTING style:
ods rtf style=listing;
Support for ODS styles is highly integrated into GTL syntax. By default, the graphical
appearance features of most plot and text statements are mapped to corresponding style
elements and associated attributes. Because of this, your output tables and graphs always
have a reasonable overall appearance. Moreover, output for a given ODS destination has
a consistent look (for example, table colors and graph colors do not clash).
The following figures show how a graph’s appearance can be changed by using
references to style elements to set the graph’s appearance options. This technique
permits changes in graph appearance by style modification instead of graphical template
modification. The graphs in the figures are generated with the following GTL statement:
contourplotparm x=x y=y z=density /
contourtype=fill nhint=9
colormodel=ThreeColorRamp ;
The following style template shows the definition for the ThreeColorRamp style
element:
style ThreeColorRamp /
endcolor = GraphColors("gramp3cend")
neutralcolor = GraphColors("gramp3cneutral")
startcolor = GraphColors("gramp3cstart");
About the Examples in This Documentation 17
For more information about the use of ODS styles in GTL, see SAS Graph Template
Language: User's Guide. For a more complete discussion of ODS styles, see SAS Output
Delivery System: User's Guide.
down font sizes. Also, their numeric axes might display a reduced number of ticks and
tick values. Thus, the graphs that you generate from the example programs will not
always look identical to the graphs that are shown in the figures. However, both graphs
will accurately represent the data.
When you produce your own graphical output, you can change the graph size and
attributes, if needed. The SAS Graph Template Language: User's Guide explains how to
set fonts, DPI, anti-aliasing, and other features that contribute to producing professional-
looking graphics of any size in any output format.
Part 2
Graph Block
Chapter 2
BEGINGRAPH Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
20
21
Chapter 2
BEGINGRAPH Statement
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
BEGINGRAPH Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Dictionary
BEGINGRAPH Statement
Defines the outermost container for a graph template that is defined with GTL-statements.
Requirements: All STATGRAPH template definitions must start with a BEGINGRAPH statement and
end with an ENDGRAPH statement.
The BEGINGRAPH block must contain one and only one layout block.
The layout block and its nested layouts, if any, must contain at least one plot.
Syntax
BEGINGRAPH </option(s)>;
<GTL-global-statements>
GTL-layout-block
<GTL-global-statements>
ENDGRAPH;
Appearance options
ATTRPRIORITY=AUTO | COLOR | NONE
specifies a priority for cycling the group attributes.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the graph background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the graph.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the graph.
DATACOLORS=(color-list)
22 Chapter 2 • BEGINGRAPH Statement
specifies the list of fill colors that will replace the graph data colors from the
GraphData1–GraphDataN style elements.
DATACONTRASTCOLORS=(color-list)
specifies the list of contrast colors that will replace the graph data contrast
colors from the GraphData1–GraphDataN style elements.
DATALINEPATTERNS=(line-pattern-list)
specifies the list of line patterns that will replace the graph data line patterns
from the GraphData1–GraphDataN style elements.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of all plots in the template that support data
skins.
DATASYMBOLS=(marker-symbol-list)
specifies the list of marker symbols that will replace the graph data marker
symbols from the marker symbols that are defined in the GraphData1–
GraphDataN style elements.
DESIGNHEIGHT=DEFAULTDESIGNHEIGHT | dimension
specifies the design height of the graph.
DESIGNWIDTH=DEFAULTDESIGNWIDTH | dimension
specifies the design width of the graph.
DRAWSPACE= GRAPHPERCENT | GRAPHPIXEL | LAYOUTPERCENT |
LAYOUTPIXEL | WALLPERCENT | WALLPIXEL | DATAPERCENT |
DATAPIXEL | DATAVALUE
specifies a global drawing space and drawing units for all of the draw
statements within this BEGINGRAPH block.
OPAQUE=TRUE | FALSE
specifies whether the graph background is opaque or transparent. 不透明或透明
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the graph border.
SUBPIXEL=AUTO | OFF | ON
specifies whether subpixel rendering is used for drawing smooth curved lines
or for spacing bars more precisely.
Axis options
AXISBREAKSYMBOL=BRACKET | NOTCH | SLANTEDLEFT |
SLANTEDRIGHT | SQUIGGLE | SPARK | Z
specifies a symbol to use on the axis lines to indicate a break in the axis.
AXISBREAKTYPE=FULL | AXIS
specifies whether the axis break is indicated in the full display or only on the
axis line.
AXISLINEEXTENT=FULL | DATA | number
specifies the extent of the axis line for all axes.
DISCRETEAXISOFFSETPAD=TRUE | FALSE
specifies whether additional padding is added to the minimum and maximum
axis offsets for discrete axes.
Label options
LABELPLACEMENT=AUTO | GREEDY | SA
specifies the label-placement algorithm to use for positioning labels in the
graphs.
SAPLACEMENTOPTS=(placement-options)
specifies the options for the label-placement algorithm when
LABELPLACEMENT=SA.
BEGINGRAPH Statement 23
Midpoint options
INCLUDEMISSINGDISCRETE=TRUE | FALSE
specifies whether missing values are displayed on a discrete axis.
Optional Arguments
ATTRPRIORITY=AUTO | COLOR | NONE
specifies a priority for cycling the group attributes.
AUTO
honors the current state of the attribute priority rotation pattern as specified in the
active style or in the ODS GRAPHICS statement.
COLOR
changes the current setting of attribute priority rotation pattern to the color-
priority pattern by cycling through the list of colors while holding the marker
symbol, line pattern, or fill pattern constant. When all of the colors are exhausted,
the marker symbol, line style, or fill pattern attribute increment to the next
element, and then the colors in the list are repeated. This pattern repeats as
needed.
NONE
changes the current setting of attribute priority rotation pattern to the default
pattern, which cycles progressively through the attribute lists.
Default The attribute priority pattern that is specified in the active style or in
the ODS GRAPHICS statement.
Interactions This option overrides the attribute priority rotation pattern that is
specified in the current style and the ATTRPRIORITY= option in the
ODS GRAPHICS statement.
The default lists of data colors, contrast colors, marker symbols, and
line patterns are set in the active style’s GraphData1–GraphDataN
elements.
The following figure shows an example of each symbol on a horizontal linear axis for
ranges 1–4 and 6–10.
Default SQUIGGLE
The DISPLAY= option for the axis must include the axis line for
this option to have any effect.
AXISBREAKTYPE=FULL | AXIS
specifies whether the axis break is indicated in the full display or only on the axis
line.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
The following figure shows an example of each type for ranges 50–52 and 56–73 on a
linear horizontal axis.
Figure 2.1 Axis Break Types FULL and AXIS
Default FULL
The axis line or the plot wall outline must be displayed for AXIS to
have any effect. Otherwise, FULL is used.
Interaction When AXIS is specified, if the secondary axis line or the plot wall
outline is displayed, then the axis break symbol is displayed on both
the primary and the secondary axis. Otherwise, the break symbol is
BEGINGRAPH Statement 25
Notes The axis break indicators pass through inner margin areas.
Range 0–1
Tip A numeric value is useful for bar charts when DATA terminates the axis
line at the midpoint positions of the minimum and maximum bars. In
that case, you can specify a numeric value to lengthen the axis line so
that it extends to the full width of both bars.
The following figure shows a simple example of each value for the X and Y axis lines.
The light-blue dashed lines depict the minimum and maximum offsets that are set on the
axes.
Default FULL
Tips The graph wall outline might appear to be an axis line. In that case, use
the WALLDISPLAY=NONE or WALLDISPLAY=(FILL) option in the
layout statement to suppress the wall outline.
26 Chapter 2 • BEGINGRAPH Statement
Use the LINEEXTENT= axis option to control the axis line extent on a
per-axis basis.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the graph background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the graph.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element .
DATACOLORS=(color-list)
specifies the list of fill colors that will replace the graph data colors from the
GraphData1–GraphDataN style elements.
(color-list)
a space-separated list of colors, enclosed in parentheses. You can use a style
attribute reference such as GraphData3:color, a color name, or an RGB, CMYK,
HLS, or HSV (HSB) color code to specify a color. The list can contain a mix of
style attribute references, color names, and color codes.
When this option is specified, the fill colors rotate through this color list rather than
through the colors that are defined in the GraphData1–GraphDataN style elements.
For information about the attribute rotation patterns, see “Attribute Rotation
Patterns” in SAS Graph Template Language: User's Guide.
DATACONTRASTCOLORS=(color-list)
specifies the list of contrast colors that will replace the graph data contrast colors
from the GraphData1–GraphDataN style elements.
(color-list)
a space-separated list of contrast colors, enclosed in parentheses. You can use a
style attribute reference such as GraphData3:color, a color name, or an RGB,
CMYK, HLS, or HSV (HSB) color code to specify a color. The list can contain a
mix of style attribute references, color names, and color codes.
When this option is specified, the contrast colors cycle through this color list rather
than through the contrast colors that are defined in the GraphData1–GraphDataN
style elements. For information about the attribute rotation patterns, see “Attribute
Rotation Patterns” in SAS Graph Template Language: User's Guide.
DATALINEPATTERNS=(line-pattern-list)
specifies the list of line patterns that will replace the graph data line patterns from the
GraphData1–GraphDataN style elements.
(line-pattern-list)
a space-separated list of line patterns, enclosed in parentheses. You can use a
style attribute reference such as GraphData3:lineStyle, a line pattern number, or a
line pattern name (where applicable) to specify a pattern. The list can contain a
mix of style attribute references, line pattern numbers, and line pattern names.
When this option is specified, the line patterns cycle through this line-pattern list
rather than through the line patterns that are defined in the GraphData1–GraphDataN
style elements. When the patterns in line-pattern-list are exhausted, the patterns
repeat.
Default The line patterns that are defined in the GraphData1–GraphDataN style
elements.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Note Applying data skins to a graph that has a very large number of markers
can negatively impact performance.
DATASYMBOLS=(marker-symbol-list)
specifies the list of marker symbols that will replace the graph data marker symbols
from the marker symbols that are defined in the GraphData1–GraphDataN style
elements.
(marker-symbol-list)
a space-separated list of marker symbols, enclosed in parentheses. You can use a
style attribute reference such as GraphData5:markerSymbol or a marker symbol
name to specify a marker. The list can contain a mix of style attribute references
and marker symbol names.
When this option is specified, the marker symbols cycle through this marker symbol
list rather than through the line patterns that are defined in the GraphData1–
GraphDataN style elements. When the symbols in marker-symbol-list are exhausted,
the symbols repeat.
DESIGNHEIGHT=DEFAULTDESIGNHEIGHT | dimension
specifies the design height of the graph.
BEGINGRAPH Statement 29
Restriction The minimum dimension value that you can set is 2 pixels. If a smaller
setting is specified, then the default design height is used.
Interactions The design height can be overridden at run time with a render height
that is specified with the HEIGHT= option in the ODS GRAPHICS
statement (external to the template). Also, the ODS destination
statement’s IMAGE_DPI= option can affect the height.
You can change the value of the Design Height registry key in the
SAS registry. However, doing so affects the design height of all
templates that do not include an explicit dimension for the design
height. You can also change the height setting in the graph style, but
doing so affects the height of all templates that use that style.
DESIGNWIDTH=DEFAULTDESIGNWIDTH | dimension
specifies the design width of the graph.
Restriction The minimum dimension value that you can set is 2 pixels. If a smaller
setting is specified, then the default design width is used.
Interactions The design width can be overridden at run time with a render width
that is specified with the WIDTH= option in the ODS GRAPHICS
statement (external to the template). Also, the ODS destination
statement’s IMAGE_DPI= option can affect the width.
You can change the value of the Design Width registry key in the SAS
registry. However, doing so affects the design width of all templates
that do not include an explicit dimension for the design width. You can
also change the width setting in the graph style, but doing so affects
the width of all templates that use that style.
DISCRETEAXISOFFSETPAD=TRUE | FALSE
specifies whether additional padding is added to the minimum and maximum axis
offsets for discrete axes. When set to TRUE, an additional 5 pixels of padding is
added to the minimum and maximum axis offsets.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default TRUE
Tip This option is useful for heat maps when you want the heat map to
occupy the entire plot area. In that case, in addition to setting this
30 Chapter 2 • BEGINGRAPH Statement
Default LAYOUTPERCENT
Tip Individual draw statements within this BEGINGRAPH block can override
this global setting.
See “About the Drawing Space and Drawing Units” on page 1192
INCLUDEMISSINGDISCRETE=TRUE | FALSE
specifies whether missing values are displayed on a discrete axis.
Default FALSE
Interaction This option affects all charts and plots within the template.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABELPLACEMENT=AUTO | GREEDY | SA
specifies the label-placement algorithm to use for positioning labels in the graphs.
The following labels are affected:
• data labels for needle plots, scatter plots, series plots, step plots, and vector plots
• vertex labels for line charts
• curve labels when the curve label is positioned at the start or end of the curve
AUTO
always selects GREEDY.
GREEDY
specifies the Greedy method for managing label collision. The Greedy method
tries different placement combinations in order to find an optimal approximation
that avoids collisions. Label placement using this method is often less optimal
than label placement using the Simulated Annealing (SA) method. However,
depending on the number of data points and the potential for label collisions, the
Greedy process can be significantly faster.
SA
specifies the Simulated Annealing method for managing label collision. The SA
method attempts to determine the global minimization-of-cost function, which is
based on a simulated annealing algorithm. The resulting label placement is
usually better than placement using the Greedy method. However, depending on
the number of data points and the potential for label collisions, the SA method
can be significantly slower.
Restriction The data label placement algorithm is not aware of bar labels, curve
labels, box plot outlier labels, and marker characters. Collisions
between these elements and data labels might occur regardless of the
LABELPLACEMENT= setting.
OPAQUE=TRUE | FALSE
specifies whether the graph background is opaque or transparent.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
When this option is set to FALSE, the graph background is transparent.
Default TRUE
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the graph border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the layout border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
SAPLACEMENTOPTS=(placement-options)
specifies the options for the label-placement algorithm when
LABELPLACEMENT=SA. Placement options can be any of the following:
MAXITERATIONS=positive-integer
specifies the maximum number of iterations for the SA label-placement
algorithm.
Default 100
WEIGHTS=(keyword-number-list)
specifies the relative weight to give to a particular cost when determining the best
label position. The keyword number list is a space-separated list of keyword =
number pairs.
The following keywords can be used:
Example saplacementopts=(maxiterations=100
weights=(LABEL=2.0 OBSTACLE=10.0))
SEED=positive-integer
specifies a random number seed for the Simulated Annealing algorithm.
Default 1234567
Range 0–2147483646 (2 31–1), where 0 specifies the current Java time as the
seed value
BEGINGRAPH Statement 33
SUBPIXEL=AUTO | OFF | ON
specifies whether subpixel rendering is used for drawing smooth curved lines or for
spacing bars more precisely.
Note: Starting with the third maintenance release of SAS 9.4, this option controls
subpixel rendering only for image output. For vector-graphics output, subpixel
rendering is always enabled.
AUTO
the system determines whether to use subpixel rendering. In the second
maintenance release of SAS 9.4 and in earlier releases, the system uses the
default rendering for the rendering technology. Starting with the third
maintenance release of SAS 9.4, for image output, if the SUBPIXEL= option is
explicitly set in an ODS GRAPHICS statement, the system honors its setting.
Otherwise, the system determines whether to use subpixel rendering based on the
following criteria:
• If a SCATTERPLOT or SCATTERPLOTMATRIX statement is used,
subpixel rendering is OFF for the graph.
• If neither a SCATTERPLOT nor a SCATTERPLOTMATRIX statement is
used, subpixel rendering is turned ON for the graph if one or more of the
following statements is also used:
Note OFF is valid starting with the third maintenance release of SAS 9.4.
ON
always uses subpixel rendering, when applicable, for image output when
rendering graphs.
Default AUTO
Restrictions In the second maintenance release of SAS 9.4 and in earlier releases,
subpixel rendering can be used only for the following statements:
BANDPLOT, BARCHART, BARCHARTPARM, DENSITYPLOT,
LINECHART, LOESSPLOT, PBSPLINEPLOT,
REGRESSIONPLOT, and SERIESPLOT. Starting with the third
maintenance release of SAS 9.4, subpixel rendering can be used for
all plots and charts.
Starting with the third maintenance release of SAS 9.4, this option is
ignored for vector-graphics output.
34 Chapter 2 • BEGINGRAPH Statement
Requirement Anti-aliasing must be enabled for this option to have any effect.
Interaction Starting with the third maintenance release of SAS 9.4, this option
overrides the SUBPIXEL= option in the ODS GRAPHICS statement.
Details
however, that if you explicitly manage the graph output size, then the graph elements
might be scaled so that the size specification is honored.
The following template defines a square graph (equal height and width, 1:1 aspect ratio)
by setting the design width equal to the internal default height (480px). The setting is
made with DESIGNWIDTH=DEFAULTDESIGNHEIGHT:
Note: A “square graph” means that the output graph’s width and height are equal. That
does not imply that the X and Y axis lengths are equal if the graph contains only one
cell.
proc template;
define statgraph squareplot;
dynamic title xvar yvar;
begingraph / designwidth=defaultDesignHeight;
entrytitle title;
layout overlayequated / equatetype=square;
scatterplot x=xvar y=yvar;
regressionplot x=xvar y=yvar;
endlayout;
endgraph;
end;
run;
If this template is executed with the following GRENDER procedure statement, then a
480px by 480px graph is created:
If the ODS GRAPHICS statement’s WIDTH= or HEIGHT= options change the render
width or render height, then the squareplot template’s 1:1 aspect ratio would still be
honored. Thus, both of the following GRENDER procedure statements would create a
550px by 550px graph:
ods graphics / width=550px;
proc sgrender data=mydata template="squareplot" ;
dynamic title="Square Plot" xvar="time1" yvar="time2";
run;
The following graph was generated by the “Example Program” on page 36:
Example Program
The BEGINGRAPH statement block is a required outermost container for any graph
template. One of its purposes is to support options that apply to the entire graph. For
example, the default graph size that a template produces is typically 640x480 pixels. If
you need a different size, then you can declare the alternative size on this statement. To
do so, use the DESIGNWIDTH= option, or the DESIGNHEIGHT= option, or both. This
program shows one way to set the width and height of two graph cells to be equal.
proc template;
define statgraph begingraph;
dynamic XVAR YVAR;
begingraph / designwidth=640px designheight=320px;
layout lattice / columns=2;
layout overlayequated / equatetype=square;
entry "Linear Regression Fit" /
valign=top texttattrs=(weight=bold);
scatterplot x=XVAR y=YVAR / datatransparency=0.5;
regressionplot x=XVAR y=YVAR;
endlayout;
layout overlayequated / equatetype=square;
entry "Loess Fit" /
valign=top texttattrs=(weight=bold);
scatterplot x=XVAR y=YVAR / datatransparency=0.5;
loessplot x=XVAR y=YVAR;
endlayout;
endlayout;
endgraph;
end;
run;
Part 3
Layout Statements
Chapter 3
Summary of Layout Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Chapter 4
Layout Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
40
41
Chapter 3
Summary of Layout Statements
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Single-cell Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Multi-cell Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Data-driven Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Legend Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Overview
Layout blocks always begin with the LAYOUT keyword followed by a keyword
indicating the purpose of the layout. All layout blocks end with an ENDLAYOUT
statement.
The following sections summarize the available layouts. To learn more about a layout,
see the chapter devoted to that layout.
42 Chapter 3 • Summary of Layout Statements
Single-cell Layouts
Graphics Allowed
Layout and Cells
(Description) Produced Comments Example
Multi-cell Layouts
Graphics Allowed
Layout and Cells
(Description) Produced Comments Example
Data-driven Layouts
Graphics Allowed
Layout and Cells
(Description) Produced Comments Example
Legend Layout
Chapter 4
Layout Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
LAYOUT DATALATTICE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
LAYOUT DATAPANEL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
LAYOUT GLOBALLEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
LAYOUT GRIDDED Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
LAYOUT LATTICE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
LAYOUT OVERLAY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
LAYOUT OVERLAYEQUATED Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
LAYOUT OVERLAY3D Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
LAYOUT PROTOTYPE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
LAYOUT REGION Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
INNERMARGIN Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Dictionary
Syntax
LAYOUT DATALATTICE ROWVAR=class-variable
COLUMNVAR=class-variable </option(s)>;
LAYOUT PROTOTYPE </options>;
GTL-statements;
ENDLAYOUT;
<SIDEBAR </options>;
GTL-statements;
ENDSIDEBAR;>
ENDLAYOUT;
LAYOUT DATALATTICE COLUMNVAR=class-variable </option(s)>;
layout-prototype-block ;
<sidebar-block(s)> ;
ENDLAYOUT;
LAYOUT DATALATTICE ROWVAR=class-variable </option(s)>;
layout-prototype-block ;
<sidebar-block(s)> ;
ENDLAYOUT;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
CELLHEIGHTMIN=dimension
specifies the minimum height of a cell in the grid.
CELLWIDTHMIN=dimension
specifies the minimum width of a cell in the grid.
COLUMNGUTTER=dimension
specifies the amount of empty space that is between the columns.
COLUMNHEADERS=TOP | BOTTOM | BOTH
specifies where to position the outside column heading.
HEADERBACKGROUNDCOLOR=style-reference | color
specifies the background color of the cell headers.
HEADERBORDER=TRUE | FALSE
specifies whether a border is drawn around the header cells.
HEADERLABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
HEADERLABELLOCATION=OUTSIDE | INSIDE
indicates whether the cell header is placed within each cell (INSIDE) or as
row and column headers external to the lattice (OUTSIDE).
HEADEROPAQUE=TRUE | FALSE
specifies whether the background for cell headers is opaque (TRUE) or
transparent (FALSE).
LAYOUT DATALATTICE Statement 47
HEADERPACK=TRUE | FALSE
specifies whether the header cells are consolidated into a comma-separated
list in order to save space.
HEADERSEPARATOR="string"
specifies one or more characters to place between each value in the cell
header when HEADERPACK=TRUE.
HEADERSPLITCOUNT=positive-integer
specifies the number of headers to consolidate on a header line before
splitting the text to the next line.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting
levels of the layouts that are used.
SORTORDER=(role-sort-list)
specifies the order of the cells along the columns and rows.
Axis options
COLUMN2AXISOPTS=(axis-options)
specifies X2-axis options for all columns.
COLUMN2DATARANGE=AUTO | UNIONALL | UNION
specifies how the X2-axes of instances of the graph-prototype are scaled.
COLUMNAXISOPTS=(axis-options)
specifies X-axis options for all columns.
COLUMNDATARANGE=AUTO | UNIONALL | UNION
specifies how the X-axes of instances of the graph-prototype are scaled.
ROW2AXISOPTS=(axis-options)
specifies Y2-axis options for all rows.
ROW2DATARANGE=AUTO | UNIONALL | UNION
specifies how the Y2-axes of instances of the graph-prototype are scaled.
ROWAXISOPTS=(axis-options)
specifies Y-axis options for all rows.
ROWDATARANGE=AUTO | UNIONALL | UNION
specifies how the Y-axes of instances of the graph-prototype are scaled.
Inset options
INSET=(variable-list)
specifies what information is displayed in an inset.
INSETOPTS=(appearance-options)
specifies location and appearance options for the inset information.
Layout options
COLUMNS=integer
specifies the number of columns in the layout.
COLUMNWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the columns widths.
48 Chapter 4 • Layout Statements
Required Arguments
You must specify at least one of the following arguments. You can specify both.
ROWVAR=class-variable
specifies the classification variable for the rows. One row of cells is created for each
unique value of the row class variable.
COLUMNVAR=class-variable
specifies the classification variable for the columns. One column is created of each
unique value of the column class variable.
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
LAYOUT DATALATTICE Statement 49
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
CELLHEIGHTMIN=dimension
specifies the minimum height of a cell in the grid. Use this option in conjunction
with the CELLWIDTHMIN= option to set the minimum cell size.
The overall size of the panel is constrained by the HEIGHT= and WIDTH= options
in the ODS GRAPHICS statement. As the number of cells in the grid increases, the
size of each cell decreases. At some point the cell becomes so small that a
meaningful graph cannot be rendered. This option sets the minimum height threshold
for all cells. If the actual cell height becomes smaller, then no panel is drawn.
Default 100px
CELLWIDTHMIN=dimension
specifies the minimum width of a cell in the grid. Use this option in conjunction with
the CELLHEIGHTMIN= option to set the minimum cell size.
The overall size of the panel is constrained by the HEIGHT= and WIDTH= options
in the ODS GRAPHICS statement. As the number of cells in the grid increases, the
size of each cell decreases. At some point the cell becomes so small that a
meaningful graph cannot be rendered. This option sets the minimum width threshold
for all cells. If the actual cell width becomes smaller, then no panel is drawn.
Default 100px
COLUMNAXISOPTS=(axis-options)
specifies X-axis options for all columns.
COLUMN2AXISOPTS=(axis-options)
specifies X2-axis options for all columns.
50 Chapter 4 • Layout Statements
Restriction This option is needed only if you use a plot statement that supports a
secondary X2 axis. If you do not use that statement’s XAXIS= option
to map data to the X2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data
Are Mapped to a Designated Axis” on page 876
Default AUTO
Default AUTO
Interaction This option is needed only if you use a plot statement that supports a
secondary X2 axis. If you do not use that statement’s XAXIS= option
to map data to the X2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data Are
Mapped to a Designated Axis” on page 876
COLUMNGUTTER=dimension
specifies the amount of empty space that is between the columns.
Default 0
Default TOP
COLUMNS=integer
specifies the number of columns in the layout.
Interactions The overall grid size is constrained by the HEIGHT= and WIDTH=
options in the ODS GRAPHICS statement. As the grid size grows, the
52 Chapter 4 • Layout Statements
cell size shrinks. To control the minimum size of a cell use the
CELLHEIGHTMIN= and CELLWIDTHMIN= options.
The START= option affects the how the columns are populated.
COLUMNWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the columns widths.
EQUAL
all columns have equal width.
PROPORTIONAL
each column has a width that is proportional to the number of discrete midpoint
values that it contains.
If all of the following conditions are true, then the discrete axis is
used to proportion the columns: PROPORTIONAL is in effect,
both the X and X2 axes are used, and only one of the two axes is
discrete. If both axes are discrete, then the X axis is used to
proportion the columns.
Default EQUAL
HEADERBACKGROUNDCOLOR=style-reference | color
specifies the background color of the cell headers.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
HEADERBORDER=TRUE | FALSE
specifies whether a border is drawn around the header cells.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
LAYOUT DATALATTICE Statement 53
Default TRUE
See “boolean ” for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Country=CANADA
Product=TABLE
VALUE
displays the classification variable value only in each cell header.
CANADA
TABLE
NONE
suppresses the cell headers.
Default NAMEVALUE
HEADERLABELLOCATION=OUTSIDE | INSIDE
indicates whether the cell header is placed within each cell (INSIDE) or as row and
column headers external to the lattice (OUTSIDE).
Default OUTSIDE
HEADEROPAQUE=TRUE | FALSE
specifies whether the background for cell headers is opaque (TRUE) or transparent
(FALSE).
Default TRUE
54 Chapter 4 • Layout Statements
Interaction When this option is set to FALSE, the background color for cell headers
is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
HEADERPACK=TRUE | FALSE
specifies whether the header cells are consolidated into a comma-separated list in
order to save space.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
The following figure shows the effect of HEADERPACK= on the cell headers in one
row of a data lattice. The data lattice contains classification variables Country and Year.
Default FALSE
Note If the length of the cell header text exceeds the available width, then the
text is truncated.
See “boolean ” on page 1339 for other Boolean values that you can use.
HEADERSEPARATOR="string"
specifies one or more characters to place between each value in the cell header when
HEADERPACK=TRUE.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
HEADERSPLITCOUNT=positive-integer
specifies the number of headers to consolidate on a header line before splitting the
text to the next line.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
LAYOUT DATALATTICE Statement 55
Note If the length of the cell header text exceeds the available width, then the
text is truncated.
INCLUDEMISSINGCLASS=TRUE | FALSE
specifies whether to include grid cells for crossings of the ROWVAR and
COLUMNVAR variables that contain a missing value.
TRUE
any crossing of the class variables that includes a missing value produces a row
or column of cells in the grid.
FALSE
any crossing of the class variables that includes a missing value does not produce
a row or columns of cells in the grid.
By default, missing class values are included in the classification. When the data
contains missing classification values, cells are created for the missing classes. The
classification headers for the missing values are blank for missing string values or a
dot for missing numeric values. You can use the
INCLUDEMISSINGCLASS=FALSE option to exclude the missing values. If you
want to keep the missing values, then you can create a format that specifies more
meaningful headings for the missing classes. For an example, see “Missing Class
Values” in SAS Graph Template Language: User's Guide.
Note: ODS Graphics does not support Unicode values in user-defined formats in the
second maintenance release of SAS 9.4 and in earlier releases. Starting with the
third maintenance release of SAS 9.4, ODS Graphics supports Unicode values in
user-defined formats only if they are preceded by the (*ESC*) escape sequence.
Example: "(*ESC*){unicode beta}". ODS Graphics does not support an
escape character that is defined in an ODS ESCAPECHAR statement in user-
defined formats.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
INSET=(variable-list)
specifies what information is displayed in an inset. The variable-list defines one or
more variables whose names and values appear as a small table in the data cells. The
variables can be either numeric or character. Variable names are separated by spaces.
Requirement No predefined information is available for the inset. You must create
the desired inset information as part of your input data. See “Creating
Your Inset Data” on page 68.
Note The variable values are associated with the data cells by data order.
That is, the first observation from all the variables in variable-list are
used in the first data cell, the second observation from all variables in
variable-list are used in the second data cell, and so on. If a value is
missing for an observation, then the corresponding name-value pair is
skipped in the affected data cell.
56 Chapter 4 • Layout Statements
INSETOPTS=(appearance-options)
specifies location and appearance options for the inset information. The appearance
options can be any one or more of the following values:
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the inset is automatically aligned within the layout.
NONE
does not automatically align the inset. This inset’s position is set by the
HALIGN= and VALIGN=appearance-options.
AUTO
attempts to center the inset in the area that is farthest from any surrounding
markers. Data cells might have different inset placements.
(location-list)
restricts the inset’s possible locations to those locations in the specified
location-list, and uses the location-list position that least collides with the
data cell’s other graphics features. The location-list is a space-separated list
that can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,
CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.
Default NONE
BACKGROUNDCOLOR=style-reference | color
specifies the color of the inset background.
style-reference
specifies a style reference in the form style-element : style-attribute. Only the
COLOR and CONTRASTCOLOR style attributes are valid.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the inset.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
CONTENTDISPLAY=LABELVALUE | VALUE
specifies whether the variable information that is displayed in the inset includes
the column label and value, or only the column value.
Note: This feature applies to the second maintenance release of SAS 9.4 and to
later releases.
If a label is not assigned to a column, then the column name is used as the label
for that column. Consider the following inset data:
LAYOUT DATALATTICE Statement 57
F
Obs _TYPE_ Value Pr > F
1 SS1 94.359 <.0001
The following figure shows the effect that the CONTENTDISPLAY= option has
on the content of an inset that displays this data.
Default LABELVALUE
Tip Use the SEPARATOR= option to specify a separator other than the
default blank space.
DATASCHEME=LIST | MATCHED
specifies the scheme that was used to merge the inset information into the
analysis data.
LIST
one-to-one merging (no BY statement) was used to merge the inset and
analysis data. The variable values are associated with the cells of the data
lattice by using data order. That is, the inset variable values in the first
observation are used in the inset for the first cell, the inset variable values in
the second observation are used in the inset for the second cell, and so on.
MATCHED
match-merging (using a BY statement) was used to merge the inset and
analysis data.
Default LIST
Tip MATCHED is the preferred data scheme for merging the inset and
analysis data.
Default LEFT
Interaction This option has an effect only when this layout is nested within a
region layout or when this layout is nested in an overlay-type layout
and AUTOALIGN=NONE.
OPAQUE=TRUE | FALSE
specifies whether the inset background is opaque (TRUE) or transparent
(FALSE).
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SEPARATOR="string"
specifies a new separator for the column label and value.
Note: This feature applies to the second maintenance release of SAS 9.4 and to
later releases.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TITLE="string"
specifies a title for the inset. The title is added at the top of the inset and spans
the full inset width.
Note Space is not reserved for the title when this value is not specified.
Tip Text properties for the title string can be specified with TITLEATTRS=.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default TOP
Interaction This option has effect only when this layout is nested within a
region layout or when this layout is nested in an overlay-type layout
and AUTOALIGN=NONE.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
LAYOUT DATALATTICE Statement 59
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
60 Chapter 4 • Layout Statements
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
PANELNUMBER=positive-integer
specifies the number of the panel to produce. This option enables you to partition a
large grid into a number of smaller grids under these conditions:
• You set a grid size explicitly (ROWS= and COLUMNS= when ROWVAR and
COLUMNVAR variables are specified; ROWS= when only a ROWVAR variable
is specified; COLUMNS= when only a COLUMNVAR variable is specified)
• The grid size is smaller in one or both of the dimensions of the default
dynamically generated grid.
• You execute the template N times and increment the panel number each time. N
is determined by CEIL(all rows * all columns / grid rows * grid columns).
Default 1
ROWAXISOPTS=(axis-options)
specifies Y-axis options for all rows.
ROW2AXISOPTS=(axis-options)
specifies Y2-axis options for all rows.
LAYOUT DATALATTICE Statement 61
Interaction This option is needed only if you use a plot statement that supports a
secondary Y2 axis. If you do not use that statement’s YAXIS= option
to map data to the Y2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data
Are Mapped to a Designated Axis” on page 876
Default AUTO
Default AUTO
Interaction This option is needed only if you use a plot statement that supports a
secondary Y2 axis. If you do not use that statement’s YAXIS= option to
map data to the Y2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data Are
Mapped to a Designated Axis” on page 876
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
Default 0
Default RIGHT
ROWS=integer
specifies the number of rows in the layout.
Defaults If this option is not specified, then the number of rows is dynamically
adjusted to equal the number of classifier values for the ROWVAR=
variable.
Interactions The overall grid size is constrained by the HEIGHT= and WIDTH=
options in the ODS GRAPHICS statement. As the grid size grows, the
LAYOUT DATALATTICE Statement 63
cell size shrinks. To control the minimum size of a cell use the
CELLHEIGHTMIN= and CELLWIDTHMIN= options.
ROWWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the row heights.
EQUAL
all rows have equal height.
PROPORTIONAL
each row has a height that is proportional to the number of discrete midpoint
values that it contains.
If all of the following conditions are true, then the discrete axis is
used to proportion the rows: PROPORTIONAL is in effect, both
the Y and Y2 axes are used, and only one of the two axes is
discrete. When both axes are discrete, the Y axis is used to
proportion the rows.
Default EQUAL
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting levels of
the layouts that are used.
Default FALSE
Note Fonts maintain their size regardless of the specifications in the nested
layouts.
See “boolean ” on page 1339 for other Boolean values that you can use.
SKIPEMPTYCELLS=TRUE | FALSE
specifies whether the external axes skip the empty cells in a partially filled grid.
TRUE
skips empty cells and "snaps" the external axes to the nearest data cell, both
vertically and horizontally. Though the empty cells are not displayed, the data
cells in the grid are not enlarged to fill the area.
64 Chapter 4 • Layout Statements
FALSE
displays external axes at their normal locations, even if there are empty cells at
one or more of the locations.
Whenever the number of unique COLUMNVAR= classifier values (data cells) is not
evenly divisible by the COLUMNS= value, or the number of unique ROWVAR=
classifier values (data cells) is not evenly divisible by the ROWS= value, then one or
more panels is partially filled with data cells and padded with empty cells to
complete the grid.
Here is an example of a data lattice that consists of 4 column-data cells and 3 row-
data cells arranged in a 4-column, 2-row grid. The following figure shows the default
appearance of the last panel:
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SORTORDER=(role-sort-list)
specifies the order of the cells along the columns and rows. The role sort list is a list
of rolename=sort-order-keyword pairs, enclosed in parentheses.
rolename
a role name, which must be one of the following:
sort-order-keyword
a sort-order keyword, which must be one of the following:
Tip The placement of the cells within the layout also depends on the starting
location, which is controlled by the START= option.
START=TOPLEFT | BOTTOMLEFT
indicates whether to start populating the grid from the top left or bottom left corner.
If ROWVAR=R has values in the sort order 1 and 2 and COLUMNVAR=C has
values in the sort order a and b, then START=BOTTOMLEFT is populated as
follows:
Default TOPLEFT
Default BOTTOM
66 Chapter 4 • Layout Statements
SPACEFILL=TRUE | FALSE
specifies whether to fill all the area of the sidebar with its contents.
Default TRUE
Tip To prevent a layout block within the sidebar from expanding to the sidebar
boundaries, set this option to FALSE.
See “boolean ” on page 1339 for other Boolean values that you can use.
Details
Statement Description
The LAYOUT DATALATTICE statement makes it easy to create a grid of graphs, based
on the values of one or two classifications variables. To create a grid that is based on
more than two classification variables, or to have more control over the grid layout, use
LAYOUT DATAPANEL instead.
By default, the number of cells in the layout is determined by the number of value
pairings that are possible for the classification values plus any empty cells needed to
complete the last row or column of the grid. The contents of each data cell are based on a
graph prototype that you specify in the graph-prototype-block. You can enhance the
display using one or more sidebar-statement-blocks. For classification variables that
have many values, you can use the COLUMNS= and or ROWS= options and the
PANELNUMBER= option to generate multiple panel displays.
Classification variables for the layout are specified on the ROWVAR= argument (to
specify a row variable), or the COLUMNVAR= argument (to specify a column), or both
arguments to specify both a column and a row variable. The graph prototype for each
data cell’s contents is specified within a “LAYOUT PROTOTYPE Block” on page 68
block, and sidebars are specified within SIDEBAR blocks. The LAYOUT PROTOTYPE
and SIDEBAR blocks are nested within the LAYOUT DATALATTICE block.
By default, the first data cell to be filled is in the layout’s top left corner. Use the
START= option to change the starting data cell to the bottom left corner.
Rather than display the header labels outside the grid, you can set
HEADERLABELLOCATION= INSIDE to display them inside the grid, as shown in the
following figure:
LAYOUT DATALATTICE Statement 67
BEGINGRAPH statement. The default output width is 640px, and the default output
height is 480px.
As the number of cells in the grid increases, the size of each cell decreases. At some
point the cells might become so small that a meaningful graph cannot be rendered. The
CELLHEIGHTMIN= and CELLWIDTHMIN= options set a threshold for the smallest
cell. If the actual cell height or width becomes smaller, then no panel is drawn. The
default minimum cell size is CELLHEIGHTMIN=100px and
CELLWIDTHMIN=100px.
Using the default panel size and cell size, the DATALATTICE layout accommodates a
grid of about 24 cells (6 columns by 4 rows). If you know that the number of cells is
larger, then you should increase the overall panel size, or decrease the minimum cell
size, or both. You can also use ROWS= , COLUMNS= , and PANELNUMBER= options
to partition your data so that a number of smaller grids are produced that cumulatively
show all of the value crossings.
SIDEBAR Blocks
A LAYOUT DATALATTICE enables you to display one or more sidebars outside of the
axes. A sidebar spans across columns or rows and is useful for displaying information
that applies to all of the columns or all of the rows. For example, sidebars are useful for
displaying a legend.
A SIDEBAR statement has the following syntax:
Example: LAYOUT DATALATTICE 69
sidebar / align=top;
discretelegend 'p' 'a' / across=2;
endsidebar;
This example shows the result of using row and column classification variables. In this
case, a four-column, three-row data lattice is created:
• The classification values are placed as row or column labels by default.
• The ROWDATARANGE=UNION option assures that an axis range is computed
separately for each row using the data ranges of all Y= columns in that row. This
facilitates the visual comparison of the data cells.
• A SIDEBAR block is used to place the legend at the bottom of the lattice.
The following graph was generated by the “Example Program” on page 69:
Example Program
proc template;
70 Chapter 4 • Layout Statements
Syntax
LAYOUT DATAPANEL CLASSVARS=(class-var1…class-varN) </option(s)> ;
LAYOUT PROTOTYPE </option(s)>;
GTL-statements;
ENDLAYOUT;
<SIDEBAR </ option(s) >;
GTL-statement(s);
ENDSIDEBAR;
<… more-sidebar-statement-blocks …> >
ENDLAYOUT;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
CELLHEIGHTMIN=dimension
specifies the minimum height of a cell in the grid.
CELLWIDTHMIN=dimension
specifies the minimum width of a cell in the grid.
COLUMNGUTTER=dimension
specifies the amount of empty space that is between the columns.
HEADERBACKGROUNDCOLOR=style-reference | color
specifies the background color of the cell headers.
HEADERBORDER=TRUE | FALSE
specifies whether a border is drawn around the header cells.
HEADERLABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
HEADEROPAQUE=TRUE | FALSE
specifies whether the background for cell headers is opaque (TRUE) or
transparent (FALSE).
HEADERPACK=TRUE | FALSE
specifies whether the header cells are consolidated into a comma-separated
list in order to save space.
HEADERSEPARATOR="string"
specifies one or more characters to place between each value in the cell
header when HEADERPACK=TRUE.
HEADERSPLITCOUNT=positive-integer
specifies the number of headers to consolidate on a header line before
splitting the text to the next line.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
72 Chapter 4 • Layout Statements
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting
levels of the layouts that are used.
SORTORDER=(role-sort-list)
specifies the order of the cells along the columns and rows.
Axis options
COLUMN2AXISOPTS=(axis-options)
specifies X2-axis options for all columns.
COLUMN2DATARANGE=AUTO | UNIONALL | UNION
specifies how the X2-axes of instances of the graph-prototype are scaled.
COLUMNAXISOPTS=(axis-options)
specifies X-axis options for all columns.
COLUMNDATARANGE=AUTO | UNIONALL | UNION
specifies how the X-axes of instances of the graph-prototype are scaled.
ROW2AXISOPTS=(axis-options)
specifies Y2-axis options for all rows.
ROW2DATARANGE=AUTO | UNIONALL | UNION
specifies how the Y2-axes of instances of the graph-prototype are scaled.
ROWAXISOPTS=(axis-options)
specifies Y-axis options for all rows.
ROWDATARANGE=AUTO | UNIONALL | UNION
specifies how the Y-axes of instances of the graph-prototype are scaled.
Inset options
INSET=(variable-list)
specifies what information is displayed in an inset.
INSETOPTS=(appearance-options)
specifies location and appearance options for the inset information.
Layout options
COLUMNS=integer
specifies the number of columns in the layout.
COLUMNWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the columns widths.
HEADERLABELDISPLAY=NAMEVALUE | VALUE | NONE
specifies the content of the cell headers.
INCLUDEMISSINGCLASS=TRUE | FALSE
specifies whether to include grid cells for crossings of the CLASSVARS
variables that contain a missing value.
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
ROWS=integer
specifies the number of rows in the layout.
ROWWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the row heights.
Panel options
ORDER=ROWMAJOR | COLUMNMAJOR
LAYOUT DATAPANEL Statement 73
Role options
ROLENAME=(role-name-list)
specifies user-defined roles for information contained in data columns.
Required Argument
CLASSVARS=(column-list)
specifies a list of classification variables. By default, a data cell is created for each
crossing of these variables in the input data. The total number of grid cells created is
the result of a crosstabulation table of all the classification variables plus any empty
cells needed to complete the last row or column of the grid. You can request that data
cells be generated for all possible crossings, even when the class variables have no
values at those crossings. For more information, see the SPARSE= option.
If the class variable is of type character, then its values are returned in data order. To
control the ordering of the values, you can sort the input data by the classification
variables. If the class variable is of type numeric, then the values are displayed in
ordinal order.
Formats can be assigned to class variables to create classification levels (for
example, an AGEGROUPFMT. format for numeric AGE). In this case, the
classification is performed after the format is applied. For numeric data, the order is
ordinal, based on the first value in each class.
Use the INCLUDEMISSINGCLASS option to control whether cells are displayed
when any value crossing contains a missing value.
The output size does not grow automatically as the number of cells increases. To set
a panel size for the current template, use the DESIGNHEIGHT= and
DESIGNWIDTH= options in the BEGINGRAPH statement. To set a panel size for
all templates in the current SAS session, use the HEIGHT= and WIDTH= options in
the ODS GRAPHICS statement. Size settings in the ODS GRAPHICS statement
override size settings in the BEGINGRAPH statement. The default output width is
640px, and the default output height is 480px.
As the number of cells in the grid increases, the size of each cell decreases. At some
point the cells might become so small that a meaningful graph cannot be rendered.
The CELLHEIGHTMIN= and CELLWIDTHMIN= options set a threshold for the
smallest cell. If the actual cell height or width becomes smaller, then no panel is
drawn. The default minimum cell size is CELLHEIGHTMIN=100px and
CELLWIDTHMIN=100px.
Using the default panel size and cell size, the DATAPANEL layout accommodates a
grid of about 24 cells (6 columns by 4 rows). If you know that the number of cells is
74 Chapter 4 • Layout Statements
larger, then you should increase the overall panel size, or decrease the minimum cell
size, or both. You can also use ROWS= , COLUMNS= , and PANELNUMBER=
options to partition your data so that a number of smaller grids are produced that
cumulatively show all of the value crossings.
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
HEADERBORDER=TRUE | FALSE
specifies whether a border is drawn around the header cells.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default TRUE
See “boolean ” for other Boolean values that you can use.
CELLHEIGHTMIN=dimension
specifies the minimum height of a cell in the grid. Use this option in conjunction
with the CELLWIDTHMIN= option to set the minimum cell size.
LAYOUT DATAPANEL Statement 75
The overall size of the panel is constrained by the HEIGHT= and WIDTH= options
in the ODS GRAPHICS statement. As the number of cells in the grid increases, the
size of each cell decreases. At some point the cell becomes so small that a
meaningful graph cannot be rendered. This option sets the minimum height threshold
for all cells. If the actual cell height becomes smaller, then no panel is drawn.
Default 100px
CELLWIDTHMIN=dimension
specifies the minimum width of a cell in the grid. Use this option in conjunction with
the CELLHEIGHTMIN= option to set the minimum cell size.
The overall size of the panel is constrained by the HEIGHT= and WIDTH= options
in the ODS GRAPHICS statement. As the number of cells in the grid increases, the
size of each cell decreases. At some point the cell becomes so small that a
meaningful graph cannot be rendered. This option sets the minimum width threshold
for all cells. If the actual cell width becomes smaller, then no panel is drawn.
Default 100px
COLUMNAXISOPTS=(axis-options)
specifies X-axis options for all columns.
COLUMN2AXISOPTS=(axis-options)
specifies X2-axis options for all columns.
Restriction This option is needed only if you use a plot statement that supports a
secondary X2 axis. If you do not use that statement’s XAXIS= option
to map data to the X2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data
Are Mapped to a Designated Axis” on page 876
UNIONALL
scales the X-axis data ranges across all layout columns and panels (when
PANELNUMBER= is in effect).
UNION
scales the X-axis data ranges separately for each column on a per-panel basis.
The scaling does not span multiple panels.
Default AUTO
Default AUTO
Interaction This option is needed only if you use a plot statement that supports a
secondary X2 axis. If you do not use that statement’s XAXIS= option
to map data to the X2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data Are
Mapped to a Designated Axis” on page 876
COLUMNGUTTER=dimension
specifies the amount of empty space that is between the columns.
Default 0
COLUMNS=integer
specifies the number of columns in the layout.
Defaults If this option is not specified and ROWS= is specified, then the
number of data cells (and columns) increases dynamically to allow all
classifier values to be presented.
If both this option and ROWS= are specified, then a grid of that size is
created, regardless of the number of classifier values. If the number of
classifier values is greater than the grid size, then no graphs are
created for some classifier values. If the number of classifier values is
small and the grid size large, then there might be empty cells created.
Interactions The overall grid size is constrained by the HEIGHT= and WIDTH=
options in the ODS GRAPHICS statement. As the grid size grows, the
cell size shrinks. To control the minimum size of a cell use the
CELLHEIGHTMIN= and CELLWIDTHMIN= options.
The START= and ORDER= options affect the how the rows are
populated.
COLUMNWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the columns widths.
EQUAL
all columns have equal width.
PROPORTIONAL
each column has a width that is proportional to the number of discrete midpoint
values that it contains.
If all of the following conditions are true, then the discrete axis is
used to proportion the columns: PROPORTIONAL is in effect,
both the X and X2 axes are used, and only one of the two axes is
discrete. If both axes are discrete, then the X axis is used to
proportion the columns.
Default EQUAL
78 Chapter 4 • Layout Statements
HEADERBACKGROUNDCOLOR=style-reference | color
specifies the background color of the cell headers.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Country=CANADA
Product=TABLE
VALUE
displays the classification variable value only in each cell header.
CANADA
TABLE
NONE
suppresses the cell headers.
Default NAMEVALUE
HEADEROPAQUE=TRUE | FALSE
specifies whether the background for cell headers is opaque (TRUE) or transparent
(FALSE).
Default TRUE
Interaction When this option is set to FALSE, the background color for cell headers
is not used.
LAYOUT DATAPANEL Statement 79
See “boolean ” on page 1339 for other Boolean values that you can use.
HEADERPACK=TRUE | FALSE
specifies whether the header cells are consolidated into a comma-separated list in
order to save space.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
The following figure shows the effect of HEADERPACK= on the cell headers in one
row of a data lattice. The data lattice contains classification variables Country, Year, and
Product.
Default FALSE
Note If the length of the cell header text exceeds the available width, then the
text is truncated.
See “boolean ” on page 1339 for other Boolean values that you can use.
HEADERSEPARATOR="string"
specifies one or more characters to place between each value in the cell header when
HEADERPACK=TRUE.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
HEADERSPLITCOUNT=positive-integer
specifies the number of headers to consolidate on a header line before splitting the
text to the next line.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
80 Chapter 4 • Layout Statements
The following figure shows how HEADERSPLITCOUNT=2 splits the cell header value
in a data panel of classification variables Country, Year, and Product.
Note If the length of the cell header text exceeds the available width, then the
text is truncated.
INCLUDEMISSINGCLASS=TRUE | FALSE
specifies whether to include grid cells for crossings of the CLASSVARS variables
that contain a missing value.
TRUE
any crossing of the class variables that includes a missing value produces a row
or column of cells in the grid.
FALSE
any crossing of the class variables that includes a missing value does not produce
a row or columns of cells in the grid.
By default, missing class values are included in the classification. When the data
contains missing classification values, cells are created for the missing classes. The
classification headers for the missing values are blank for missing string values or a
dot for missing numeric values. You can use the
INCLUDEMISSINGCLASS=FALSE option to exclude the missing values. If you
want to keep the missing values, then you can create a format that specifies more
meaningful headings for the missing classes. For an example, see “Missing Class
Values” in SAS Graph Template Language: User's Guide.
Note: ODS Graphics does not support Unicode values in user-defined formats in the
second maintenance release of SAS 9.4 and in earlier releases. Starting with the
third maintenance release of SAS 9.4, ODS Graphics supports Unicode values in
user-defined formats only if they are preceded by the (*ESC*) escape sequence.
Example: "(*ESC*){unicode beta}". ODS Graphics does not support an
escape character that is defined in an ODS ESCAPECHAR statement in user-
defined formats.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
INSET=(variable-list)
specifies what information is displayed in an inset. The variable-list defines one or
more variables whose names and values appear as a small table in the data cells. The
variables can be either numeric or character. Variable names are separated by spaces.
LAYOUT DATAPANEL Statement 81
Requirement No predefined information is available for the inset. You must create
the desired inset information as part of your input data. See “Creating
Your Inset Data” on page 68.
Note The variable values are associated with the data cells by data order.
That is, the first observation from all the variables in variable-list are
used in the first data cell, the second observation from all variables in
variable-list are used in the second data cell, and so on. If a value is
missing for an observation, then the corresponding name-value pair is
skipped in the affected data cell.
INSETOPTS=(appearance-options)
specifies location and appearance options for the inset information. The appearance
options can be any one or more of the following values:
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the inset is automatically aligned within the layout.
NONE
does not automatically align the inset. This inset’s position is set by the
HALIGN= and VALIGN=appearance-options.
AUTO
attempts to center the inset in the area that is farthest from any surrounding
markers. Data cells might have different inset placements.
(location-list)
restricts the inset’s possible locations to those locations in the specified
location-list, and uses the location-list position that least collides with the
data cell’s other graphics features. The location-list is a space-separated list
that can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,
CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.
Default NONE
BACKGROUNDCOLOR=style-reference | color
specifies the color of the inset background.
style-reference
specifies a style reference in the form style-element : style-attribute. Only the
COLOR and CONTRASTCOLOR style attributes are valid.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the inset.
82 Chapter 4 • Layout Statements
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
CONTENTDISPLAY=LABELVALUE | VALUE
specifies whether the variable information that is displayed in the inset includes
the column label and value, or only the column value.
Note: This feature applies to the second maintenance release of SAS 9.4 and to
later releases.
If a label is not assigned to a column, then the column name is used as the label
for that column. Consider the following inset data:
F
Obs _TYPE_ Value Pr > F
1 SS1 94.359 <.0001
The following figure shows the effect that the CONTENTDISPLAY= option has
on the content of an inset that displays this data.
Default LABELVALUE
Tip Use the SEPARATOR= option to specify a separator other than the
default blank space.
DATASCHEME=LIST | MATCHED
specifies the scheme that was used to merge the inset information into the
analysis data.
LIST
one-to-one merging (no BY statement) was used to merge the inset and
analysis data. The variable values are associated with the cells of the data
lattice by using data order. That is, the inset variable values in the first
observation are used in the inset for the first cell, the inset variable values in
the second observation are used in the inset for the second cell, and so on.
MATCHED
match-merging (using a BY statement) was used to merge the inset and
analysis data.
Default LIST
Tip MATCHED is the preferred data scheme for merging the inset and
analysis data.
Default LEFT
Interaction This option has an effect only when this layout is nested within a
region layout or when this layout is nested in an overlay-type layout
and AUTOALIGN=NONE.
OPAQUE=TRUE | FALSE
specifies whether the inset background is opaque (TRUE) or transparent
(FALSE).
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SEPARATOR="string"
specifies a new separator for the column label and value.
Note: This feature applies to the second maintenance release of SAS 9.4 and to
later releases.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TITLE="string"
specifies a title for the inset. The title is added at the top of the inset and spans
the full inset width.
Note Space is not reserved for the title when this value is not specified.
Tip Text properties for the title string can be specified with TITLEATTRS=.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default TOP
84 Chapter 4 • Layout Statements
Interaction This option has effect only when this layout is nested within a
region layout or when this layout is nested in an overlay-type layout
and AUTOALIGN=NONE.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether data cells are populated by column priority or by row priority.
ROWMAJOR
fills the data cells by rows, from the starting position.
COLUMNMAJOR
fills the data cells by columns, from the starting position.
Default ROWMAJOR
Interaction The starting point for rendering data cells is controlled by the START=
option. See the START= option for examples.
Note Sides that are not assigned padding are padded with the default amount.
LAYOUT DATAPANEL Statement 85
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
PANELNUMBER=positive-integer
specifies the number of the panel to produce. This option enables you to partition a
large grid into a number of smaller sized grids under these conditions:
• You set a grid size explicitly ( ROWS= and COLUMNS= options).
• The grid size (gridrows x gridcolumns) is smaller than the total number of
classifier levels.
• You execute the template N times and increment the panel number each time. N
is determined by CEIL(total-classification-levels / gridrows x
gridcolumns).
86 Chapter 4 • Layout Statements
Default 1
Example Suppose there are two classifiers (CLASS1 has 10 unique values and
CLASS2 has 11 unique values). By setting some smaller grid size, say
ROWS=3 and COLUMNS=4, and making the value of
PANELNUMBER= a dynamic or macro variable, you can create 10
panels (9 panels with 12 data cells and 1 panel with 2 data cells) that
collectively display all 110 possible crossings. You simply invoke PROC
SGRENDER or a DATA step 10 times, incrementing the dynamic value
for PANELNUMBER each time.
ROLENAME=(role-name-list)
specifies user-defined roles for information contained in data columns. The role
name list is a space-separated list role-name=column pairs.
Requirement The role names that you choose must be unique and different from
the predefined roles.
Example The following example assigns the column Obs to the user-defined
role TIP1.
ROLENAME=(TIP1=OBS)
ROWAXISOPTS=(axis-options)
specifies Y-axis options for all rows.
ROW2AXISOPTS=(axis-options)
specifies Y2-axis options for all rows.
Interaction This option is needed only if you use a plot statement that supports a
secondary Y2 axis. If you do not use that statement’s YAXIS= option
to map data to the Y2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data
Are Mapped to a Designated Axis” on page 876
UNIONALL
scales the Y-axis data ranges across all layout rows and panels (when
PANELNUMBER= is in effect).
UNION
scales the Y-axis data ranges separately for each row in the layout on a per-panel
basis. The scaling does not span multiple panels.
Default AUTO
Default AUTO
Interaction This option is needed only if you use a plot statement that supports a
secondary Y2 axis. If you do not use that statement’s YAXIS= option to
map data to the Y2 axis, then this option is ignored. For more
information about how data are mapped to the axes, see “Plot Data Are
Mapped to a Designated Axis” on page 876
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
Default 0
ROWS=integer
specifies the number of rows in the layout.
Defaults If this option is not specified and COLUMNS= is specified, then the
number of data cells (and rows) increases dynamically to allow all
classifier values to be presented.
If both this option and COLUMNS= are specified, then a grid of that
size is created, regardless of the number of classifier values. If the
number of classifier values is greater than the grid size, then no graphs
are created for some classifier values. If the number of classifier
values is small and the grid size large, then there might be empty cells
created.
Interactions The overall grid size is constrained by the HEIGHT= and WIDTH=
options in the ODS GRAPHICS statement. As the grid size grows, the
cell size shrinks. To control the minimum size of a cell use the
CELLHEIGHTMIN= and CELLWIDTHMIN= options.
The START= and ORDER= options affect how the rows are
populated.
ROWWEIGHT=EQUAL | PROPORTIONAL
specifies how weights are assigned to the row heights.
EQUAL
all rows have equal height.
PROPORTIONAL
each row has a height that is proportional to the number of discrete midpoint
values that it contains.
If all of the following conditions are true, then the discrete axis is
used to proportion the rows: PROPORTIONAL is in effect, both
the Y and Y2 axes are used, and only one of the two axes is
discrete. When both axes are discrete, the Y axis is used to
proportion the rows.
Default EQUAL
LAYOUT DATAPANEL Statement 89
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting levels of
the layouts that are used.
Default FALSE
Note Fonts maintain their size regardless of the specifications in the nested
layouts.
See “boolean ” on page 1339 for other Boolean values that you can use.
SKIPEMPTYCELLS=TRUE | FALSE
specifies whether the external axes skip the empty cells in a partially filled grid.
TRUE
skips empty cells and "snaps" the external axes to the nearest data cell, both
vertically and horizontally. Though the empty cells are not displayed, the data
cells in the grid are not enlarged to fill the area.
FALSE
displays external axes at their normal locations, even if there are empty cells at
one or more of the locations.
Whenever the total number of classifier crossings (data cells) is not evenly divisible
by the panel size (columns * rows), the last panel is partially filled with data cells
and padded with empty cells to complete the grid.
Here is an example of a data panel that consists of 16 data cells arranged in a 4-
column, 3-row grid. The following figure shows the default appearance of the last
panel:
When SKIPEMPTYCELLS=TRUE, the empty padding cells of the last panel are
removed and external axis ticks and tick values snap to the data cells:
90 Chapter 4 • Layout Statements
Note that SKIPEMPTYCELLS=TRUE removes only the empty padding cells on the
last panel. It does not remove any data cells that have no crossing values and
therefore no graph (these data cells are displayed when SPARSE=TRUE).
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SORTORDER=(role-sort-list)
specifies the order of the cells along the columns and rows. The role sort list is a list
of rolename=sort-order-keyword pairs, enclosed in parentheses.
rolename
a role that is defined by the ROLENAME= option.
sort-order-keyword
a sort-order keyword, which must be one of the following:
Tip The placement of the cells within the layout also depends on the starting
location, which is controlled by the START= option.
SPARSE=TRUE | FALSE
specifies whether crossings of the class variables include only the crossings in the
data or all possible crossings.
LAYOUT DATAPANEL Statement 91
FALSE
specifies that data cells are created only for crossings of the class variables that
are in the data.
TRUE
specifies that the number of data cells is the product of the unique values for each
classification variable.
By default, if a crossing of the class variables has a missing value as part of the data,
then a data cell is created for it.
Here is an example of a classification panel where the classification variables are
COUNTRY and STATE. There are 3 distinct values of COUNTRY (Canada, Mexico,
and U.S.A.) Within Canada and Mexico there are 4 states, and within U.S.A. there
are 8 states. All state names are unique to each country. Therefore, there are 16
unique STATE values and 48 unique crossings of COUNTRY and STATE, but there
are data for only 16 of the crossings.
Assume that a data panel layout is created with COLUMNS=6 and SPARSE=TRUE,
meaning to display all possible crossings. This is what the first row would look like.
Blank data cells are added whenever there are no data values for a crossing:
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
START=TOPLEFT | BOTTOMLEFT
indicates whether to start populating the grid cells from the top left or bottom left
corner. If ORDER=ROWMAJOR (the default) and START=TOPLEFT (the default),
then a 2 row 2 column grid is populated as shown in the following figure.
92 Chapter 4 • Layout Statements
Default TOPLEFT
Default BOTTOM
SPACEFILL=TRUE | FALSE
specifies whether to fill all the area of the sidebar with its contents.
Default TRUE
Tip To prevent a layout block within the sidebar from expanding to the sidebar
boundaries, set this option to FALSE.
See “boolean ” on page 1339 for other Boolean values that you can use.
Details
Statement Description
The LAYOUT DATAPANEL statement creates a grid of graphs, based on the values of
one or more classifications variables. The main differences between this layout and the
DATALATTICE layout is that this layout supports more than two classification
variables, and it provides more control over the grid layout.
By default, the number of cells in the layout is determined by a crosstabulation table of
all the classification variables plus any empty cells needed to complete the last row or
column of the grid. The contents of each data cell are based on a graph prototype that
you specify in the graph-prototype-block. You can enhance the display using one or
more sidebar-statement-blocks. For classification variables that have many values, you
can use the COLUMNS= option or the ROWS= option, or both with the
PANELNUMBER= option to generate multiple panel displays.
The order of the value pairings for the classification variables is determined by the order
that the variables are specified on the CLASSVARS= argument. The last named
variable’s values vary most rapidly (like nested DO loops). Variable values are always
returned in data order.
By default, the first data cell to be filled is in the layout’s top left corner, and data cells
are filled from left-to-right, top-to-bottom. Use the START= option to change the
starting data cell to the bottom left corner, and use the ORDER= option to determine
whether data cells fill by column or by row. See the START= option for illustrations on
how START= and ORDER= interact to manage the fill sequence for data cells.
Note: The DATAPANEL layout is designed to be the outermost layout in the template.
Prototype Block
You must specify a single graph-prototype-block within the LAYOUT DATAPANEL
block, using the following syntax:
LAYOUT PROTOTYPE </option(s)>;
GTL-statements;
ENDLAYOUT;
The graph-prototype-block determines the graphical content of each data cell and is
repeated within each data cell, based on the subsets of the classification variables.
For more information about the LAYOUT PROTOTYPE block and the list of available
options, see “LAYOUT PROTOTYPE Statement” on page 159.
94 Chapter 4 • Layout Statements
Sidebar Blocks
A LAYOUT DATAPANEL enables you to display sidebars outside of the axis areas. A
sidebar spans across columns or rows and is useful for displaying information that
applies to all of the columns or all of the rows. For example, sidebars are useful for
displaying a legend.
A SIDEBAR statement has the following syntax:
SIDEBAR </ option(s) >;
GTL-statement(s);
ENDSIDEBAR;
The following example shows a SIDEBAR block that displays a legend at the top of the
layout grid.
sidebar / align=top;
discretelegend 'p' 'a' / across=2;
endsidebar;
This example shows a four-column, three-row data panel using two classification
variables. With this layout, each data cell is subsetted and labeled with the values of the
classification variables.
• The ROWDATARANGE=UNION option assures that an axis range is computed
separately for each row using the data ranges of all Y= columns in that row. This
facilitates the visual comparison of the data cells.
• A SIDEBAR block is used to place the legend at the bottom of the lattice.
Example: LAYOUTDATAPANEL Statement 95
Example Graph
The following graph was generated by the “Example Program” on page 95:
Example Program
proc template;
define statgraph layoutdatapanel;
begingraph;
entrytitle "Annual Furniture Sales Comparisons";
layout datapanel classvars=(country year) /
columns=4 rows=3 rowdatarange=union
headerlabeldisplay=value
headerbackgroundcolor=GraphAltBlock:color
rowaxisopts=(display=(tickvalues) griddisplay=on
linearopts=(tickvalueformat=dollar12.))
columnaxisopts=(display=(tickvalues)
timeopts=(tickvalueformat=monname3.));
layout prototype / cycleattrs=true;
seriesplot x=month y=TotalActual / name="Actual";
seriesplot x=month y=TotalPredict / name="Predict";
endlayout;
sidebar / align=top;
discretelegend "Actual" "Predict" / border=false;
endsidebar;
endlayout;
endgraph;
end;
run;
Syntax
LAYOUT GLOBALLEGEND </option(s)>;
<discreteLegend-statement(s) | mergedLegend-statement(s)>;
ENDLAYOUT;
Appearance options
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
DISPLAYCLIPPED=TRUE | FALSE
specifies whether the global legend is displayed when any portion of its
nested legends cannot be fully rendered because of space constraints.
GUTTER=dimension
specifies the gap between nested layouts.
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
TYPE=ROW | COLUMN
specifies whether nested legends are arranged into a single row or column.
WEIGHTS=UNIFORM | PREFERRED | (weight-list)
specifies the preferred space allocation for the nested legends.
LEGENDTITLEPOSITION=LEFT | TOP
specifies the position of each nested legend’s title.
TITLE=“string”
specifies a title for the global legend.
TITLEATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the global legend title.
Location options
HALIGN=CENTER | LEFT | RIGHT
specifies the layout’s horizontal alignment within the graph area that is
defined by the BEGINGRAPH block.
Optional Arguments
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DISPLAYCLIPPED=TRUE | FALSE
specifies whether the global legend is displayed when any portion of its nested
legends cannot be fully rendered because of space constraints. When the graph size
is reduced, parts of a nested legend (title, legend symbol, or legend value) might be
clipped (truncated). When clipping occurs and this option is FALSE, the entire global
legend is removed from the graph and the space for it is reclaimed by the remainder
of the graph. When this option is TRUE, the global legend always appears, even if
some parts of the nested legends have been clipped.
Default FALSE
Interaction This option overrides any DISPLAYCLIPPED option that is set on its
nested legend statements.
See “boolean ” on page 1339 for other Boolean values that you can use.
GUTTER=dimension
specifies the gap between nested layouts.
Default 0
98 Chapter 4 • Layout Statements
Default CENTER
LEGENDTITLEPOSITION=LEFT | TOP
specifies the position of each nested legend’s title. Specifying LEFT places each title
to the left of the legend items for that legend. Specifying TOP places each title above
the legend items for that legend.
Default LEFT
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
Starting with the first maintenance release of SAS 9.4, the default padding
between the global legend and the plot area (including the axes) is
increased to 10 pixels. If the new default padding is not desirable, then use
this option to adjust it.
LAYOUT GLOBALLEGEND Statement 99
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
TITLE=“string”
specifies a title for the global legend.
Tip The title for the global legend is independent of the titles for its nested
legends.
Interaction For this option to have any effect, the TITLE= option must also be
specified.
100 Chapter 4 • Layout Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TYPE=ROW | COLUMN
specifies whether nested legends are arranged into a single row or column.
Default ROW
Interaction When this option is set to ROW, the relative width of each legend is
determined by the setting for the WEIGHTS= option.
Default UNIFORM
Tip When a weight-list is specified, all the legends using PREFERRED get
their preferred space. Any remaining space is divided among the
legends, in proportion to the numeric values specified in the weight-list.
Details
A global legend layout can contain multiple discrete or merged legends. Continuous
legends are not supported inside the global legend block.
A global legend is placed at the bottom of the graph, just above the footnote(s). All of
the discrete or merged legend statements that are nested within the global legend block
are arranged into a single row or column, depending on the setting for the TYPE=
option.
Depending on the outermost layout type and the legend content, the legend is centered
on the graph wall area or on the graph output area. For example, if the outermost layout
is an overlay layout, then when positioning the legend, the GLOBALLEGEND
statement first attempts to center the legend on the graph wall area. If that position
causes the legend to be clipped, then it then attempts to center the legend on the entire
output area instead. In that case, the legend might appear to be slightly off-center with
respect to the graph.
Only one global legend block is permitted in a graph. The block must be located within
the BEGINGRAPH block, but outside of the outermost layout block.
Example: LAYOUT GLOBALLEGEND Statement 101
When a global legend block is used, only the legend statements that are specified within
the global legend block are displayed in the graph. Any legend statements that are
specified outside of the global legend block are ignored.
The following graph was generated by the “Example Program” on page 101:
Example Program
proc template;
define statgraph globallegend;
begingraph;
entrytitle "Prediction Ellipses";
layout overlay;
scatterplot x=petallength y=petalwidth / group=species name="sp";
ellipse x=petallength y=petalwidth / type=predicted alpha=0.2
name="p80" legendlabel="80%" outlineattrs=graphconfidence;
ellipse x=petallength y=petalwidth / type=predicted alpha=0.05
name="p95" legendlabel="95%" outlineattrs=graphconfidence2;
endlayout;
layout globalLegend / type=column title="Sample Global Legend";
discretelegend "sp" / title="Species:";
discretelegend "p80" "p95" / title="Predictions:";
endLayout;
endgraph;
end;
run;
102 Chapter 4 • Layout Statements
Syntax
LAYOUT GRIDDED </option(s)>;
GTL-statements;
ENDLAYOUT;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
COLUMNGUTTER=dimension
specifies the amount of empty space between the columns.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting
levels of the layouts that are used.
Grid options
COLUMNS=integer
specifies the number of columns in the layout.
ROWS=integer
specifies the number of rows in the layout.
Layout options
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
Legend options
LOCATION=INSIDE | OUTSIDE
LAYOUT GRIDDED Statement 103
specifies whether the legend appears inside or outside the plot area when
nested within an overlay-type layout.
Location options
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether this layout is automatically aligned within its parent when
nested within an overlay-type layout.
HALIGN=CENTER | LEFT | RIGHT | number
specifies this layout’s horizontal alignment within its parent when nested
within an overlay-type or region layout.
VALIGN=CENTER | TOP | BOTTOM | number
specifies this layout’s vertical alignment within its parent when nested within
an overlay-type or region layout.
Panel options
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether data cells are populated by column priority or by row
priority.
Optional Arguments
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether this layout is automatically aligned within its parent when nested
within an overlay-type layout.
NONE
does not automatically align the layout within its overlay-type parent layout. This
layout’s position within its parent layout is therefore set by the HALIGN= and
VALIGN= options.
AUTO
within the overlay-type parent layout, attempts to center the layout in the area
that is farthest from any surrounding data point markers. This option is available
only if the parent layout contains a scatter plot. Otherwise, it is ignored.
(location-list)
within the parent layout, restricts the layout’s possible locations to those
locations in the specified location-list, and uses the location-list position that
least collides with the parent layout’s other graphics features. The location-list is
a space-separated list that can contain any of these locations: TOPLEFT, TOP,
TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and
BOTTOMRIGHT.
Default NONE
Restriction This option is ignored if this layout statement is the outermost layout
or if the parent layout is not an overlay-type layout.
Interactions When this option is not NONE and the parent layout is an overlay-
type layout, the HALIGN= and VALIGN= options are ignored.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
COLUMNGUTTER=dimension
specifies the amount of empty space between the columns.
Default 0
COLUMNS=integer
specifies the number of columns in the layout. This option is used to create a grid
with a fixed number of columns, without concern for how many rows. For example,
the following settings ensure that columns 1 and 2 in the first row are filled with
content, as shown in the figure:
Range 0 to 1, where 0 is all the way to the left and 1 is all the way to the
right.
Default CENTER
Restriction This option has effect only when this layout is nested within a region
layout, or when this layout is nested in an overlay-type layout and
AUTOALIGN=NONE.
LOCATION=INSIDE | OUTSIDE
specifies whether the legend appears inside or outside the plot area when nested
within an overlay-type layout.
Default INSIDE
Restriction This option has effect only when the GRIDDED layout block appears
within an overlay-type layout. For more information about how child
positions are determined in an overlay-type layout, see “LAYOUT
OVERLAY Statement” on page 136.
Interactions If this option is set to OUTSIDE, then the HALIGN= and VALIGN=
options must specify a keyword (LEFT, RIGHT, or CENTER). The
number setting for the alignment is invalid when the layout is
positioned outside of the plot area.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether data cells are populated by column priority or by row priority.
ROWMAJOR
fills all the columns in a row, from left to right, before going to the next row.
COLUMNMAJOR
fills all the rows in a column, from top to bottom, before going to the next
column.
Default ROWMAJOR
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
Default 0
108 Chapter 4 • Layout Statements
ROWS=integer
specifies the number of rows in the layout. This option is used to create a grid with a
fixed number of rows, without concern for how many columns. For example, the
following settings ensure that rows 1 and 2 in the first column are filled with content,
as shown in the figure:
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting levels of
the layouts that are used.
Default FALSE
Note Fonts maintain their size regardless of the specifications in the nested
layouts.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default CENTER
Example: LAYOUT GRIDDED Statement 109
Restriction This option has effect only when this layout is nested within a region
layout, or when this layout is nested in an overlay-type layout and
AUTOALIGN=NONE.
Details
A GRIDDED layout is commonly used to create small tables of text that are nested
within other layouts. The layout might also be used to span and center a single entry (a
legend, for example) across a set of grids. Or it might be used to display a grid of graphs
when there is no need to scale axis data ranges or align graphs across grid cells.
The GRIDDED layout automatically decides how much area to allocate to cell contents:
• Text items have a fixed size based on the amount of text and the font properties.
• Graphs take up the remaining space.
The layout’s grid size is determined by the COLUMNS= and ROWS= options. The
resulting columns and rows can be separated by areas called “gutters,” which are
controlled by the COLUMNGUTTER= and ROWGUTTER= options.
By default, the results of the GTL statements are placed into the grid sequentially from
left to right, wrapping to a new row each time the current row is filled. You can use the
ORDER= option to fill cells from top to bottom down a column. In that case, the layout
cells wrap to a new column each time the current column is filled. The GTL statements
can include text statements, plot statements, and layout blocks. Each statement or layout
block provides content for one cell in the grid.
If a statement or layout block for a grid cell does not produce any output, then the space
for that cell might not be retained as an empty cell in the grid. In that case, the empty cell
is removed, and the remaining cells (if any) fill the gap in the grid. A statement produces
no output when required data for that statement does not resolve. A layout block
produces no output when it contains no statements or when none of the statements
contained in the block produce any output.
The following graph was generated by the “Example Program” on page 110:
110 Chapter 4 • Layout Statements
Example Program
The GRIDDED layout offers the best way to nest a table of information inside another
layout. In the GRIDDED layout, you can control the content, text justification, and fonts
of columns. Because this example nests the GRIDDED layout within an OVERLAY
layout, you can control where it appears within the plot area. The AUTOALIGN= option
enables you to specify a prioritized list of possible positions where the layout should be
drawn. The position actually used is the first one that avoids collision with the
histogram. Also, the GRIDDED layout is set to be opaque so that the grid lines do not
show through.
This example also illustrates a reusable template in the sense that it works for any
numeric column specified by the dynamic variable VAR. Also, SGE functions for
computing the N, MEAN, STDDEV of the column are used in the table to compute the
statistics as the template is executed.
proc template;
define statgraph inset;
dynamic VAR;
begingraph;
entrytitle "Distribution of " VAR;
layout overlay / yaxisopts=(griddisplay=on);
histogram VAR / scale=percent;
layout gridded / columns=2
autoalign=(topleft topright) border=true
opaque=true backgroundcolor=GraphWalls:color;
entry halign=left "N";
entry halign=left eval(strip(put(n(VAR),12.0)));
entry halign=left "Mean";
entry halign=left eval(strip(put(mean(VAR),12.2)));
entry halign=left "Std Dev";
entry halign=left eval(strip(put(stddev(VAR),12.2)));
endlayout;
LAYOUT LATTICE Statement 111
endlayout;
endgraph;
end;
run;
Syntax
LAYOUT LATTICE </option(s)>;
GTL-statement(s) | cell-statement-block(s);
<COLUMNAXES;
COLUMNAXIS / axis-option(s);
<… more-COLUMNAXIS-statements …>
ENDCOLUMNAXES;>
<COLUMN2AXES;
COLUMNAXIS / axis-option(s);
<… more-COLUMNAXIS-statements …>
ENDCOLUMN2AXES;>
<ROWAXES;
ROWAXIS / axis-option(s);
<… more-ROWAXIS-statements …>
ENDROWAXES;>
<ROW2AXES;
ROWAXIS / axis-option(s);
<… more-ROWAXIS-statements …>
ENDROW2AXES;>
<COLUMNHEADERS;
GTL-statement(s);
ENDCOLUMNHEADERS;
<… more-header-statement-block(s) …> >
<SIDEBAR </option(s)>;
GTL-statement(s);
ENDSIDEBAR;>
<… more-sidebar-statement-blocks …> >
ENDLAYOUT;
112 Chapter 4 • Layout Statements
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
COLUMNGUTTER=dimension
specifies the amount of empty space that is between the columns.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting
levels of the layouts that are used.
Cell options
COLUMNWEIGHTS=UNIFORM | PREFERRED | (weight-list)
specifies the proportional width of each column relative to the overall grid
width, not including the headings and sidebars.
ROWWEIGHTS=UNIFORM | PREFERRED | (weight-list)
specifies the proportional height of each row relative to the overall grid
height, not including the headings and sidebars.
Column options
COLUMN2DATARANGE=DATA | UNION | UNIONALL
specifies how the X2-axis data ranges of graphs within the layout columns
are scaled.
COLUMNDATARANGE=DATA | UNION | UNIONALL
specifies how the X-axis data ranges of graphs within the layout columns are
scaled.
Lattice options
COLUMNS=integer
specifies the number of columns in the layout.
ROWS=integer
specifies the number of rows in the layout.
SKIPEMPTYCELLS=TRUE | FALSE
specifies whether the external axes skip the unused cells in a partially filled
lattice.
Layout options
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
Location options
LAYOUT LATTICE Statement 113
Panel options
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether data cells are populated by column priority or by row
priority.
Row options
ROW2DATARANGE=DATA | UNION | UNIONALL
specifies how the Y2-axis data ranges of graphs within the layout rows are
scaled.
ROWDATARANGE=DATA | UNION | UNIONALL
specifies how the Y-axis data ranges of graphs within the layout rows are
scaled.
Optional Arguments
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether this layout is automatically aligned within its parent when nested
within an overlay-type layout.
NONE
does not automatically align the layout within its overlay-type parent layout. This
layout’s position within its parent layout is therefore set by the HALIGN= and
VALIGN= options.
AUTO
within the overlay-type parent layout, attempts to center the layout in the area
that is farthest from any surrounding data point markers. This option is available
only if the parent layout contains a scatter plot. Otherwise, it is ignored.
(location-list)
within the parent layout, restricts the layout’s possible locations to those
locations in the specified location-list, and uses the location-list position that
least collides with the parent layout’s other graphics features. The location-list is
a space-separated list that can contain any of these locations: TOPLEFT, TOP,
TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and
BOTTOMRIGHT.
Default NONE
Restriction This option is ignored if this layout statement is the outermost layout or
if the parent layout is not an overlay-type layout.
Interaction When this option is not NONE and the parent layout is an overlay-type
layout, the HALIGN= and VALIGN= options are ignored.
114 Chapter 4 • Layout Statements
Example In the following example, the LATTICE layout is the child of the
OVERLAY layout. The child layout appears in either the top right or
top left position, based on which position has more “unoccupied” area.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
UNION
scales the X-axis data ranges separately for each column in the layout. This
setting is supported only if all plots across the column can share the same data
range and axis type. For more information, see “Plot Axis Types Must Agree on
Common Axes” on page 883.
UNIONALL
scales the X-axis data ranges across all columns in the layout. This setting is
supported only if all plots across the column can share the same data range and
axis type. For more information, see “Plot Axis Types Must Agree on Common
Axes” on page 883.
Default DATA
Interactions The data ranges are scaled only if the data values are continuous and
the graphs have the same orientation. If graphs cannot use the same
horizontal range or if COLUMNDATARANGE=DATA, then the
horizontal range of each graph is determined from the data.
Default DATA
Interactions The data ranges are scaled only if the data values are continuous and
the graphs have the same orientation. If graphs cannot use the same
116 Chapter 4 • Layout Statements
If any plot statement in any cell contains a XAXIS=X option, then this
plot's X values are ignored whenever COLUMN2DATARANGE= is
set to UNION or UNIONALL.
Tips Axes are always internal to the cell, by default. To externalize column
axes, set this option to UNION or UNIONALL, and then specify a
COLUMN2AXES block with as many COLUMNAXIS statements as
there are columns that contain X2-axes to manage.
COLUMNGUTTER=dimension
specifies the amount of empty space that is between the columns.
Default 0
COLUMNS=integer
specifies the number of columns in the layout.
Notes The PREFERRED option is used for lattice layouts that mix one-
dimensional and two-dimensional plots in the grid. It enables the
layout to compute the weights automatically for columns that
contain one-dimensional plots.
(weight-list)
a space-separated list of column weights. The list should contain a weight for
each column, which can be expressed as one of the following:
PREFERRED
specifies that the corresponding column gets its preferred width as described
previously.
number
specifies that the corresponding column gets a width that is based on the
proportion of the specified number to the total of the numbers in the weight
list. For example, the following weight specifications are equivalent:
columnweights=(0.2 0.3 0.5)
columnweights=(2 3 5)
In these examples, the first column gets 20% of the available width, the
second column gets 30%, and the third column gets 50%.
If the list contains the PREFERRED keyword, then the number specifies the
proportion of the width that remains after the preferred width or widths are
calculated and subtracted from the available width.
If there are n columns in the grid, then the weight list should
contain n weights, one for each column.
Note The weights for all of the columns are specified as a proportion
and, as such, are not required to total 1.0.
118 Chapter 4 • Layout Statements
Example Here is an example that specifies the preferred width for the first
column, 20% of the remaining width to the second column, and
80% of the remaining width to the third column.
columnweights=(preferred 0.2 0.8)
Range 0 to 1, where 0 is all the way to the left and 1 is all the way to the
right.
Default CENTER
Restriction This option has effect only when this layout is nested within a region
layout, or when this layout is nested in an overlay-type layout and
AUTOALIGN=NONE.
Example In the following example, the LATTICE layout is the child of the
OVERLAY layout and is positioned in the OVERLAY’s top right
corner.
dynamic VAR STAT1 STAT2 STAT3;
layout overlay;
histogram VAR;
layout lattice / VALIGN=TOP HALIGN=RIGHT
columns=1;
entry STAT1;
entry STAT2;
entry STAT3;
endlayout;
endlayout;
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether data cells are populated by column priority or by row priority.
ROWMAJOR
fills all the columns in a row, from left to right, before going to the next row.
LAYOUT LATTICE Statement 119
COLUMNMAJOR
fills all the rows in a column, from top to bottom, before going to the next
column.
Default ROWMAJOR
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
120 Chapter 4 • Layout Statements
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
Default DATA
Interactions The data ranges are scaled only if the data values are continuous and
the graphs have the same orientation. If graphs cannot use the same
vertical range or if ROWDATARANGE=DATA, then the vertical
range of each graph is determined from the data.
Tips Axes are always internal to the cell, by default. To externalize row
axes, set this option to UNION or UNIONALL, and then specify a
ROWAXES block with as many ROWAXIS statements as there are
rows that contain Y-axes to manage.
Default DATA
Interactions The data ranges are scaled only if the data values are continuous and
the graphs have the same orientation. If graphs cannot use the same
vertical range or if ROW2DATARANGE=DATA, then the vertical
range of each graph is determined from the data.
If any plot statement in any cell contains a YAXIS=Y option, then this
plot's Y values are ignored whenever ROW2DATARANGE= is set to
UNION or UNIONALL.
Tips Axes are always internal to the cell, by default. To externalize row
axes, set this option to UNION or UNIONALL, and then specify a
ROW2AXES block with as many ROWAXIS statements as there are
rows that contain Y2-axes to manage.
ROWGUTTER=dimension
specifies the amount of empty space between the rows.
Default 0
ROWS=integer
specifies the number of rows in the layout.
Notes The PREFERRED option is used for lattice layouts that mix one-
dimensional and two-dimensional plots in the grid. It enables the layout
to compute the weights automatically for rows that contain one-
dimensional plots.
(weight-list)
a space-separated list of row weights. The list should contain a weight for each
row, which can be expressed as one of the following:
PREFERRED
specifies that the corresponding row gets its preferred height as described
previously.
Note The PREFERRED option should be used on rows that contain only
one-dimensional plots. Using the PREFERRED keyword on rows that
contain a mix of one-dimensional and two-dimensional plots might
cause unexpected results. In that case, use a numeric weight instead.
LAYOUT LATTICE Statement 123
number
specifies that the corresponding row gets a height that is based on the
proportion of the specified number to the total of the numbers in the weight
list. For example, the following weight specifications are equivalent:
rowweights=(0.2 0.3 0.5)
rowweights=(2 3 5)
In these examples, the first row gets 20% of the available height, the second
row gets 30%, and the third row gets 50%.
If the list contains the PREFERRED keyword, then the number specifies the
proportion of the height that remains after the preferred height or heights are
calculated and subtracted from the available height.
If there are n rows in the grid, then the weight list should contain
n weights, one for each row.
Note The weights for all of the rows are specified as a proportion and,
as such, are not required to total 1.0.
Example Here is an example that specifies 25% of the available height for
the first row, 25% for the second row, and 50% for the third row.
rowweights=(1 1 2)
SHRINKFONTS=TRUE | FALSE
specifies whether fonts in the layout are scaled, depending on the nesting levels of
the layouts that are used.
Default FALSE
Note Fonts maintain their size regardless of the specifications in the nested
layouts.
See “boolean ” on page 1339 for other Boolean values that you can use.
SKIPEMPTYCELLS=TRUE | FALSE
specifies whether the external axes skip the unused cells in a partially filled lattice.
FALSE
displays external axes at their normal locations.
TRUE
skips empty cells and “snaps” the external axes to the nearest populated cell, both
vertically and horizontally.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
number
specifies the vertical alignment as a fraction of the parent container’s height.
Default CENTER
Restriction This option has effect only when this layout is nested within a region
layout, or when this layout is nested in an overlay-type layout and
AUTOALIGN=NONE.
Example In the following example, the LATTICE layout is the child of the
OVERLAY layout. The child layout will appear in either the top right
or top left position, based on which position has more "unoccupied"
area.
dynamic VAR STAT1 STAT2 STAT3;
layout overlay / height=500px width=600px;
histogram VAR;
layout lattice / VALIGN=TOP HALIGN=RIGHT
height=80px width=70px columns=1;
entry STAT1;
entry STAT2;
entry STAT3;
endlayout;
endlayout;
Default BOTTOM
Tip You can use ENTRY statements to place rotated text in the right or left side
bar.
SPACEFILL=TRUE | FALSE
specifies whether to fill all the area of the sidebar with its contents.
Default TRUE
Tip To prevent a layout block within the sidebar from expanding to the sidebar
boundaries, set this option to FALSE.
See “boolean ” on page 1339 for other Boolean values that you can use.
LAYOUT LATTICE Statement 125
Details
Statement Description
The LAYOUT LATTICE statement creates a grid of graphs that are aligned across
columns and rows. For plot statements that are specified in the layout block or nested in
a LAYOUT OVERLAY statement, the LATTICE layout automatically aligns the plot
areas and tick display areas in the plots.
Note: To achieve the alignment, the LATTICE layout automatically aligns plot areas and
tick display areas across columns and rows. Also, it overrides axis-offset settings in
the OVERLAY layouts that you specify in those columns and rows. (For details
about offsets and the tick display area, see “Adjusting Axis Offsets” on page 886.) If
you do not want this alignment, then you might use LAYOUT GRIDDED instead.
For example, if you have a heterogeneous panel of graphs, such as a mix of scatter
plots, box plots, bar charts, or other types of graphs, then you might consider using
LAYOUT GRIDDED rather than LAYOUT LATTICE.
The layout can unify the scale of the data ranges that are displayed in the plots, based on
the values set for the COLUMNDATARANGE= and ROWDATARANGE= options. If
one or more plots within the template use the XAXIS= option to produce independent
X2 (top) axes, then the X2 data scales can be unified, based on the values set for the
COLUMN2DATARANGE= option. If one or more plots within the template use the
YAXIS= option to produce independent Y2 (right) axes, then the Y2 data scales can be
unified, based on the values set for the ROW2DATARANGE= options. The data ranges
can be scaled separately for each column, for each row, or for both. Or they can be
scaled across all columns, all rows, or all of both.
When the data-range scales are unified, you can simplify the layout by displaying only
the external axes that apply to all of the graphs across the corresponding columns or
rows. See “Axis Statements” on page 129 for more details.
The following figure shows the parts of the Lattice layout with the default axis display
(internal axes are displayed).
126 Chapter 4 • Layout Statements
This next figure shows the parts of the Lattice layout when the graph display is
simplified so that only external axes are displayed.
Note: The figure shows secondary X (top) and secondary Y (right) axes. The layout also
enables you to generate independent X2 (top) and independent Y2 (right) axes. For
details, see “Axis Statements” on page 129
LAYOUT LATTICE Statement 127
The columns and rows can be separated by areas called “gutters,” which are controlled
by the COLUMNGUTTER= and ROWGUTTER= options. In addition, the
COLUMNWEIGHTS= and ROWWEIGHTS= options can be used to allocate a
proportion of available space to each row and column.
The LATTICE layout automatically decides how much area to allocate to cell contents:
• Text items have a fixed size based on the amount of text and the font properties.
• Graphs take up the remaining space.
The layout’s grid size is determined by the COLUMNS= and ROWS= options.
By default, the results of the GTL-statements are placed into the grid sequentially from
left to right, wrapping to a new row each time the current row is filled. You can use the
ORDER= option to fill cells from top to bottom down a column. In that case, the layout
cells wrap to a new column each time the current column is filled.
Cell Contents
The following general syntax is used to define the contents of each cell in a LAYOUT
LATTICE:
GTL-statement(s) | cell-statement-block(s)
A cell-statement-block, when used, has the following syntax:
128 Chapter 4 • Layout Statements
CELL;
<CELLHEADER; GTL-statement(s); ENDCELLHEADER;>
GTL-statement(s);
ENDCELL;
The following guidelines apply to defining cell content:
• The contents of each cell is generated by GTL statements, which can be specified
independently or enclosed in a CELL block.
• Independent GTL statements include text statements, plot statements, or layout
blocks. Each independently specified GTL statement or layout block provides
content for one cell.
• A CELL block can include text statements, plot statements, or layout blocks. Each
CELL block provides content for one cell.
• Within a CELL block, you can use a CELLHEADER block to generate one or more
header lines within the cell. Specify each header line on a separate GTL statement
within the CELLHEADER block. The header block is typically used to specify one
or more text statements, but other statements are allowed within the block. For
example, you can specify a LAYOUT GRIDDED statement to produce a grid of text
for the header
• You can use only one CELLHEADER block per CELL block. If you specify more
than one, then only the last one is used.
• If you do not specify a CELLHEADER block in a CELL block, then the enclosed
GTL statements produce the same results that they would produce if they were
specified independently.
• If more than one plot statement is needed to generate contents for a cell, you should
place the plot statements in a layout block such as LAYOUT OVERLAY. Otherwise,
unexpected results might occur. This applies to independent GTL statements and to
GTL statements in a CELL block. See Figure 4.1 on page 129.
If a CELL block, or an independent statement or layout block for a lattice cell does not
produce any output, then the space for that cell might not be retained as an empty cell in
the lattice. In that case, the empty cell is removed, and the remaining cells (if any) fill
the gap in the lattice. A statement produces no output when required data for that
statement does not resolve. A layout block produces no output when it contains no
statements or when none of the statements contained in the block produce any output.
The example code shows a LAYOUT LATTICE block that uses one GTL statement and
one CELL block to generate the two-column layout shown in the following figure:
LAYOUT LATTICE Statement 129
Figure 4.1 Lattice Layout with Independent Plot Statements and a CELL Block
proc template;
define statgraph cellcontents;
begingraph;
layout lattice /
columngutter=5 columns=2;
Axis Statements
Overview
The axis statements can be used to simplify and clarify the layout by displaying only the
external axes in the resulting graph.
The following figure shows the default layout with internal axes displayed:
130 Chapter 4 • Layout Statements
This next figure shows a simplified layout with only the external axes displayed:
Axis statements are useful only if the data ranges across the affected columns or rows
are comparable and can be unified to a common scale. For example, external axes are
not supported if an affected lattice cell contains a LAYOUT OVERLAYEQUATED
statement. If the axis ranges are not unified for the affected columns or rows, then the
axis statements in the layout are ignored.
To unify data ranges in the layout grid, the following options are available:
X COLUMNDATARANGE= X2 COLUMN2DATARANGE=
Y ROWDATARANGE= Y2 ROW2DATARANGE=
LAYOUT LATTICE Statement 131
COLUMNAXES; COLUMN2AXES;
COLUMNAXIS / axis-option(s); COLUMNAXIS / axis-option(s);
<…COLUMNAXIS-n;> <…COLUMNAXIS-n;>
ENDCOLUMNAXES; ENDCOLUMN2AXES;
ROWAXES; ROW2AXES;
ROWAXIS / axis-option(s); ROWAXIS / axis-option(s);
<…ROWAXIS-n;> <…ROWAXIS-n;>
ENDROWAXES; ENDROW2AXES;
/* axis definitions */
rowaxes;
rowaxis /griddisplay=on;
endrowaxes;
LAYOUT LATTICE Statement 133
/* cell contents */
scatterplot x=x y=t;
scatterplot x=x y=y;
endlayout;
endgraph;
Header Statements
Header statements are used to display one or more headers for the columns and rows in a
Lattice layout. Each statement is specified as a block in the form statement -
ENDstatement. The header block is typically used to specify one or more text
statements, but other statements are allowed within the block. For example, you could
specify a LAYOUT GRIDDED statement to produce a grid of text for the header.
The general syntax for a COLUMNHEADERS statement is
COLUMNHEADERS;
GTL-statement(s);
ENDCOLUMNHEADERS;
The following header statements are available:
• The LAYOUT LATTICE aligns headers with the columns, or the rows, or both.
• Each of the header blocks COLUMNHEADERS, COLUMN2HEADERS,
ROWHEADERS, and ROW2HEADERS can be used once in a LAYOUT LATTICE
block. If more than one block is specified for one of the statements, then only the last
specified block for that statement is used.
The following example shows a LAYOUT LATTICE block that uses a
COLUMNHEADERS block to display column headers above the left and right columns
in the layout.
134 Chapter 4 • Layout Statements
begingraph;
layout lattice / columns=2;
/* cell contents */
scatter x=x y=t;
scatter x=x y=y;
endlayout;
endgraph;
Sidebar Statements
A LAYOUT LATTICE supports the display of a sidebar between a row or column
header and an external axis. (See the figures in “Statement Description” on page 125 .) A
sidebar spans across columns or rows and is useful for displaying information that
applies to all of the columns or all of the rows. For example, sidebars are useful for
displaying legends.
A SIDEBAR statement has the following syntax:
SIDEBAR </option(s)>;
GTL-statement(s);
ENDSIDEBAR;
• You can specify up to four SIDEBAR blocks in a LAYOUT LATTICE, one for each
of the top, bottom, left, and right sidebar positions.
• If two or more SIDEBAR blocks have the same alignment, then the sidebar
information forms two or more columns (ALIGN=LEFT or ALIGN=RIGHT) within
the sidebar area. Or it forms two or more rows (ALIGN=TOP or
ALIGN=BOTTOM) within the sidebar area.
• Only one statement (such as ENTRY or DISCRETELEGEND) or one layout block
(such as LAYOUT GRIDDED) is allowed in a SIDEBAR block. To create multi-line
text in a sidebar, nest ENTRY statements within a LAYOUT GRIDDED block.
• The LAYOUT LATTICE automatically aligns a sidebar with the layout columns or
rows.
The following example shows a LAYOUT LATTICE block that uses a SIDEBAR block
to display a top sidebar in the layout.
begingraph;
layout lattice / columns=2;
sidebar / align=top;
layout gridded / border=true ;
entry "Top Sidebar" ;
entry "(spans both columns)";
endlayout;
endsidebar;
endlayout;
begingraph;
This example shows a two-cell lattice layout (two columns, one row). A ROWAXES
block is used in the example to make the Y axes external to both cells.
• The ROWDATARANGE=UNION option assures that the data ranges of all Y=
columns in the row cells are considered to construct a common axis range. This
facilitates the visual comparison of the cells.
• A SIDEBAR block is used to place the legend at the top of the lattice.
• Because the ROWAXIS statement within the ROWAXES block uses the
DISPLAYSECONDARY= option, a secondary Y axis is displayed on the right. The
secondary Y axis is not an independent axis. Rather, it mirrors the primary Y axis,
making it easier to read Y-axis values when viewing the bar chart that is in the right
cell.
The following graph was generated by the “Example Program” on page 135 :
Example Program
proc template;
define statgraph layoutlattice;
begingraph;
entrytitle "Vehicle Gas Mileage";
entryfootnote "Averages of 428 models from 38 manufactures";
layout lattice / columns=2 rowdatarange=union;
136 Chapter 4 • Layout Statements
Syntax
LAYOUT OVERLAY </option(s)>;
GTL-statements;
<INNERMARGIN </options(s)>;
block-plot-statement(s); | axis-table statement(s);
ENDINNERMARGIN;>
<… more-innermargin-blocks …> >
ENDLAYOUT;
Appearance options
LAYOUT OVERLAY Statement 137
ASPECTRATIO=AUTO | positive-number
specifies the aspect ratio of the plot’s wall area.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in
nested plot statements automatically change from plot to plot.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
WALLDISPLAY=STANDARD | ALL | NONE | (display-options)
specifies whether the plot’s wall and wall outline are displayed.
Axes options
X2AXISOPTS=(axis-options)
specifies one or more X2 axis options.
XAXISOPTS=(axis-options)
specifies one or more X axis options.
Y2AXISOPTS=(axis-options)
specifies one or more Y2 axis options.
YAXISOPTS=(axis-options)
specifies one or more Y axis options.
Optional Arguments
ASPECTRATIO=AUTO | positive-number
specifies the aspect ratio of the plot’s wall area. The ratio is expressed as a positive
decimal fraction representing wall-height divided by wall-width. For example, 0.75
is a 3/4 aspect ratio and 1.0 is a square aspect ratio.
Default AUTO. The wall area is sized to the maximum area that can fill the
available space inside the OVERLAY layout.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
138 Chapter 4 • Layout Statements
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in nested
plot statements automatically change from plot to plot.
FALSE
does not cycle the default visual attributes of multiple plots. For example, if you
overlay three series plots, then each series line has the same default visual
properties.
TRUE
attempts to use the GraphData1–GraphDataN style elements to assign different
visual properties to applicable plots (scatter plots and series plots and others).
Some plots in the layout do not participate in the cycling (for example, reference
lines and drop lines).
Default FALSE
See “Rotating Visual Attributes for Each Plot in an Overlay” on page 183
“boolean ” on page 1339 for other Boolean values that you can use.
Example In the following example, the first three series plots are assigned line
properties that are based on the GraphData1, GraphData2, and
GraphData3 style elements. The fourth series plot does not participate in
the attribute cycling because its LINEATTRS= option assigns a line style.
layout overlay / cycleattrs=true;
seriesplot x=date y=var1;
seriesplot x=date y=var2;
LAYOUT OVERLAY Statement 139
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
140 Chapter 4 • Layout Statements
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style- attribute named COLOR or CONTRASTCOLOR is used.
Default STANDARD
Tips Use the WALLCOLOR= option to control the fill color of the wall.
The appearance attributes of the wall outline are set by the GraphAxisLine
style element.
XAXISOPTS=(axis-options)
specifies one or more X axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
See “Axis Options for LAYOUT OVERLAY” on page 889 for a list of
axis options.
X2AXISOPTS=(axis-options)
specifies one or more X2 axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
See “Axis Options for LAYOUT OVERLAY” on page 889 for a list of
axis options.
YAXISOPTS=(axis-options)
specifies one or more Y axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
See “Axis Options for LAYOUT OVERLAY” on page 889 for a list of
options.
Y2AXISOPTS=(axis-options)
specifies one or more Y2 axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
See “Axis Options for LAYOUT OVERLAY” on page 889 for a list of
options.
142 Chapter 4 • Layout Statements
Details
The LAYOUT OVERLAY statement builds a composite using one or more GTL-
statements. You can specify one or more two-dimensional plots within the layout,
provided all plots can share the same type of axes. You can also specify one or more
insets, such as nested layout statements (for example, LAYOUT GRIDDED), ENTRY
statements, and legend statements (for example, CONTINUOUSLEGEND or
DISCRETELEGEND).
The following general logic applies to rendering the composite:
Note: The details for positioning insets also apply to insets that are specified within a
LAYOUT REGION block.
• All plot statements are rendered first. Plot statement results are always rendered in
the plot area. The plots are stacked on top of one another in the order in which they
are specified, with the last one on top. It is possible for one plot’s graphical data to
obscure graphical data beneath it. You can control this by selectively ordering the
plot statements, or by using transparency on the individual plots, or by doing both.
• The insets are rendered next, in the order in which they are specified. As with the
plot statements, it is possible for the insets to obscure the results of other statements
in the layout.
• To control the horizontal and vertical positioning of some insets, you can use the
inset statement’s AUTOALIGN= option, or its HALIGN= and VALIGN= options.
Each nested inset determines its own relative position in the parent OVERLAY. This
positioning achieves the best results for text-based insets whose size can be easily fit
within an open area of the graph wall. A large text-based inset might not fit well, and
an inset that contains a plot might be dropped from the display without warning
when the template is executed.
• Some insets, like legends, can be positioned inside or outside of the plot area using
the inset statement’s LOCATION= option. The inset’s AUTOALIGN= or HALIGN=
and VALIGN= settings are then relative to that location.
Generally, the first specified plot determines the layout’s default axis characteristics. To
enable another plot to define the axis characteristics, set PRIMARY=TRUE for that plot.
For more information about the default axis characteristics, see “When Plots Share Data
and a Common Axis” on page 880. See also the LAYOUT OVERLAYEQUATED and
the LAYOUT OVERLAY3D statements.
An overlay layout can also contain an inner margin, which is a nested region at the top or
bottom of the OVERLAY container. One or more inner margin plots can be specified,
and each is specified within an INNERMARGIN block. Within the INNERMARGIN
block, only one-dimensional plot statements such as BLOCKPLOT and AXISTABLE
can be specified. See “INNERMARGIN Statement” on page 166.
This example shows how to create a simple overlay of two series plots using the
OVERLAY layout. The following figure shows the output.
Example: Simple Overlay 143
Syntax
LAYOUT OVERLAYEQUATED </option(s)>;
GTL-statements;
ENDLAYOUT;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in
nested plot statements automatically change from plot to plot.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
WALLDISPLAY=STANDARD | ALL | NONE | (display-options)
specifies whether the plot’s wall and wall outline are displayed.
Axes options
COMMONAXISOPTS=(common-axis-options)
specifies one or more options to apply to both the X and Y equated axes.
EQUATETYPE=FIT | SQUARE | SQUAREDATA | EQUATE
specifies how to draw the axis area.
XAXISOPTS=(axis-options)
specifies one or more X axis options.
YAXISOPTS=(axis-options)
specifies one or more Y axis options.
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
COMMONAXISOPTS=(common-axis-options)
specifies one or more options to apply to both the X and Y equated axes.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in nested
plot statements automatically change from plot to plot.
FALSE
does not cycle the default visual attributes of multiple plots. For example, if you
overlay three series plots, then each series line has the same default visual
properties.
TRUE
attempts to use the GraphData1–GraphDataN style elements to assign different
visual properties to applicable plots (scatter plots and series plots and others).
Some plots in the layout do not participate in the cycling (for example, reference
lines and drop lines).
Default FALSE
See “Rotating Visual Attributes for Each Plot in an Overlay” on page 183
“boolean ” on page 1339 for other Boolean values that you can use.
FIT
specifies that the X and Y axes have equal increments between tick values. The
data ranges of both axes are compared to establish a common increment size. The
axes might be of different lengths and have a different number of tick marks.
Each axis represents its own data range. One axis might be extended to use
available space in the plot area. If a TICKVALUELIST= or
TICKVALUESEQUENCE= axis option is used on COMMONAXISOPTS= ,
then it is ignored.
SQUARE
specifies that both the X and Y axes have the same length and the same major
tick values. The axis length and tick values are chosen so that the minimum and
maximum of both X and Y appear in the range of values appearing on both axes.
SQUAREDATA
specifies that both the X and Y axes have the same data range, but they can have
different tick values. A UNION of the data ranges does not occur in this case. For
example, if the X axis values are 20 to 40 (range of 20) and the Y axis values are
200 to 260 (range of 60), then both axes have a range of 60 units, but the X axis
can have tick values 0, 20, 40, and 60, and the Y axis can have tick values 200,
220, 240, and 260.
EQUATE
same as FIT except that neither axis is extended to use available space in the plot
area.
Default FIT
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
AUTO
specifies that the default outside padding for this component is used.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the layout border.
(pad-options)
a space-separated list of one or more of the following name-value pair options,
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
LAYOUT OVERLAYEQUATED Statement 149
Default 0
Note Sides that are not assigned padding are padded with the default amount.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style- attribute named COLOR or CONTRASTCOLOR is used.
Default STANDARD
Tips Use the WALLCOLOR= option to control the fill color of the wall.
The appearance attributes of the wall outline are set by the GraphAxisLine
style element.
XAXISOPTS=(axis-options)
specifies one or more X axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
150 Chapter 4 • Layout Statements
YAXISOPTS=(axis-options)
specifies one or more Y axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
Details
The LAYOUT OVERLAYEQUATED statement is similar to the LAYOUT OVERLAY
statement: it builds a composite using one or more GTL-statements. Similar to a
LAYOUT OVERLAY, you can specify one or more 2-D plots within the layout,
provided all plots can share the same type of axes. (Additional restrictions are discussed
in a moment.) You can also specify one or more insets.
As an overlay-type layout, OVERLAYEQUATED has the same behavioral
characteristics as an OVERLAY layout. It uses the same general logic for rendering the
composite (see “LAYOUT OVERLAY Statement” on page 136 for details), and its
default axis characteristics are generally determined by the first specified plot, unless
you use PRIMARY=TRUE on an alternative plot statement (see “When Plots Share Data
and a Common Axis” on page 880).
OVERLAYEQUATED differs from OVERLAY in several ways. With
OVERLAYEQUATED,
• The axis type for both X and Y axes is always linear. Thus, plot types that have
discrete or binned axes cannot be used within this layout (for example, BOXPLOT,
BOXPLOTPARM, BARCHARTPARM, HISTOGRAM, and HISTOGRAMPARM).
• For equal data intervals on both axes, the display distance is the same. For example,
an interval of 2 on the X axis maps to the same display distance as an interval of 2 on
the Y axis.
• The aspect ratio of the plot display equals the aspect ratio of the plot data. In other
words, a 45 degree slope in data is represented by a 45 degree slope in the display.
The EQUATETYPE= option determines how the axes are drawn.
The following figure illustrates how a series plot might map differently when specified
in an OVERLAYEQUATED layout versus an OVERLAY layout:
Example: LAYOUT OVERLAYEQUATED Statement 151
The following graph was generated by the “Example Program” on page 152:
152 Chapter 4 • Layout Statements
Example Program
proc template;
define statgraph layoutoverlayequated;
begingraph;
entrytitle "Gas Mileage for GMC Models";
layout overlayequated / equatetype=fit;
referenceline y=16.2 /
curvelabel="City Average for Trucks/SUVs"
curvelabellocation=inside
curvelabelattrs=GraphReference;
referenceline x=20.6 /
curvelabel="Highway Average for Trucks/SUVs"
curvelabellocation=inside
curvelabelattrs=GraphReference;
scatterplot x=mpg_highway y=mpg_city /
datalabel=model;
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.cars
template=layoutoverlayequated;
where make="GMC";
run;
Restriction: You can add one or more 3-D plots to the graph area that the LAYOUT OVERLAY3D
statement creates, but all of the graphs will share the same set of axes.
Syntax
LAYOUT OVERLAY3D </option(s)>;
GTL-statements;
ENDLAYOUT;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the layout.
CUBE=TRUE | FALSE
specifies whether the layout displays the lines that indicate the complete
bounding cube of the axis planes.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in
nested plot statements automatically change from plot to plot.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the layout border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
ROTATE=number
specifies the angle of rotation.
TILT=number
specifies the angle of tilt in degrees.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
WALLDISPLAY=STANDARD | ALL | NONE | (display-options)
specifies whether the plot’s wall and wall outline are displayed.
ZOOM=positive-number
specifies a zoom factor.
Axes options
XAXISOPTS=(axis-options)
specifies one or more X axis options.
YAXISOPTS=(axis-options)
specifies one or more Y axis options.
ZAXISOPTS=(axis-options)
specifies one or more Z axis options.
154 Chapter 4 • Layout Statements
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
CUBE=TRUE | FALSE
specifies whether the layout displays the lines that indicate the complete bounding
cube of the axis planes.
Default TRUE
Note The cube lines are displayed independently of the wall borders and axis
lines. Because some cube lines coincide with wall borders and axis lines, it
might appear that turning off wall borders or axis lines has no effect when
CUBE=TRUE.
Tip The color, thickness, and pattern of the cube lines are determined by the
GraphAxisLines style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in nested
plot statements automatically change from plot to plot.
LAYOUT OVERLAY3D Statement 155
FALSE
does not cycle the default visual attributes of multiple plots. For example, if you
overlay three series plots, then each series line has the same default visual
properties.
TRUE
attempts to use the GraphData1–GraphDataN style elements to assign different
visual properties to applicable plots (scatter plots and series plots and others).
Some plots in the layout do not participate in the cycling (for example, reference
lines and drop lines).
Default FALSE
See “Rotating Visual Attributes for Each Plot in an Overlay” on page 183
“boolean ” on page 1339 for other Boolean values that you can use.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
ROTATE=number
specifies the angle of rotation. Rotation is measured in a clockwise direction about a
virtual axis parallel to the Z axis (vertical) and passing through the center of the
bounding cube. A counterclockwise rotation can be specified with a negative value.
Default 54
TILT=number
specifies the angle of tilt in degrees. Tilt is measured in a clockwise direction about a
virtual axis parallel to the X axis (vertical) and passing through the center of the
bounding cube. A counterclockwise rotation can be specified with a negative value.
Default 20
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
LAYOUT OVERLAY3D Statement 157
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style- attribute named COLOR or CONTRASTCOLOR is used.
Default STANDARD
Tips Use the WALLCOLOR= option to control the fill color of the wall.
The appearance attributes of the wall outline are set by the GraphAxisLine
style element.
XAXISOPTS=(axis-options)
specifies one or more X axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
See “Axis Options for LAYOUT OVERLAY3D” on page 945 for a list
of axis options.
YAXISOPTS=(axis-options)
specifies one or more Y axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
158 Chapter 4 • Layout Statements
See “Axis Options for LAYOUT OVERLAY3D” on page 945 for a list
of axis options.
ZAXISOPTS=(axis-options)
specifies one or more Z axis options.
Each option must be specified as a name = value pair, and each pair
must be separated by a space.
See “Axis Options for LAYOUT OVERLAY3D” on page 945 for a list
of axis options..
ZOOM=positive-number
specifies a zoom factor. Factors greater than 1 move closer to the bounding cube, less
than 1 move farther away
Default 1
Details
The LAYOUT OVERLAY3D statement builds a 3-D composite using one or more GTL-
statements. You can specify one or more 3-D plots within the layout, provided all plots
can share the same type of axes. You can also specify “annotations” (for example, with
one or more ENTRY statements or LAYOUT GRIDDED statements). However,
annotations in the OVERLAY3D layout are more likely to collide with other graphics
features than are annotations in other overlay-type layouts.
As an overlay-type layout, OVERLAY3D has the same behavioral characteristics as an
OVERLAY layout. It uses the same general logic for rendering the composite (see
“LAYOUT OVERLAY Statement” on page 136 for details), and its default axis
characteristics are generally determined by the first specified plot, unless you use
PRIMARY=TRUE on another plot statement (see “When Plots Share Data and a
Common Axis” on page 880).
Within an OVERLAY3D layout, a graph’s bounding cube can be tilted, rotated, and
zoomed to provide a different viewpoint. By default, the outline of the bounding cube is
displayed and the viewing rotation angle is 57 degrees, the tilt angle is 20 degrees, and
the zoom factor is 1. See the CUBE= , ROTATE= , TILT= , and ZOOM= options for
information about how to change the viewpoint.
The following graph was generated by the “Example Program” on page 159:
LAYOUT PROTOTYPE Statement 159
Example Program
proc template;
define statgraph layoutoverlay3d;
begingraph;
entrytitle "Density Plot of Height and Weight";
layout overlay3d / tilt=10 rotate=54
walldisplay=none cube=false;
surfaceplotparm x=height y=weight z=density /
surfacecolorgradient=density;
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.gridded template=layoutoverlay3d;
run;
Syntax
LAYOUT PROTOTYPE </option(s)>;
plot-statements;
<INNERMARGIN </options(s)>;
block-plot-statement(s); | axis-table statement(s);
ENDINNERMARGIN;>
<… more-innermargin-blocks …> >
ENDLAYOUT;
Optional Arguments
ASPECTRATIO=AUTO | positive-number
specifies the aspect ratio of the prototype cell. The ratio is expressed as a positive
decimal fraction representing wall-height divided by wall-width. For example, 0.75
is a 3/4 aspect ratio and 1.0 is a square aspect ratio.
Default AUTO. The prototype cell is sized to the maximum area that can fill the
available space inside the layout cell.
Note If AUTO is not used for the aspect ratio, then the entire DATALATTICE or
DATAPANEL grid is affected and changes shape.
CYCLEATTRS=TRUE | FALSE
specifies whether the default visual attributes of markers, lines, and fills in nested
plot statements automatically change from plot to plot.
FALSE
does not cycle the default visual attributes of multiple plots. For example, if you
overlay three series plots, then each series line has the same default visual
properties.
LAYOUT PROTOTYPE Statement 161
TRUE
attempts to use the GraphData1–GraphDataN style elements to assign different
visual properties to applicable plots (scatter plots and series plots and others).
Some plots in the layout do not participate in the cycling (for example, reference
lines and drop lines).
Default FALSE
See “Rotating Visual Attributes for Each Plot in an Overlay” on page 183
“boolean ” on page 1339 for other Boolean values that you can use.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style- attribute named COLOR or CONTRASTCOLOR is used.
Default STANDARD
Tips Use the WALLCOLOR= option to control the fill color of the wall.
The appearance attributes of the wall outline are set by the GraphAxisLine
style element.
When the wall outline is suppressed, adjacent lines such as axis lines and
cell-header borders are still displayed. To suppress the axis lines, use the
appropriate display option for the axes. The cell-header borders cannot be
suppressed.
162 Chapter 4 • Layout Statements
Details
The LAYOUT PROTOTYPE statement defines a plot prototype or “rubber stamp” that
repeats automatically. It assembles the results of nested GTL statements into a single
axis area. The plots are drawn in the order in which they are specified. The results of the
last statement are placed on top.
The plot-statements determine the graphical content of the cells in the parent layout,
based on the subsetting of the specified classification variables. For an example, see
“LAYOUT DATALATTICE Statement” on page 45 or “LAYOUT DATAPANEL
Statement” on page 70.
A PROTOTYPE layout is essentially a restricted OVERLAY layout with the same
general rules for overlaying plots. The main difference is that there are no axis options
available on the LAYOUT PROTOTYPE statement. Axis properties are set with the
ROWAXISOPTS= and COLUMNAXISOPTS= options of the parent DATAPANEL or
DATALATTICE statement.
In SAS 9.4 and later releases, a PROTOTYPE layout can also contain an inner margin,
which is a nested region at the top or bottom of the PROTOTYPE container. One or
more inner margin plots can be specified, and each is specified within an
INNERMARGIN block. Within the INNERMARGIN block, only one-dimensional plot
statements such as BLOCKPLOT and AXISTABLE can be specified. See
“INNERMARGIN Statement” on page 166.
Syntax
LAYOUT REGION </option(s)>;
GTL-statements;
ENDLAYOUT;
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the layout background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is drawn around the layout.
LAYOUT REGION Statement 163
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
OPAQUE=TRUE | FALSE
specifies whether the layout background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
164 Chapter 4 • Layout Statements
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the layout border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 0
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0
Note Sides that are not assigned padding are padded with the default amount.
Details
The REGION layout provides a container for plots that do not use axes. Within the
LAYOUT REGION block, you can specify a single plot statement of a type that never
uses axes, such as a PIECHART or MOSAICPLOTPARM. If multiple plot statements
are specified, then only the first one is honored. You can also specify one or more insets,
such as nested layout statements (for example, LAYOUT GRIDDED), ENTRY
statements, and legend statements (CONTINUOUSLEGEND or DISCRETELEGEND).
For example, you could specify a PIECHART statement with a DISCRETELEGEND
statement and an ENTRY statement. You can also nest one or more layout blocks within
the REGION layout. For example, you could nest a LAYOUT GRIDDED statement that
creates a small table of text.
Example: LAYOUT REGION Statement 165
When nested within another layout type, such as a GRIDDED or LATTICE layout, the
REGION layout defines the graphical display for one cell of the parent layout. A
separate REGION layout is specified for each cell.
The following graph was generated by the “Example Program” on page 165:
Example Program
proc template;
define statgraph layoutregion;
begingraph;
entrytitle "Average Weight by Age";
layout region;
piechart category=age response=weight /
stat=mean name="p"
datalabelcontent=(response) datalabellocation=outside;
discretelegend "p" / title="Age" across=2
border=true halign=right valign=top;
endlayout;
endgraph;
end;
INNERMARGIN Statement
Provides a nested region in a LAYOUT OVERLAY or LAYOUT PROTOTYPE container in which a block
plot or axis table can be placed.
Restriction: This statement is valid in LAYOUT OVERLAY and LAYOUT PROTOTYPE blocks
only.
Notes: Two or more INNERMARGIN blocks that have the same alignment are stacked.
Multiple statements within an INNERMARGIN block are stacked.
For an X axis, the offsets on each end of the Y axis are increased to make room for
the inner margin plots. For a Y axis, the offsets on each end of the X axis are
increased to make room for the inner margin plots.
Syntax
INNERMARGIN < /option(s)>;
block-plot-statement(s); | axis-table statement(s);
ENDINNERMARGIN;
Optional Arguments
ALIGN=TOP | BOTTOM | LEFT | RIGHT
specifies the alignment of the inner margin.
Default BOTTOM
Restrictions For a block plot, only TOP and BOTTOM are valid. LEFT and
RIGHT are ignored.
For an axis table, LEFT and RIGHT can be used for a Y or Y2 axis.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the inner margin background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the style
attributes named COLOR or CONTRASTCOLOR are used.
color
specifies a color.
Interaction For this option to have any effect, the OPAQUE= option must be set to
TRUE.
Note The inner margin background is set to the wall color even when
WALLDISPLAY= NONE.
GUTTER=dimension
specifies the gap between stacked items in the inner margin.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default 0
Requirement The inner margin must contain two or more stacked items for this
option to have any effect.
OPAQUE=TRUE | FALSE
specifies whether the inner margin's background is opaque.
Default FALSE
Tip To prevent axis color bars and grid lines from passing through the axis
table, set OPAQUE=TRUE.
See “boolean ” on page 1339 for other Boolean values that you can use.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the inner-margin border.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
168 Chapter 4 • Layout Statements
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 0
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 0
TOP=dimension
specifies the amount of extra space added to the top.
Default 5 px for the first inner margin adjacent to the bottom of the plot
area. Otherwise, 0.
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 5 px for the first inner margin adjacent to the top of the plot area.
Otherwise, 0.
Note Sides that are not assigned padding are padded with the default amount.
SEPARATOR=TRUE | FALSE
specifies whether a separating line is drawn between the inner margin and the rest of
the layout content.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
Default FALSE
“boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Details
An inner margin is a nested region in an OVERLAY container. You can specify one or
more inner margin plots. Specify each plot within an INNERMARGIN block. Within an
INNERMARGIN block, you can specify only the BLOCKPLOT and AXISTABLE
statements. See “Example: Overlay with an Inner Margin Plot” on page 169.
Example Overview
This example shows how to place a plot in an inner margin of an OVERLAY layout. It
creates a graph that shows monthly total sales for a specific year. A LINECHART
statement is used to draw the plot. The months are shown along the category axis, and
the total sales values are shown along the response axis. The Sashelp.Prdsale data set is
used as the data source. The tick marks on the category axis are positioned between the
midpoints to align with the beginning of each month.
A BLOCKPLOT statement in an INNERMARGIN block is used to display the quarters
above the category axis. The INNERMARGIN statement uses the default alignment, so
the inner margin is positioned at the bottom of the layout container, beneath the line
chart. Alternate shading is used in the block plot to show the block boundaries. Because
the tick marks are positioned between the midpoints, they align with the block
boundaries. The SEPARATOR= and SEPARATORATTRS= options are used in the
INNERMARGIN statement to specify a dark-red, two-pixel-wide separator line between
the inner margin and the rest of the graph.
Note: The INNERMARGIN statement SEPARATOR= and SEPARATORATTRS=
options are valid in the first maintenance release of SAS 9.4 and later releases.
170 Chapter 4 • Layout Statements
Example Output
Here is the output for this example.
Example Program
Here is the SAS code.
/* Create a format for the quarters */
proc format;
value quartername 1="Quarter 1" 2="Quarter 2"
3="Quarter 3" 4="Quarter 4";
run;
where year=1994;
dynamic year=1994;
run;
172 Chapter 4 • Layout Statements
173
Part 4
Plot Statements
Chapter 5
Key Concepts for Using Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Chapter 6
Plot Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
174
175
Chapter 5
Key Concepts for Using Plots
• The WIDTH= option sets the image width to 320 pixels. Because no HEIGHT=
option is used, SAS uses the design aspect ratio of the graph to compute the
appropriate height. (The width of 320px is half the default width, so SAS sets the
height to 240px, which is half the default height.)
• The IMAGENAME= option sets the name of the output image file to modelfit. The
RESET option ensures that each time the graph is produced, the previous version of
the image file is replaced. Otherwise, image names are incremented (modelfit1,
modelfit2, and so on) every time the graph is produced.
In general, it is good practice to specify only one sizing option without the other—just
the WIDTH= option or just the HEIGHT= option. That way SAS can maintain the
design aspect ratio of the graph, which might be important for many graphs. For
Display Attributes 177
example, a graph that has multiple columns or a statistics table on the side needs a wide
aspect ratio. Specifying both width and height in such cases might produce unpredictable
results.
Note: Size settings in the ODS GRAPHICS statement affect all of the graphs that are
rendered in the SAS session, unless they are changed by another ODS GRAPHICS
statement. The size for a graph produced by an individual template can be set with
the DESIGNWIDTH= and DESIGNHEIGHT= options in the BEGINGRAPH
statement. Size settings in the ODS GRAPHICS statement override size settings in
the BEGINGRAPH statement and remain in effect unless they are changed in
another ODS GRAPHICS statement or ODS GRAPHICS are turned off.
For more information about using the ODS GRAPHICS statement in GTL, see SAS
Graph Template Language: User's Guide. For a more complete discussion of the ODS
GRAPHICS statement, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Display Attributes
Overview
The display attributes for the lines, colors, marker symbols, and text used in a graph are
derived from the ODS style that is in effect when the graph is produced. These display
attributes might also be influenced by grouped data. To override default display
attributes, all GTL plot statements provide options that manage the graph’s visual
appearance. For example, a BOXPLOT statement provides an OUTLIERATTRS=
option that manages the visual appearance of outliers.
Two ways are generally available for modifying a graph’s display attributes:
• Change the ODS style that is in effect for the graph. “ODS Styles” on page 16
provides an overview of the use of styles in a graph. SAS Graph Template Language:
User's Guide discusses the use of styles in more detail.
• Override default style settings using GTL statement options. Some examples are
given in the sections that follow.
• the left column shows the names for the line patterns
• the center column illustrates the type of line the name requests
• the right column shows the SAS line-style numbers for the line patterns
“Available Line Patterns” on page 1352 provides the complete list of line patterns that
can be used with the GTL.
In the following template definition, the LINEPARM statement’s LINEATTRS= option
overrides the default line pattern by specifying PATTERN=DASH:
proc template;
define statgraph patternchange;
begingraph;
layout overlay;
scatterplot y=height x=weight;
lineparm yintercept=intercept slope=slope /
lineattrs=(pattern=dash);
endlayout;
endgraph;
end;
Other display options can be managed the same way. For example, the SCATTERPLOT
statement provides a MARKERATTRS= option that specifies the color, size, symbol,
and weight of the plot data markers. For non-grouped data, if you do not set a marker
symbol in your template, then the default marker symbol is obtained from the
GraphDataDefault:MarkerSymbol style reference.
To change the default marker symbol, a SYMBOL= suboption on MARKERATTRS= is
available. Figure 5.2 on page 179 shows the marker symbols available for the
SYMBOL= suboption.
Display Attributes 179
You can use attribute options on the plot statement to change the default display
attributes used for group data. For example, in the following template definition, the
LINEPARM statement’s LINEATTRS= option specifies PATTERN=DASH. This
explicit setting overrides the default line pattern for the plot lines and uses dashed lines
for all of the plots, leaving color to distinguish among group values.
proc template;
define statgraph dashedline;
begingraph;
layout overlay;
scatterplot y=height x=weight / group=gender;
lineparm yintercept=intercept slope=slope / group=gender
lineattrs=(pattern=dash);
endlayout;
endgraph;
end;
Rather than setting the same line pattern on all group values, you can change the default
sequence of line patterns that is used for grouped values. To do so, set the LineStyle
attribute in some of the style elements GraphData1–GraphDataN.
In the following example, a style is defined to change the line pattern for GraphData1
and GraphData2. In this example, the style is derived from the DEFAULT style. Values
are set for the LineStyle attributes in the GraphData1 and GraphData2 style elements.
The first default line in the sequence has long dashes (style value 6) and the second line
has short dashes (style value 4). The LineStyle settings for the remaining GraphData
elements are not set, so are derived from the parent style (DEFAULT). This new line
sequence is used as the default line sequence for any plot that uses the MyDefault style.
To apply the style to a graph, the STYLE= option is used in the ODS HTML statement
to specify the style name.
Here is the code for this example.
/* Specify a path for the ODS output */
filename odsout "output-path";
data class;
merge class stats(keep=intercept slope sex);
run;
proc template;
/* Create custom style MYDEFAULT from the STYLES.DEFAULT style. */
define style MyDefault;
parent=Styles.Default;
Display Attributes 181
Similarly, for grouped data, you can set the MarkerSymbol attribute in each of the style
elements GraphData1–GraphDataN. In the following example, a style is defined to
change the MarkerSymbol attribute for GraphData1–GraphData3. This new sequence is
used as the default marker symbol sequence for any grouped plot that uses the
MyDefault style.
Here is the code for this example.
182 Chapter 5 • Key Concepts for Using Plots
Note: The data that was generated in the previous example is used again in this
example.
/* Specify a path for the ODS output */
filename odsout "output-path";
proc template;
/* Create custom style MYDEFAULT from STYLES.DEFAULT. */
define style MyDefault;
parent=Styles.Default;
style GraphData1 from GraphData1 /
MarkerSymbol="DIAMOND";
style GraphData2 from GraphData2 /
MarkerSymbol="CROSS";
style GraphData3 from GraphData3 /
MarkerSymbol="CIRCLE";
end;
If one of the plots in this example uses grouped data, then the grouped plots also
participate in the default cycles. For example, if the second plot has three groups, then it
generates three plots, which are assigned line properties based on the GraphData2,
GraphData3, and GraphData4 style elements.
If the plot statement that uses grouped data also uses the INDEX= option to manage the
group values (see “Remapping Groups for Grouped Data” on page 183), then the
INDEX= option overrides the default behavior. In that case, the grouped plots do not
participate in the default cycling.
When one or more of the plots within the layout override the default cycling behavior,
the arrangement of the plots within the layout might affect the default mapping of the
GraphDataN elements to those statements that participate in the default cycling.
B in the second graph. Those that represent Drug B in the first graph represent Drug C in
the second group.
The GROUP= option mappings can be made consistent between the two graphs by
creating an index column for each study. For these example studies, the GROUP and
INDEX columns are the following:
Drug1 Index1
A 1
B 2
B 2
C 3
Drug2 Index2
B 2
C 3
C 3
If the graph for Study 1 specifies INDEX=INDEX1 and the graph for Study 2 specifies
INDEX=INDEX2, then the second combination of color and marker symbol is mapped
to Drug B in both graphs. The third combination of color and marker symbol is mapped
to Drug C in both graphs.
The documentation for each GTL statement identifies the option interactions that might
occur on that statement.
Overview
On plots that generate a curve line (a series plot or a density plot, for example), you can
specify a label for the curve line. You can also determine the label’s location in the
graph. For example, the SERIESPLOT statement provides the following options for
managing a curve label:
CURVELABEL
specifies a label for the curve line.
CURVELABELLOCATION
specifies the location of the curve line label relative to the plot area.
CURVELABELPOSITION
specifies the position of the label relative to the curve line.
Depending on the shape of the curve line, its distribution of values, and the other plot
elements that must be displayed within the plot area, GTL might have to add an offset
(see “Adjusting Axis Offsets” on page 886) to one of the plot’s axis lines to provide
enough room for the curve label. To prevent the offset of the axis line, you can move the
curve label outside of the plot area by specifying
CURVELABELLOCATION=OUTSIDE on the plot statement:
186 Chapter 5 • Key Concepts for Using Plots
Regardless of whether the curve label is displayed inside or outside of the plot area, you
can use the CURVELABELPOSITION= option to adjust the label’s position relative to
the curve line.
• The minimum or maximum axis tick marks can be adjusted (see “Adjusting Axis
Offsets” on page 886) so that the label can be placed inside the plot area. Increasing
label length decreases the area available for displaying plots.
• When CURVLABELLOCATION=OUTSIDE, you can set the
CURVELABELPOSITION to MIN or MAX, but the label might collide with the
axis ticks and tick values, unless you are aware of where the axes are positioned.
188 Chapter 5 • Key Concepts for Using Plots
189
Chapter 6
Plot Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
AXISTABLE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
BANDPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
BARCHART Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
BARCHARTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
BIHISTOGRAM3DPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
BLOCKPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
BOXPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
BOXPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
BUBBLEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
CONTOURPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
DENDROGRAM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
DENSITYPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
DROPLINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
ELLIPSE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
ELLIPSEPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
FRINGEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
HEATMAP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
HEATMAPPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
HIGHLOWPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
HISTOGRAM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
HISTOGRAMPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
LINECHART Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
LINEPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
LOESSPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
MODELBAND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
MOSAICPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
NEEDLEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
PBSPLINEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
PIECHART Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
POLYGONPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
REFERENCELINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
REGRESSIONPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
SCATTERPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
SCATTERPLOTMATRIX Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
SERIESPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
STEPPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
SURFACEPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803
TEXTPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
VECTORPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837
WATERFALLCHART Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854
190 Chapter 6 • Plot Statements
Dictionary
AXISTABLE Statement
Creates an event plot of input data along an axis of an X-Y plot.
Syntax
AXISTABLE X=column | expression VALUE=column </option(s)>;
AXISTABLE Y=column | expression VALUE=column </option(s)>;
Appearance options
CLASS=column | expression
creates a separate row or column for each unique class value.
CLASSORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the order in which the class values are displayed.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing
or bin width.
COLORGROUP=column | expression | discrete-attr-var
specifies a column that is used to discretely map the color of the value text.
DATATRANSPARENCY=number
specifies the degree of the transparency of the header, label, and values.
DISPLAY=STANDARD | ALL | (display-options)
specifies which features to display.
DROPONMISSING=TRUE | FALSE
specifies whether the entire axis table is dropped when all of the VALUE=
column values are missing.
GUTTER=dimension
specifies the gap between rows when a class variable is used.
INCLUDEMISSINGCLASS=TRUE | FALSE
specifies whether missing class values are represented in the table.
INDENT=dimension
specifies a value to be used with the INDENTWEIGHT= option to determine
the indention for each text value.
INDENTWEIGHT=numeric-column | expression
specifies the indention weight (multiplier) for each observation.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the table border.
POSITION=number
positions the plot along the axis orthogonal to the axis used for the values.
SHOWMISSING=TRUE | FALSE
specifies whether missing values are represented in the table.
AXISTABLE Statement 191
TEXTGROUP=discrete-attr-var
specifies the discrete attribute variable for a discrete attribute map that maps
text attributes to values for each observation.
VALUEATTRS=style-element | style-element(text-options) | (text-options)
specifies the color and font attributes of the text values.
VALUEFORMAT=format
specifies a SAS format or a user-defined format for the table values.
VALUEHALIGN=AUTO | LEFT | CENTER | RIGHT
in a Y-axis table, specifies the horizontal alignment of the column values
relative to the column width.
VALUEJUSTIFY=AUTO | LEFT | CENTER | RIGHT
specifies the justification of the values in the axis table.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Header options
HEADERLABEL="string"
specifies the text for the table header.
HEADERLABELATTRS=style-element | style-element(text-options) | (text-options)
specifies the color and font attributes of the table header.
TITLE="string"
specifies the text for the table title.
TITLEATTRS=style-element | style-element(text-options) | (text-options)
specifies the color and font attributes of the table title.
TITLEHALIGN=AUTO | CENTER | LEFT | RIGHT
specifies the horizontal alignment of the axis table header label relative to the
axis table width.
TITLEJUSTIFY=LEFT | CENTER | RIGHT
specifies the justification of the title string. The justification is relative to the
axis table width.
Label options
LABEL="string"
specifies the text for the table label.
LABELATTRS=style-element | style-element(text-options) | (text-options)
specifies the color and font attributes of the column label.
LABELHALIGN=AUTO | LEFT | CENTER | RIGHT
specifies the horizontal alignment of the column label when it is displayed.
LABELJUSTIFY=LEFT | CENTER | RIGHT
specifies the justification of the column label when it is displayed.
LABELPOSITION=MIN | MAX
specifies the end of the axis on which the label is displayed.
Midpoint options
CLASSDISPLAY=STACK | CLUSTER
192 Chapter 6 • Plot Statements
Statistics options
STAT=AUTO | SUM | MEAN
specifies the statistic that is to be computed for the VALUE= column when
the column is numeric.
Required Arguments
Either the X= or the Y= argument must be specified in the AXISTABLE statement.
Specifying X= places an axis table along the X axis of a plot. Specifying Y= places an
axis table along the Y axis of a plot.
X=column | expression
specifies the column for the X axis.
Y=column | expression
specifies the column for the Y axis.
VALUE=column
specifies the column that contains the axis table values.
Optional Arguments
CLASS=column | expression
creates a separate row or column for each unique class value. Each row or column is
labeled by the class value.
Interaction The DISPLAY= option that is in effect must include LABEL for any
labels to appear.
Tip Use the LABELATTRS= option to modify the label text attributes.
CLASSDISPLAY=STACK | CLUSTER
specifies how the class values are displayed.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
STACK
displays the class values vertically at each midpoint value on the X axis or
horizontally on the Y axis.
CLUSTER
displays the class values horizontally at each midpoint value on the X axis or
vertically on the Y axis.
Restriction CLUSTER applies only when the axis table is on a discrete axis.
Default STACK
Interaction The CLASS= option must be specified for this option to have any
effect.
ASCENDING | DESCENDING
displays the class values in ascending or descending order.
Default DATA
Interaction The CLASS= option must be specified for this option to have any
effect.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing or bin
width.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Requirement For this option to take effect, the CLASS= option must also be
specified, and the CLASSDISPLAY= option must be set to
CLUSTER.
Each unique value of this column is mapped to the COLOR attribute of the
GraphData1–GraphDataN style elements that are in effect. If a discrete attribute
variable is specified, the color mapping from its associated DISCRETEATTRMAP
statement is used.
DATATRANSPARENCY=number
specifies the degree of the transparency of the header, label, and values.
Default 0
Default STANDARD
DROPONMISSING=TRUE | FALSE
specifies whether the entire axis table is dropped when all of the VALUE= column
values are missing.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default FALSE
Tip The SHOWMISSING= option controls whether missing values are shown
in the table.
“boolean ” on page 1339 for other Boolean values that you can use.
GUTTER=dimension
specifies the gap between rows when a class variable is used.
AXISTABLE Statement 195
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
X-axis table: 0 px
Interaction The CLASS= option must be specified for this option to have any
effect.
HEADERLABEL="string"
specifies the text for the table header.
Note: Starting with the second maintenance release of SAS 9.4, the
HEADERLABEL= option is deprecated and is replaced with the TITLE= option.
The syntax and functionality are the same. The HEADERLABEL= option is still
honored, but the TITLE= option is preferred.
INCLUDEMISSINGCLASS=TRUE | FALSE
specifies whether missing class values are represented in the table.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Missing class values are included by default. When the data contains missing class
values, the label for those values is either blank for missing character values or a dot
for missing numeric values.
The following figure shows an X-axis axis table that displays values for classes Class 1,
Class 2, and any missing class values.
Notice that the label for the missing class values is blank. You can use the
INCLUDEMISSINGCLASS=FALSE option to exclude the missing class values. If
you want to keep the missing class values, then you can create a format that specifies
196 Chapter 6 • Plot Statements
a more meaningful label for the missing class. For example, here is a format that
specifies a label for missing character and numeric class values.
proc format;
value $missingClass " " = "(Missing)";
value missingClass . = "(Missing)";
run;
A single space enclosed in quotation marks specifies a missing character value and a
dot specifies a missing numeric value. Although it might seem appropriate to use
empty quotation marks ('' or "") to specify a missing character value, doing so
produces unexpected results. To specify a missing character value, enclose a single
space in quotation marks (' ' or " "). You can use this format for the class columns in
the PROC SGRENDER statement. In that case, if the class columns contain missing
values, then the labels specified in the format statement are used for the missing
classes.
The following figure shows the previous example when format $missingClass is
applied to the class variable.
Note: In the second maintenance release of SAS 9.4 and in earlier releases, ODS
Graphics does not support Unicode values in user-defined formats. Starting with
the third maintenance release of SAS 9.4, ODS Graphics supports Unicode
values in user-defined formats only if they are preceded by the (*ESC*) escape
sequence. Example: "(*ESC*){unicode beta}". ODS Graphics does not
support an escape character that is defined in an ODS ESCAPECHAR statement
in user-defined formats.
Default TRUE
Interaction The CLASS= option must be specified for this option to have any
effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDENT=dimension
specifies a value to be used with the INDENTWEIGHT= option to determine the
indention for each text value.
INDENTWEIGHT=numeric-column | expression
specifies the indention weight (multiplier) for each observation.
AXISTABLE Statement 197
Interaction For each observation, the INDENT= option value is multiplied by the
value of the column specified by this option to determine the indention
for that observation’s value.
LABEL="string"
specifies the text for the table label.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default The class values are used when the CLASS= option is set and
CLASSDISPLAY=STACK is in effect. Otherwise, the VALUE=
column label or name is used.
Note If the length of the label exceeds the available space, the label is split
on blank space as needed to make it fit.
For grouped data, the label color changes to match the group color
derived from the ContrastColor attribute of the GraphData1–
GraphDataN style elements.
Restriction Group behavior occurs only when the CLASS= and COLORGROUP=
option values are the same.
Interaction If one or more text options are specified and they do not include all the
font properties such as color, family, size, weight, and style, then the
properties that are not specified are derived from the GraphValueText
style element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default AUTO
198 Chapter 6 • Plot Statements
Interaction The DISPLAY= option must include LABEL for this option to have
any effect.
Default CENTER
Interaction The DISPLAY= option must include LABEL for this option to have
any effect.
LABELPOSITION=MIN | MAX
specifies the end of the axis on which the label is displayed. The label is aligned with
the tick values on the axis.
Default MIN
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
PAD=dimension | (pad-options)
specifies the amount of extra space that is added inside the table border.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the table border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options,
enclosed in parentheses:
LEFT=dimension
specifies the amount of extra space added to the left side.
Default 4 px
RIGHT=dimension
specifies the amount of extra space added to the right side.
Default 4 px
AXISTABLE Statement 199
TOP=dimension
specifies the amount of extra space added to the top.
Default 0 px
BOTTOM=dimension
specifies the amount of extra space added to the bottom.
Default 0 px
Note Sides that are not assigned padding are padded with the default amount of
space.
POSITION=number
positions the plot along the axis orthogonal to the axis used for the values. This
option enables you to position the plot when the AXISTABLE statement is not
placed in an INNERMARGIN block.
number
specifies the position on the orthogonal axis as a fraction of the axis range.
Tip To reserve space for the plot at either end of the orthogonal axis,
specify the OFFSETMIN= or OFFSETMAX= option for the orthogonal
axis.
SHOWMISSING=TRUE | FALSE
specifies whether missing values are represented in the table.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
The values are evaluated before the column format is applied. When this option is set
to FALSE, missing numeric and character values are hidden.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
200 Chapter 6 • Plot Statements
Default AUTO
Interaction When the VALUE= column is character, the STAT= option always uses
the first column value as the statistic value. In that case, SUM and
MEAN are ignored.
TEXTGROUP=discrete-attr-var
specifies the discrete attribute variable for a discrete attribute map that maps text
attributes to values for each observation. The discrete attribute variable is defined in
a DISCRETEATTRVAR statement.
TITLE="string"
specifies the text for the table title.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Tip Use the TITLEATTRS= option to control the appearance of the table title.
Interaction If one or more text options are specified and they do not include all the
font properties such as color, family, size, weight, and style, then the
properties that are not specified are derived from the GraphLabelText
style element.
AXISTABLE Statement 201
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
Default AUTO
Restriction In the second maintenance release of SAS 9.4, this option applies only
to Y-axis tables. Starting with the third maintenance release of SAS 9.4,
this option applies to Y-axis tables and to X-axis tables.
Interaction The TITLE= option must be specified for this option to have any effect.
Default LEFT
Interaction The TITLE= option must be specified for this option to have any effect.
Interaction If one or more text options are specified and they do not include all the
font properties such as color, family, size, weight, and style, then the
properties that are not specified are derived from the GraphLabelText
style element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
VALUEFORMAT=format
specifies a SAS format or a user-defined format for the table values.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default The format that is in effect for the column specified in the VALUE= option.
If no format is in effect, BEST6 is used for numeric columns.
Note Not all of the SAS formats are supported. See Appendix 4, “SAS Formats
Not Supported,” on page 1353.
Default AUTO
Default AUTO
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Example: AXISTABLE Statement 203
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
The AXISTABLE statement enables you to place text values along the X or Y axis at
specific values on the axis. It offers more flexibility than the BLOCKPLOT statement,
which is used to denote changes in block values along the axis. The X and Y data does
not need to be sorted.
This example shows how to add a table of average sales data by division below a bar
chart of total sales by product and country. Here is the output that is generated by this
example.
An inner margin is created at the bottom of the layout container to reserve space for the
table. An AXISTABLE statement is used in the INNERMARGIN block to show the
average sales by division for each product.
Here is the SAS code for this example.
proc template;
define statgraph axistable;
begingraph;
entrytitle "Average Product Sales By Division and Country";
layout overlay / cycleattrs=true
204 Chapter 6 • Plot Statements
See Also
“Creating an Axis-Aligned Inset with an Axis Table” in SAS Graph Template Language:
User's Guide
BANDPLOT Statement
Creates a band plot that typically shows confidence or prediction limits.
Requirements: You must specify either an X= argument or a Y= argument. You cannot specify both..
When you specify the X argument, you must also specify LIMITLOWER and
LIMITUPPER arguments for Y values.
When you specify the Y argument, you must also specify LIMITLOWER and
LIMITUPPER arguments for X values.
The plot data should be sorted by the X or Y variable that is used in the BANDPLOT
statement. Otherwise, specify CONNECTORDER= AXIS in the BANDPLOT
statement.
Syntax
BANDPLOT X=column | expression
LIMITLOWER=number | numeric-column | expression
LIMITUPPER=number | numeric-column | expression </option(s)>;
BANDPLOT Y=numeric-column | expression
LIMITLOWER=number | numeric-column | expression
LIMITUPPER=number | numeric-column | expression </option(s)>;
Appearance options
BANDPLOT Statement 205
ANTIALIAS=AUTO | OFF
specifies whether anti-aliasing is turned off for this plot.
CONNECTORDER=VALUES | AXIS
specifies how to connect the data points to form the band lines.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the band labels.
DATATRANSPARENCY=number
specifies the degree of the transparency of the band fill and band outline.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display an outlined band area, a filled band area, or an
outlined and filled band area.
EXTEND=TRUE | FALSE
specifies whether the constant or "step" band is to be drawn to the area
bounded by the axes.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled band area.
INDEX=positive-integer-column | expression
specifies indices for mapping band attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
JUSTIFY=LEFT | CENTER | RIGHT
specifies the location of the data point relative to the step when TYPE=STEP.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the band outlines.
TYPE=SERIES | STEP
specifies how the data points for lower and upper band boundaries are
interpolated.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the band labels relative to the plot area.
CURVELABELLOWER="string" | column
206 Chapter 6 • Plot Statements
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate band plot for each unique group value of the specified
column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
You must specify either an X= or Y= argument. You cannot specify both. In addition, the
LIMITLOWER= and LIMITUPPER= arguments must be used to specify the lower and
upper lines for the band.
X=column | expression
specifies X values. Numeric or character values can be used.
Requirement You must also specify the LIMITLOWER= and the LIMITUPPER=
arguments for the Y values.
Y=column | expression
specifies Y values. Numeric or character values can be used.
Requirement You must also specify the LIMITLOWER= and the LIMITUPPER=
arguments for the X values.
Interactions When this option is used with the X= option, it specifies the Y value
or values.
When this option is used with the Y= option, it represents the X value
or values.
Interactions When this option is used with the X= option, it specifies the Y value
or values.
When this option is used with the Y= option, it represents the X value
or values.
Optional Arguments
ANTIALIAS=AUTO | OFF
specifies whether anti-aliasing is turned off for this plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
AUTO
specifies that anti-aliasing is controlled by the ANTIALIAS= option in the ODS
GRAPHICS statement.
OFF
specifies that anti-aliasing is always disabled for this plot.
Default AUTO
CONNECTORDER=VALUES | AXIS
specifies how to connect the data points to form the band lines.
VALUES
connects data points in the order read from the X column (or Y column).
AXIS
connects data points as they occur left-to-right along the X axis (or bottom-to-top
along the Y axis).
Tip You can use this value to ensure the expected connect order for certain
types of series lines (for example, time series) when the input data might
not be sorted by the X column (or Y column).
Default VALUES
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
208 Chapter 6 • Plot Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
CURVELABELLOWER="string" | column
specifies a label for the lower band limit.
For grouped data, use a column to define the lower band labels for
each group value. All of the labels for a specific group value must
be the same. Otherwise, the results are unpredictable.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
CURVELABELUPPER="string" | column
specifies a label for the upper band limit.
For grouped data, use a column to define the upper band labels for
each group value. All of the labels for a specific group value must
be the same. Otherwise, the results are unpredictable.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the band labels relative to the plot area.
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
MAX
forces the band labels to appear near maximum band values (maximum X-values
for horizontal curves, and maximum Y-values for vertical curves).
MIN
forces the band label to appear near minimum band values (minimum X-values
for horizontal curves, and minimum Y-values for vertical curves)
START
forces band labels to appear near the beginning of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
END
forces band labels to appear near the end of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
DATATRANSPARENCY=number
specifies the degree of the transparency of the band fill and band outline.
Default 0
Note This option does not affect the band curve labels.
Tip The FILLATTRS= option can be used to set transparency for just the band
area. You can combine this option with FILLATTRS= to set one
210 Chapter 6 • Plot Statements
transparency for the band outline but a different transparency for the band
fill. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
Default The value of the DisplayOpts attribute of the GraphBand style element,
which is DisplayOpts="FILL" by default.
EXTEND=TRUE | FALSE
specifies whether the constant or "step" band is to be drawn to the area bounded by
the axes.
Default FALSE
Requirement When this option is used for a constant band, constants must be
specified for the upper and lower band limits. This requirement does
not apply to "step" bands.
Interactions This option is ignored when band labels are placed inside the plot
area (CURVELABELLOCATION=INSIDE). To extend the bands in
that case, use the CURVELABELLOCATION=OUTSIDE option.
Tip If this option is not specified, then there can be a small gap between
the line and the axis. The gap is controlled by the axis offset. If the
axis offset is set to 0, then there is no gap.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or by the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
Defaults If the band outline is enabled by the ODS style or the DISPLAY=
option, then each distinct group value is represented in the plot by a
different combination of outline color (defined by the ContrastColor
attribute of the GraphData1–GraphDataN and GraphMissing style
elements) and outline pattern (defined by the LineStyle attribute of the
GraphData1–GraphDataN and GraphMissing style elements).
If the band fill is enabled by the ODS style or the DISPLAY= option,
then each distinct group value is represented in the plot by a different
fill color (defined by the Color attribute of the GraphData1–
GraphDataN and GraphMissing style elements).
Restriction This option can be used only when a numeric column is specified for
the upper limit or the lower limit of the band plot. The other limit
could be a constant, if desired.
The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of colors and line
patterns.
Tip The representations that are used to identify the groups can be
overridden individually. For example, each distinct group value is
represented by a different line pattern for the band lines, but the
212 Chapter 6 • Plot Statements
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping band attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
Default LEFT
Requirement TYPE= STEP must also be specified for this option to have any
effect.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
MODELNAME="plot-name"
specifies the name of the plot from which to derive the interpolation for the band.
When this option is used, the band plot forms prediction or confidence limits for the
plot that supplies the fitted model.
Requirement plot-name must be the name that has been assigned on the associated
plot’s NAME= option.
Tip If this option is not specified, then the interpolation is set by the
TYPE= option.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
Interaction For this option to have any effect, the outline must be enabled by the
ODS style or by the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, LIMITUPPER, LIMITLOWER, GROUP,
CURVELABELUPPER, and CURVELABELLOWER.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the band plot.
If this option is used, then it replaces all of the information that is displayed by
default. Roles for columns that do not contribute to the band plot can be specified
along with roles that do.
(role-list)
an ordered, space-separated list of unique BANDPLOT and user-defined roles.
BANDPLOT roles include X , Y , LIMITUPPER , LIMITLOWER , GROUP ,
INDEX , CURVELABELUPPER , and CURVELABELLOWER .
User-defined roles are defined with the ROLENAME= option.
Example This example displays data tips for the columns assigned to the roles
X, LIMITUPPER, and LIMITLOWER as well as the column Obs,
which is not assigned to any pre-defined BANDPLOT role. The Obs
column must first be assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X LIMITUPPER LIMITLOWER)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X , Y , LIMITUPPER , LIMITLOWER , and
GROUP .
BANDPLOT Statement 215
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TYPE=SERIES | STEP
specifies how the data points for lower and upper band boundaries are interpolated.
SERIES
connects the data points using line segments (as in a SeriesPlot).
STEP
connects the data points (as in a StepPlot).
216 Chapter 6 • Plot Statements
Default SERIES
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
A band plot can specify an X column with Y upper and lower limits, or a Y column with
X upper and lower limits. If you specify the X argument, then you must specify
LIMITLOWER and LIMITUPPER arguments for the Y values to apply the limits to the
Y axis. If you specify the Y argument, then you must specify LIMITLOWER and
LIMITUPPER arguments for the X values to apply the limits to the X axis.
When you use a BANDPLOT statement to display prediction or confidence limits, the
band plot can be used with another plot that specifies a fitted model. For example, it can
be used with a series or step plot. In these cases, use the BANDPLOT option
MODELNAME= or TYPE= to identify the interpolation for the band.
You can use the BANDPLOT statement in displays that are independent of other plots.
For example, a band plot can be used to define yellow and green areas in an OVERLAY
LAYOUT statement that also contains a scatter plot. This use implies concern for any of
the scatter plot values that fall in the yellow area and comfort for any values that fall in
the green area. For this use, the upper and lower limits would be specified by a constant.
Note: The BANDPLOT statement is optimized to work as a Confidence or Prediction
band. If the band is self intersecting (not sorted for X or for Y), then the resulting
band is unpredictable. With unsorted data, the band that is generated for an output
Raster Image might not match the band that is generated for an output Vector
Graphic.
Example: BANDPLOT Statement 217
The following graph was generated by the “Example Program” on page 217:
Example Program
Here is the code for this example.
proc template;
define statgraph bandplot;
begingraph;
entrytitle "Fit Plot for Weight";
layout overlay;
bandplot x=height limitupper=uppermean
limitlower=lowermean /
name="band" modelname="fit"
legendlabel="95% Confidence Limits";
scatterplot x=height y=weight / primary=true;
seriesplot x=height y=predict / name="fit"
legendlabel="Fit Line";
discretelegend "fit" "band";
endlayout;
endgraph;
end;
run;
BARCHART Statement
Creates a bar chart computed from input data.
Tips: For charts that have a large number of bars that are very close together, slight
variations in spacing that normally occur due to integer rounding can become more
obvious. Subpixel rendering provides more precise bar spacing in that case. In the
second maintenance release of SAS 9.4 and in earlier releases, specify
SUBPIXEL=ON in the BEGINGRAPH statement to enable subpixel rendering. See
SUBPIXEL= on page 33. Starting with the third maintenance release of SAS 9.4,
subpixel rendering is enabled by default.
To disable subpixel rendering in the third maintenance release of SAS 9.4 and in
later releases, specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an
ODS GRAPHICS statement. For information about the BEGINGRAPH statement
SUBPIXEL= option, see SUBPIXEL= on page 33. For information about the ODS
GRAPHICS statement SUBPIXEL= option, see “ODS GRAPHICS Statement” in
SAS ODS Graphics: Procedures Guide.
Syntax
BARCHART CATEGORY=column | expression </option(s)>;
BARCHART CATEGORY=column | expression
RESPONSE=numeric-column | expression </option(s)>;
Appearance options
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
COLORBYFREQ=TRUE | FALSE
specifies whether the bar colors are based on statistical values when the
COLORRESPONSE= option is not specified.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option or the
COLORBYFREQ= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute variable to use to map the bar colors to
a continuous color gradient.
CONNECTATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the bar connect lines.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bars.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fill, bar outline, connect
line, and bar labels, if displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies which bar features to display.
BARCHART Statement 219
DISPLAYZEROLENGTHBAR=TRUE | FALSE
specifies whether zero-length bars are drawn.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled bar area.
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
INDEX=positive-integer-column | expression
specifies indices for mapping bar attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
INTERVALBARWIDTH=dimension
specifies the width of the bars in an interval bar chart as a ratio of the interval
width.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the bar outlines.
TARGET=numeric-column | expression
specifies the target value for each bar.
Axes options
BASELINEINTERCEPT=number
specifies the response axis intercept for the baseline.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
BARLABEL=TRUE | FALSE
specifies whether the bar statistic value is displayed at the end of the bar.
BARLABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the text properties of the bar label text.
BARLABELFITPOLICY=AUTO | NONE
specifies a policy for avoiding collisions among the bar labels when labels
are displayed.
BARLABELFORMAT=format
220 Chapter 6 • Plot Statements
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all bars from the category midpoints.
GROUP=column | discrete-attr-var | expression
creates a separate bar segment or bar for each unique group value in the
specified column.
GROUP100=NONE | MAGNITUDE | POSITIVE
displays the computed response values (FREQ, SUM, or MEAN), normalized
to 100%.
GROUPDISPLAY=STACK | CLUSTER
specifies how to display grouped bars.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page to display when the bar is selected.
Statistics options
COLORSTAT=FREQ | PCT | SUM | MEAN | PROPORTION
specifies the statistic to be calculated for the data range of the bar-color
gradient.
STAT=FREQ | PCT | SUM | MEAN | PROPORTION
specifies the statistic to be computed for the Y-axis.
Required Arguments
Specifying only CATEGORY= creates a bar chart with bars that, by default, represent
frequency counts or percents of CATEGORY. Specifying both CATEGORY= and
BARCHART Statement 221
Notes You can use X= as an alternative to CATEGORY=. If you use X=, then be
aware that the TIP=, TIPFORMAT=, and TIPLABEL= options recognize X
as the category role and not as CATEGORY.
RESPONSE=numeric-column | expression
specifies the numeric column or expression for the response values.
Notes You can use Y= as an alternative to RESPONSE=. If you use Y=, then be
aware that the TIP=, TIPFORMAT=, and TIPLABEL= options will
recognize Y as the response role and not RESPONSE in that case.
Optional Arguments
BARLABEL=TRUE | FALSE
specifies whether the bar statistic value is displayed at the end of the bar. For
grouped clustered bars, each bar is labeled with the summarized value of the bar. For
grouped stacked bars, the segmented bar is labeled with the accumulated,
summarized value of all the bar segments.
Default FALSE
Tip The font and color attributes for the label are specified by the
BARLABELATTRS= option. The text format is specified by the
BARLABELFORMAT= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
BARLABELFITPOLICY=AUTO | NONE
specifies a policy for avoiding collisions among the bar labels when labels are
displayed.
222 Chapter 6 • Plot Statements
AUTO
for a vertical bar chart, rotates the bar labels if the labels exceed the midpoint
spacing. For a horizontal bar chart, always draws the labels horizontally. The
following figure shows an example.
See the BARWIDTH= option for more information about the bar spacing.
NONE
does not rotate the bar labels. Labels that are too long overlap.
Labels can collide along their length and along their height. In some cases, if one or
more labels collide when the specified fit policy is used, then all of the labels are
dropped from the display. When that occurs, the following warning message is
written to the SAS log:
WARNING: The bar labels are suppressed. Use BARLABELFITPOLICY=NONE to
force the labels to be displayed.
TIP If the labels collide along their height, then using the BARLABELATTRS=
option to reduce the label font size might eliminate the collision.
Default AUTO
BARLABELFORMAT=format
specifies the text format used to display the bar label.
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
Default 0.85
Interaction Starting with the third maintenance release of SAS 9.4, the
INTERVALBARWIDTH= option overrides this option for an interval
bar chart.
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
BASELINEINTERCEPT=number
specifies the response axis intercept for the baseline. The baseline is always
displayed in the chart, whether for a specified value or for the default value. When
this option is used, the axis range is adjusted to include the baseline, and the baseline
is placed at the specified value on the response axis.
Default 0
response axis reverts to a linear axis. To restore the log axis in that
case, set BASELINEINTERCEPT= to a positive value.
Note Label positions are automatically adjusted to prevent the labels from
overlapping.
The baseline does not add a tick or a tick value to the axis. To label the
baseline, use a REFERENCELINE statement to overlay a line with the
same X or Y value and include the CURVELABEL= option to specify
the label text.
COLORBYFREQ=TRUE | FALSE
specifies whether the bar colors are based on statistical values when the
COLORRESPONSE= option is not specified. Setting this option to TRUE enables
you to color the bars based on frequency counts, percentages, or proportions.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default FALSE
Use the FILLTYPE= option to specify whether each bar is filled with
a solid color or with a gradient color.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option or the
COLORBYFREQ= option.
BARCHART Statement 225
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option or the
COLORBYFREQ=TRUE option must also be specified.
Tip Use the DISPLAY= option to specify whether outlines and fills are
displayed.
When fill, fill pattern, or both are displayed, this option overrides
suboption COLOR= in the FILLATTRS= option and in the
FILLPATTERNATTRS= option and varies the color according to the
color gradient or the attribute map.
When only the outlines are displayed, this option overrides suboption
COLOR= in the OUTLINEATTRS= option and varies the outline
color according to the color gradient or the attribute map.
Use the FILLTYPE= option to specify whether each bar is filled with
a solid color or with a gradient color.
SUM
MEAN
When the COLORRESPONSE= option is not specified and
COLORBYFREQ=TRUE is in effect, the following values are valid:
This option might affect existing SAS programs. For programs written
before the third maintenance release of SAS 9.4, if STAT= and
COLORRESPONSE= are specified in a BARCHART statement, then
the bar-chart colors and color statistic might change from those of the
previous SAS releases. To restore the original colors and color statistic
in that case, set COLORSTAT= in the BARCHART statement to the
same statistic that is specified in STAT=.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
228 Chapter 6 • Plot Statements
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fill, bar outline, connect line, and
bar labels, if displayed.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the filled
bar area. You can combine this option with FILLATTRS= to set one
transparency for the bar outlines and connect lines but a different
transparency for the bar fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
DISCRETEOFFSET=number
specifies an amount to offset all bars from the category midpoints.
Default 0 (no offset, all bars are centered on the category midpoints)
Range -0.5 to +0.5, where 0.5 represents half the distance between category ticks.
Normally, a positive offset is to the right when ORIENT=VERTICAL, and
up when ORIENT=HORIZONTAL. (If the layout's axis options set
REVERSE=TRUE, then the offset direction is also reversed.)
Tip Setting the discrete offset for the plots does not affect the axis minimum
and maximum offsets. In some cases, setting a discrete offset can cause
clipping at each end of the axis. In those cases, use the OFFSETMIN= and
OFFSETMAX= axis options to increase the axis minimum and maximum
offsets to accommodate the discrete offset.
ORIENT=
STANDARD
displays outlined, filled bars
ALL
displays outlined, filled bars, and connect lines
(display-options)
a space-separated list of one or more of the following options, enclosed in
parentheses:
OUTLINE
displays outlined bars.
FILL
displays bars with a solid fill.
CONNECT
displays line segments connecting adjacent midpoints at the end of each bar.
FILLPATTERN
displays bars with a patterned fill. This setting is used primarily for grouped
bar charts that must be rendered in monochrome for use in a journal article.
The fill patterns make it easier to distinguish among groups when color is not
available.
Default STANDARD
Note The connect lines are drawn in axis order starting with the third
maintenance release of SAS 9.4. They are drawn in data order in prior
releases.
You can specify both FILL and FILLPATTERN to combine solid fills
and pattern fills in the bars.
DISPLAYZEROLENGTHBAR=TRUE | FALSE
specifies whether zero-length bars are drawn.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
A zero-length bar is displayed as a line spanning the normal bar width at the bar-
chart baseline on the response axis. When this option is set to TRUE, zero-length
bars are displayed. Otherwise, they are suppressed. The following figure shows a
simple example of each outcome. In the figure, the plot wall outline, category axis
line, and bar-chart baseline are suppressed for clarity.
230 Chapter 6 • Plot Statements
Default TRUE
Note When this option is set to FALSE, the bar is not drawn, but other
elements associated with the bar such as the target bar, the error bar, the
bar label, and the data label, are drawn.
Tip The DATATRANSPARENCY= option sets the transparency for the bar
fills, bar outlines, and connect lines. You can combine this option with
DATATRANSPARENCY= to set one transparency for the bar outlines
and connect lines but a different transparency for the bar fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
style-element
specifies the name of a style element. You can specify only one of the elements
GraphData1–GraphDataN.
Restriction The only styles that are delivered by SAS that support fill patterns
are JOURNAL2, JOURNAL3, and MONOCHROMEPRINTER. If
any other such style is in effect and this option uses style-element in
its specification, then this option is ignored.
(fill-pattern-options)
a space-separated list of one or more of the following options, enclosed in
parentheses:
COLOR=color | style-reference
specifies a color to use for the bar-fill-pattern lines. With grouped data, the
COLOR= setting has the effect of holding the fill color constant across all
group values.
PATTERN=line-pattern
specifies a line pattern to use for the bar fill.
BARCHART Statement 231
With grouped data, the PATTERN= setting has the effect of holding the fill
pattern constant across all group values.
Interaction For this option to take effect, the DISPLAY= option must include
FILLPATTERN among the display options.
See DISPLAY=
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
SOLID
each bar is filled with the color that is assigned to that bar.
GRADIENT
an alpha gradient is used to determine the bar fill color. Each bar is filled with a
color and a transparency gradient that starts at the bar top with the specified fill
color and transparency, and transitions to fully transparent at the bar baseline.
The initial fill color is determined by a style element or by the FILLATTRS=
option COLOR= suboption. The initial transparency is determined by the
DATATRANSPARENCY= option or by the FILLATTRS= option
TRANSPARENCY= suboption.
Default SOLID
Interaction The DISPLAY= option must include FILL for this option to have any
effect.
For example, the sashelp.Cars data used in the “Example Program” on page 247
contains a column named Origin, which identifies the region that produces each car.
This column could be used in the BARCHART statement to group the bars in the
display (see the GROUPDISPLAY= option to see the output for the grouped bars):
layout overlay;
barchart category=type response=mpg_highway /
stat=mean group=origin name="b";
discretelegend "b" / title="Regions:";
endlayout;
Defaults If bar fills or fill patterns are enabled by the ODS style or by the
DISPLAY= option, then each distinct group value is represented in the
plot by a different fill color or fill pattern. The fill colors are defined
by the Color attribute of the GraphData1–GraphDataN and
GraphMissing style elements. The fill patterns are defined by the
FillPattern attribute of the GraphData1–GraphDataN and
GraphMissing style elements.
By default, the group values are mapped in the order of the data. Use
the GROUPORDER= option to control the sorting order of the
grouped bar segments. Use the INDEX= option to alter the default
sequence of colors and line patterns.
Note The bar display depends on the setting for the GROUPDISPLAY=
option.
Tip The representations that are used to identify the groups can be
overridden individually. For example, each distinct group value is
represented by a different line pattern for the bar outlines, but you can
use the PATTERN= setting on the OUTLINEATTRS= option to assign
the same line pattern to all bar outlines and connect lines.
POSITIVE
drops the negative values and normalizes only the positive values to 100%. The
following figure demonstrates the effect of POSITIVE on clustered bars in a
vertical bar chart. This chart uses the same data as the chart in the previous
figure.
234 Chapter 6 • Plot Statements
Notice that the negative values are dropped from the chart.
Default NONE
Requirement The GROUP= option must be specified for this option to have any
effect.
Note You can use this option with any value for the GROUPDISPLAY=
option.
GROUPDISPLAY=STACK | CLUSTER
specifies how to display grouped bars.
STACK
displays group values as stacked segments within the category bar.
CLUSTER
displays group values as separate adjacent bars that replace the single category
bar. Each cluster of group values is centered at the category midpoint on the axis.
This example illustrates the clusters and also how groups are displayed when
they have an unequal number of unique values.
BARCHART Statement 235
Default STACK
Interaction When you use the BARLABEL= option and the GROUP= option, the
BARLABEL values are displayed for each bar when
GROUPDISPLAY=CLUSTER. When GROUPDISPLAY=STACK, the
whole bar is labeled at the top.
Tip For a linear response axis, when STAT=MEAN or STAT=PCT, the axis
tick values might be displayed as integer values when
GROUPDISPLAY=STACK. Changing GROUPDISPLAY= to
CLUSTER in that case might cause the axis values to change to
decimal values. To keep the integer axis values in both cases, you can
specify the INTEGER=TRUE option for the response axis. See
INTEGER= on page 915.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
236 Chapter 6 • Plot Statements
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping bar attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
BARCHART Statement 237
INTERVALBARWIDTH=dimension
specifies the width of the bars in an interval bar chart as a ratio of the interval width.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Restriction This option applies only to a linear or time category axis. When the
category axis is discrete, this option is ignored.
Interaction When the category data is interval, this option overrides the
BARWIDTH= option.
Tip To make the category axis type linear or time, include TYPE=LINEAR
or TYPE=TIME in the category axis options or assign the role of
primary plot to a plot that makes the category axis linear or time.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The response-variable label. If a label is not defined, then the response-
variable name is used.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
Default VERTICAL
Notes When this option is set to HORIZONTAL, the category variable appears on
the Y (or Y2) axis and the response variable appears on the X (or X2) axis.
To set the axis properties for this chart, you should use the appropriate axis
options of the layout container.
When this option is set to VERTICAL, the category variable appears on the
X (or X2) axis and the response variable appears on the Y (or Y2) axis. To
set the axis properties for this chart, you should use the appropriate axis
options of the layout container.
238 Chapter 6 • Plot Statements
If you change the orientation of the bar chart, then you should adjust the
layout container’s axis options appropriately.
For grouped data and filled bars, the ContrastColor attribute of the
GraphData1–GraphDataN style elements, and the LineThickness and
LineStyle attributes of the GraphOutlines style element.
For grouped data and unfilled bars, the ContrastColor and LineStyle
attributes of the GraphData1–GraphDataN style elements, and the
LineThickness attribute of the GraphOutlines style element.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
SEGMENTLABEL=TRUE | FALSE
specifies whether a label is displayed inside each bar segment.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
BARCHART Statement 239
When this value is set to FALSE, no labels are displayed inside the bars.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
Default THIN
SEGMENTLABELFORMAT=format
specifies the text format for the bar segment labels.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
SUM
MEAN
Defaults For bar charts with no RESPONSE= column, the default is FREQ.
Note When this option is used with the GROUP=group option, the specified
statistic is computed for each segment that is created for the unique group
values.
TARGET=numeric-column | expression
specifies the target value for each bar. The visual representation is a triangle with a
line at the target value.
layout overlay;
barchart category=type response=mpg_highway / barwidth=.8
target=mpg_city group=origin groupdisplay=cluster
name='bar';
discretelegend 'bar';
endlayout;
Interactions For this option to take effect, the RESPONSE= argument must also be
used.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a bar. If this
option is used, then the information specified replaces all of the information that is
displayed by default.
(role-list)
an ordered, space-separated list of unique BARCHART roles. BARCHART roles
include CATEGORY or X, RESPONSE or Y, COLORRESPONSE, INDEX,
GROUP, and TARGET.
Notes For the category and response roles, the TIP= option recognizes only
the category and response arguments that you use in the BARCHART
statement. If you use the CATEGORY= and RESPONSE= arguments,
then you must specify roles CATEGORY and RESPONSE.
Conversely, if you use the X= and Y= arguments, then you must
specify roles X and Y.
Example The following example displays data tips for the columns assigned
only to the roles CATEGORY and RESPONSE:
TIP=(CATEGORY RESPONSE)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: CATEGORY or X, RESPONSE or Y,
COLORRESPONSE, and GROUP.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement with the IMAGEMAP option specified,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIP=(RESPONSE)
TIPFORMAT=(RESPONSE=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
BARCHART Statement 243
Restriction Only the roles that appear in the TIP= option are used.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIP=(RESPONSE)
TIPLABEL=(RESPONSE="Average Sales")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
URL=string-column
specifies an HTML page to display when the bar is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
bar that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Notes For non-grouped data, the values of the column are expected to be
same for each unique category value. If they are not, then the results
might be unpredictable.
For grouped data, the values of the column are expected to be the
same for each unique category and GROUP combination.
Tips The URL value can be blank for some category values, meaning that
no action is taken when the bars for those category values are
selected.
The URL value can be the same for different category values,
meaning that the same action is taken when the bars for those
category values are selected.
244 Chapter 6 • Plot Statements
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
Statement Description
The BARCHART statement creates a bar chart with bars that represent summarized
response values. The response values are categorized by the unique category values or,
starting with the third maintenance release of SAS 9.4, by the bins in binned category
data. The BARCHART statement takes nonsummarized data as input and calculates the
appropriate summarization statistics (sum, mean, and so on) for each unique category
value or category bin. Prior to the third maintenance release of SAS 9.4, the category
axis for a bar chart must be discrete. Starting with the third maintenance release of SAS
9.4, the category axis can be discrete, linear, or time. The response axis in all cases is
interval.
When the chart is oriented vertically, the X (or X2) axis is used for CATEGORY and the
Y (or Y2) axis is used for RESPONSE. When it is oriented horizontally, the X (or X2)
axis is used for RESPONSE and the Y (or Y2) axis is used for CATEGORY. (See
ORIENT= on page 237.)
By default, if the category column is character, then the bars in the chart appear in the
order in which the category values are present in the input data. If the category column is
numeric, then the values are presented in ascending order. For non-grouped data,
duplicated category values are summarized into a unique value. For grouped data, the
category values are summarized as needed. (See the GROUP= option.)
Starting with the third maintenance release of SAS 9.4, for numeric category values, an
interval bar chart is generated only when the category axis type is linear or time. To
specify a category axis type of linear or time, include the TYPE= option in the category
axis options, or assign the role of primary plot to a plot that sets the category axis type to
linear or time automatically. By default, a bar is drawn for each unique category value,
which can result in a large number of bars for numeric category data.
When binning is used, for each bin, a summarization statistic is computed, and a bar is
drawn that represents that statistic. The width of each bar spans the width of the bin that
it represents. The left-most edge of the bar represents the start of the bin, and the right-
most edge represents the end. See “Example 1: Horizontal Bar Chart” on page 247.
BARCHART Statement 245
TIP Prior to the third maintenance release of SAS 9.4, use the HISTOGRAM
statement to create a bar chart that represents response values along an interval axis.
To place the different response values side by side, you can assign a different offset to
each BARCHART statement. The BARWIDTH= option can be used with
DISCRETEOFFSET= to create narrower bars that require less width within the plot
area:
layout overlay / cycleattrs=true
xaxisopts=(display=(tickvalues))
yaxisopts=(label="Revenue" offsetmax=0.2);
discreteoffset=0 barwidth=0.3 ;
barchart category=year response=C_revenue / stat=sum name="C"
legendlabel="C"
discreteoffset=+0.3 barwidth=0.3 ;
Examples
Example Program
proc template;
define statgraph barchart;
begingraph;
entrytitle "Average Mileage by Vehicle Type";
layout overlay;
barchart category=type response=mpg_highway /
stat=mean orient=horizontal;
endlayout;
248 Chapter 6 • Plot Statements
endgraph;
end;
Example Program
Here is the SAS code.
proc template;
define statgraph cylinders;
begingraph;
entrytitle "Interval Bar Chart of Vehicle Engine Cylinders";
layout overlay /
xaxisopts=(label="Engine Cylinders" type=linear
linearopts=(tickvaluelist=(3 4 5 6 8 10 12)))
yaxisopts=(label="Percentage of Vehicles Manufactured"
griddisplay=on linearopts=(tickvalueformat=percent7.1));
barchart category=cylinders / stat=proportion
barlabel=true barlabelformat=percent7.1;
endlayout;
endgraph;
end;
run;
run;
Details
An interval bar chart can be generated only when the category axis type is LINEAR or
TIME. In this example, the TYPE=LINEAR option is included in the XAXISOPTS=
options. With numeric category data, a bar is drawn for each unique category value. In
some cases, that can generate too many bars in the resulting chart. In this example, there
are only seven unique values. The TICKVALUELIST= option is used in the
XAXISOPTS= option to display all of the values on the category axis.
Example Program
proc template;
define statgraph barchart;
begingraph;
entrytitle "Average Mileage by Vehicle Type";
layout overlay;
barchart category=type response=mpg_highway / name="bar"
stat=mean orient=horizontal
colorbyfreq=true colorstat=pct;
continuouslegend "bar" /
title="Percent of Total Models Manufactured";
endlayout;
endgraph;
end;
run;
250 Chapter 6 • Plot Statements
BARCHARTPARM Statement
Creates a bar chart specified by pre-summarized data.
Requirement: The input data must be pre-summarized, with appropriate summarization statistics
(sum, mean, and so on) computed for the RESPONSE column.
Tips: For charts that have a large number of bars that are very close together, slight
variations in spacing that normally occur due to integer rounding can become more
obvious. Subpixel rendering provides more precise bar spacing in that case. In the
second maintenance release of SAS 9.4 and in earlier releases, specify
SUBPIXEL=ON in the BEGINGRAPH statement to enable subpixel rendering. See
SUBPIXEL= on page 33. Starting with the third maintenance release of SAS 9.4,
subpixel rendering is enabled by default.
To disable subpixel rendering in the third maintenance release of SAS 9.4 and in
later releases, specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an
ODS GRAPHICS statement. For information about the BEGINGRAPH statement
SUBPIXEL= option, see SUBPIXEL= on page 33. For information about the ODS
GRAPHICS statement SUBPIXEL= option, see “ODS GRAPHICS Statement” in
SAS ODS Graphics: Procedures Guide.
Syntax
BARCHARTPARM CATEGORY=column | expression
RESPONSE=numeric-column | expression </option(s)>;
Appearance options
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing
or bin width.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute variable to use to map the bar colors to
a continuous color gradient.
CONNECTATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the bar connect lines.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bars.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fill, bar outline, error bars,
connect line, and data labels, if displayed.
BARCHARTPARM Statement 251
Axes options
BASELINEINTERCEPT=number
specifies the response axis intercept for the baseline.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABEL=column | expression
specifies the label that appears at the end of each bar.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the labels that are specified in the
DATALABEL= option.
DATALABELFITPOLICY=AUTO | NONE | ROTATE | SPLIT | SPLITALWAYS
specifies a policy for avoiding collisions among the bar labels when labels
are displayed.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed data
labels.
DATALABELTYPE=AUTO | COLUMN
specifies whether the data labels display the RESPONSE values or the values
of the column that is specified by the DATALABEL= option.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
SEGMENTLABELATTRS=style-element | style-element (text-options) | (text-
options)
specifies the text properties of the text for the bar segment label.
SEGMENTLABELFITPOLICY=NONE | NOCLIP | THIN
specifies a policy for fitting the bar segment labels within the bar segments.
SEGMENTLABELFORMAT=format
specifies the text format for the bar segment labels.
SEGMENTLABELTYPE=NONE | AUTO
specifies whether a label is displayed inside each bar segment.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all bars from the category midpoints.
GROUP=column | discrete-attr-var | expression
creates a separate bar segment or bar for each unique group value in the
specified column.
GROUP100=NONE | MAGNITUDE | POSITIVE
displays the response values, normalized to 100%.
GROUPDISPLAY=STACK | CLUSTER
specifies how to display grouped bars.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
BARCHARTPARM Statement 253
Required Arguments
CATEGORY=column | expression
specifies the column for the unique category values. All values are treated as
discrete.
Note You can use X= as an alternative to CATEGORY=. If you use X=, then be
aware that the TIP=, TIPFORMAT=, and TIPLABEL= options will recognize
X as the category role and not CATEGORY in that case.
RESPONSE=numeric-column | expression
specifies the column for the response values.
Note You can use Y= as an alternative to RESPONSE=. If you use Y=, then be
aware that the TIP=, TIPFORMAT=, and TIPLABEL= options will recognize
Y as the response role and not RESPONSE in that case.
Optional Arguments
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
Default 0.85
Interaction Starting with the third maintenance release of SAS 9.4, the
INTERVALBARWIDTH= option overrides this option for an interval
bar chart.
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
BASELINEINTERCEPT=number
specifies the response axis intercept for the baseline. The baseline is always
displayed in the chart, whether for a specified value or for the default value. When
this option is used, the axis range is adjusted to include the baseline, and the baseline
is placed at the specified value on the response axis.
Default 0
Note Label positions are automatically adjusted to prevent the labels from
overlapping.
The baseline does not add a tick or a tick value to the axis. To label the
baseline, use a REFERENCELINE statement to overlay a line with the
same X or Y value and include the CURVELABEL= option to specify
the label text.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing or bin
width.
BARCHARTPARM Statement 255
Default 0.85
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Requirement For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip Use the DISPLAY= option to specify whether outlines and fills are
displayed.
When fill, fill pattern, or both are displayed, this option overrides
suboption COLOR= in the FILLATTRS= option and in the
FILLPATTERNATTRS= option and varies the color according to the
color gradient or the attribute map.
When only the outlines are displayed, this option overrides suboption
COLOR= in the OUTLINEATTRS= option and varies the outline
color according to the color gradient or the attribute map.
Use the FILLTYPE= option to specify whether each bar is filled with
a solid color or with a gradient color.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DATALABEL=column | expression
specifies the label that appears at the end of each bar.
Interactions Starting with the second maintenance release of SAS 9.4, this option is
ignored when DATALABELTYPE=AUTO.
When the GROUP= option is in effect, the data label values are
displayed only when GROUPDISPLAY=CLUSTER.
Interaction For this option to take effect, the DATALABEL= option must also be
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Tip If character labels do not fit after splitting, then try using ROTATE instead
of AUTO.
NONE
does not attempt to fit bar labels that collide.
ROTATE
rotates the bar labels for vertical bars if the labels collide in the available width.
SPLIT
splits the label for vertical bars at a split character only if a split is needed at that
character in order to make the label fit the available space. No split occurs at split
characters that occur where a split is not needed. If the label does not contain any
of the specified split characters, then a split does not occur. In that case, if the
label does not fit the available space, then it might collide with the adjoining
labels.
SPLITALWAYS
splits the label for vertical bars at every occurrence of a split character. If the
label does not contain any of the specified split characters, then a split does not
occur.
Default AUTO
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split. When multiple
split characters are specified, each character in the list is treated as a separate split
character unless the specified characters appear consecutively in the data label. In
that case, all of the specified split characters together are treated as a single split
character.
When DATALABELFITPOLICY=SPLIT and a data label collision is detected, the
data label is split on a specified split character only if a split is needed at that point in
order to make the label fit. In that case, a split might not occur on every split
character. When DATALABELFITPOLICY=SPLITALWAYS, the data label is split
unconditionally on every occurrence of a split character. If the data label does not
contain any of the specified split characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed data labels.
260 Chapter 6 • Plot Statements
TRUE
drops a split character from the display when a split occurs at that character. Split
characters at which a split does not occur are left in place. The
DATALABELFITPOLICY= option determines where the labels are split. When
DATALABELFITPOLICY=SPLIT, each label is split at a split character only
where a split is needed in order to make the label fit the available space. At each
split point, the split character is dropped, and the characters that follow the split
character, up to but not including the split character at the next split point, are
wrapped to the following line.
When DATALABELFITPOLICY=SPLITALWAYS, each label is split at every
instance of a split character. All of the split characters are dropped. The
characters that follow each split character, up to but not including the next split
character, are wrapped to the next line.
The following figure shows how label Product*Group*1 is split when the
DATALABELSPLITCHARDROP=TRUE and DATALABELSPLITCHAR="*"
options are specified with the SPLIT and SPLITALWAYS fit policies.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELTYPE=AUTO | COLUMN
specifies whether the data labels display the RESPONSE values or the values of the
column that is specified by the DATALABEL= option.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
AUTO
the labels are displayed as follows:
• For an ungrouped bar chart, the summarized value for each bar is placed
above the bar.
• For a grouped bar chart with stacked bars, the total of the summarized
segment values for each bar is placed above the segmented bar.
• For a grouped bar chart with clustered bars, the summarized value for each
bar in the cluster is placed above the bar.
COLUMN
the data labels display the DATALABEL= column values.
Default COLUMN
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fill, bar outline, error bars, connect
line, and data labels, if displayed.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the bar
fills. You can combine this option with FILLATTRS= to set one
transparency for the bar outlines, error bars, and connect lines but a
different transparency for the bar fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
DISCRETEOFFSET=number
specifies an amount to offset all bars from the category midpoints.
Default 0 (no offset, all bars are centered on the category midpoints)
Range -0.5 to +0.5, where 0.5 represents half the distance between category ticks.
Normally, a positive offset is to the right when ORIENT=VERTICAL, and
up when ORIENT=HORIZONTAL. (If the layout's axis options set
REVERSE=TRUE, then the offset direction is also reversed.)
Tip Setting the discrete offset for the plots does not affect the axis minimum
and maximum offsets. In some cases, setting a discrete offset can cause
clipping at each end of the axis. In those cases, use the OFFSETMIN= and
OFFSETMAX= axis options to increase the axis minimum and maximum
offsets to accommodate the discrete offset.
ORIENT=
Default STANDARD
264 Chapter 6 • Plot Statements
Restriction Neither error bars nor connect lines are displayed for grouped data.
DISPLAYZEROLENGTHBAR=TRUE | FALSE
specifies whether zero-length bars are drawn.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
A zero-length bar is displayed as a line spanning the normal bar width at the bar-
chart baseline on the response axis. When this option is set to TRUE, zero-length
bars are displayed. Otherwise, they are suppressed. The following figure shows a
simple example of each outcome. In the figure, the plot wall outline, category axis
line, and bar-chart baseline are suppressed for clarity.
Default TRUE
Note When this option is set to FALSE, the bar is not drawn, but other
elements associated with the bar such as the target bar, the error bar, the
bar label, and the data label, are drawn.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
BARCHARTPARM Statement 265
ERRORBARCAPSHAPE=SERIF | NONE
specifies whether the error bars have a serif cap.
Defaults SERIF in the first maintenance release of SAS 9.4 and earlier releases.
ERRORLOWER=numeric-column | expression
specifies the values of the lower endpoints on the Y error bars.
Requirement The error bar values must be absolute data values, not data values
relative to the value of the bar.
ERRORUPPER=numeric-column | expression
specifies the values of the upper endpoints on the Y error bars.
Requirement The error bar values must be absolute data values, not data values
relative to the value of the bar.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element .
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
style-element
specifies the name of a style element. You can specify only one of the elements
GraphData1–GraphDataN.
Restriction The only styles that are delivered by SAS that support fill patterns
are JOURNAL2, JOURNAL3, and MONOCHROMEPRINTER. If
any other such style is in effect and this option uses style-element in
its specification, then this option is ignored.
(fill-pattern-options)
a space-separated list of one or more of the following options, enclosed in
parentheses:
COLOR=color | style-reference
specifies a color to use for the bar-fill-pattern lines. With grouped data, the
COLOR= setting has the effect of holding the fill color constant across all
group values.
PATTERN=line-pattern
specifies a line pattern to use for the bar fill.
To specify a line-pattern, combine a line-direction prefix (R for right, L for
left, and X for cross hatch) with a line-identification number:
BARCHARTPARM Statement 267
With grouped data, the PATTERN= setting has the effect of holding the fill
pattern constant across all group values.
Interaction For this option to take effect, the DISPLAY= option must include
FILLPATTERN among the display options.
See DISPLAY=
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
SOLID
each bar is filled with the color that is assigned to that bar.
GRADIENT
an alpha gradient is used to determine the bar fill color. Each bar is filled with a
color and a transparency gradient that starts at the bar top with the specified fill
color and transparency, and transitions to fully transparent at the bar baseline.
The initial fill color is determined by a style element or by the FILLATTRS=
option COLOR= suboption. The initial transparency is determined by the
DATATRANSPARENCY= option or by the FILLATTRS= option
TRANSPARENCY= suboption.
Default SOLID
Interaction The DISPLAY= option must include FILL for this option to have any
effect.
The bar display depends on the setting for the GROUPDISPLAY= option. For
example, for a vertical bar chart with GROUPDISPLAY=STACK, bar segments are
stacked to form the bar. The height of each segment represents the corresponding
group value’s proportional contribution to the response value.
Defaults If bar fills are enabled by the ODS style or by the DISPLAY= option,
then each distinct group value is represented in the plot by a different
fill color or fill pattern. The fill colors are defined by the Color
attribute of the GraphData1–GraphDataN and GraphMissing style
elements. The fill patterns are defined by the FillPattern attribute of
the GraphData1–GraphDataN and GraphMissing style elements.
By default, the group values are mapped in the order of the data. Use
the GROUPORDER= option to control the sorting order of the group
values.
Tips The representations that are used to identify the groups can be
overridden individually. For example, each distinct group value is
represented by a different line pattern for the bar outlines, but you
could use the PATTERN= setting on the OUTLINEATTRS= option to
assign the same line pattern to all bar outlines and connect lines.
Use the INDEX= option to alter the default sequence of colors, fill
patterns, and line patterns.
chart. The negative values are displayed enclosed in parentheses below the bars
for a vertical bar chart and on the left end for a horizontal bar chart.
The following figure illustrates the effect of MAGNITUDE on stacked bars in a
vertical bar chart.
POSITIVE
drops the negative values and normalizes only the positive values to 100%. The
following figure demonstrates the effect of POSITIVE on clustered bars in a
vertical bar chart. This chart uses the same data as the chart in the previous
figure.
Notice that the negative values are dropped from the chart.
Default NONE
Requirement The GROUP= option must be specified for this option to have any
effect.
Note You can use this option with any value for the GROUPDISPLAY=
option.
270 Chapter 6 • Plot Statements
GROUPDISPLAY=STACK | CLUSTER
specifies how to display grouped bars.
STACK
displays group values as stacked segments within the category bar.
CLUSTER
displays group values as separate adjacent bars that replace the single category
bar. Each cluster of group values is centered at the category midpoint on the axis.
This example illustrates the clusters and also how groups are displayed when
they have an unequal number of unique values.
Default STACK
Interactions When you use the DATALABEL= option and the GROUP= option,
the DATALABEL values are displayed for each bar when
GROUPDISPLAY=CLUSTER. When GROUPDISPLAY=STACK,
the whole bar is labeled at the top.
When the TARGET= and GROUP= options are in effect, the target
values are not displayed when GROUPDISPLAY=STACK. In that
BARCHARTPARM Statement 271
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
272 Chapter 6 • Plot Statements
INDEX=positive-integer-column | expression
specifies indices for mapping bar attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
INTERVALBARWIDTH=dimension
specifies the width of the bars in an interval bar chart as a ratio of the interval width.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Restriction This option applies only to a linear or time category axis. When the
category axis is discrete, this option is ignored.
Interaction When the category data is interval, this option overrides the
BARWIDTH= option.
Tip To make the category axis type linear or time, include TYPE=LINEAR
or TYPE=TIME in the category axis options or assign the role of
primary plot to a plot that makes the category axis linear or time.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The response-variable label. If a label is not defined, then the response-
variable name is used.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
Default VERTICAL
Notes When this option is set to VERTICAL, the category variable appears on the
X (or X2) axis and the response variable appears on the Y (or Y2) axis. To
set the axis properties for this chart, you should use the appropriate axis
options of the layout container.
If you change the orientation of the bar chart, then you should adjust the
layout container’s axis options appropriately.
For grouped data and filled bars, the ContrastColor attribute of the
GraphData1–GraphDataN style elements, and the LineThickness and
LineStyle attributes of the GraphOutlines style element.
For grouped data and unfilled bars, the ContrastColor and LineStyle
attributes of the GraphData1–GraphDataN style elements, and the
LineThickness attribute of the GraphOutlines style element.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
274 Chapter 6 • Plot Statements
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles CATEGORY or X, RESPONSE or Y,
ERRORLOWER, ERRORUPPER, GROUP, and INDEX.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
NONE
no attempt is made to fit each segment label within its bar. Long bar segment
labels might overlap other graphical elements. The segment labels are not
considered when the axis ranges are computed. As a result, segment labels that
extend beyond the plot area are clipped.
NOCLIP
does not clip bar segment labels that extend beyond the plot area. Labels that do
not fit within the plot area extend into the graph axis area and might overlap axis
elements.
THIN
drops any bar segment label that does not fit within its segment. For a vertical bar
chart, the label width must not exceed the bar width, and the text height must not
exceed the segment height. For a horizontal bar chart, the label text height must
not exceed the bar width, and the label length must not exceed the segment
length.
Default THIN
SEGMENTLABELFORMAT=format
specifies the text format for the bar segment labels.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
SEGMENTLABELTYPE=NONE | AUTO
specifies whether a label is displayed inside each bar segment.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
For an ungrouped bar chart or for a grouped bar chart with
GROUPDISPLAY=CLUSTER, AUTO displays a bar label inside each bar. The label
for each bar displays the value for that bar. For a grouped bar chart with
GROUPDISPLAY=STACK, AUTO displays a label inside each bar segment. The
label for each bar segment displays the value for that segment.
276 Chapter 6 • Plot Statements
When this value is set to NONE, no labels are displayed inside the bars.
Default NONE
See “boolean ” on page 1339 for other Boolean values that you can use.
TARGET=numeric-column | expression
specifies the target value for each bar. The visual representation is a triangle with a
line at the target value.
layout overlay;
barchartparm category=type response=mpg_highway / barwidth=.8
target=mpg_city group=origin groupdisplay=cluster
name='bar';
discretelegend 'bar';
endlayout;
BARCHARTPARM Statement 277
Interactions For this option to take effect, the RESPONSE= argument must also be
used.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a bar. If this
option is used, then the information specified replaces all of the information that is
displayed by default. You can specify roles for columns that do not contribute to the
bar chart along with roles that do.
(role-list)
an ordered, space-separated list of unique BARCHARTPARM roles and user-
defined roles. BARCHARTPARM roles include CATEGORY or X, RESPONSE
or Y, COLORRESPONSE, ERRORUPPER, ERRORLOWER, INDEX,
GROUP, and DATALABEL.
Notes For the category and response roles, the TIP= option recognizes only the
category and response arguments that you use in the BARCHARTPARM
statement. If you use the CATEGORY= and RESPONSE= arguments,
then you must specify roles CATEGORY and RESPONSE. Conversely,
if you use the X= and Y= arguments, then you must specify roles X and
Y.
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: CATEGORY or X, RESPONSE or Y,
COLORRESPONSE, ERRORLOWER, ERRORUPPER, and
GROUP.
278 Chapter 6 • Plot Statements
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement with the IMAGEMAP option specified,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
Example The following example displays data tips for the columns assigned to
the roles CATEGORY and RESPONSE as well as for the column Pct.
The Pct column is not assigned to any pre-defined bar chart role, so it
must first be assigned a role.
ROLENAME=(TIP1=PCT)
TIP=(TIP1 CATEGORY RESPONSE)
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
BARCHARTPARM Statement 279
URL=string-column
specifies an HTML page to display when the bar is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
bar that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
For grouped data, the values of the column are expected to be the
same for each unique category and GROUP combination.
Tips The URL value can be blank for some category values, meaning that
no action is taken when the bars for those category values are
selected.
The URL value can be the same for different category values,
meaning that the same action is taken when the bars for those
category values are selected.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
280 Chapter 6 • Plot Statements
Details
Statement Description
The input data for the BARCHARTPARM statement is expected to be pre-summarized,
with appropriate summarization statistics (sum, mean, and so on) computed for the
response column. When the category values are not unique, the display is not
meaningful. Prior to the third maintenance release of SAS 9.4, the category axis must be
discrete. Starting with the third maintenance release of SAS 9.4, the category axis can be
discrete, linear, or time. The response axis in all cases is interval.
When the chart is oriented vertically, the X (or X2) axis is used for category and the Y
(or Y2) axis is used for response. When the chart is oriented horizontally, the X (or X2)
axis is used for response and the Y (or Y2) axis is used for category. (See ORIENT= on
page 273.) If the chart is the primary chart, then any charts or plots that are overlaid with
it must have similar axis types.
By default, if the CATEGORY= column is character, then the bars in the chart appear in
the order in which the category values are present in the input data. If the CATEGORY=
column is numeric, then the values are presented in ascending order.
To place the different response values side by side, you can assign a different offset to
each BARCHARTPARM statement. The BARWIDTH= option can be used with
DISCRETEOFFSET= to create narrower bars that require less width within the plot
area:
layout overlay / cycleattrs=true
xaxisopts=(display=(tickvalues))
yaxisopts=(label="Revenue" offsetmax=0.2);
The following graph was generated by the “Example Program” on page 283:
Example Program
proc template;
define statgraph barchartparm;
begingraph;
entrytitle "Average Mileage by Vehicle Type";
entryfootnote halign=left
"Error bars show +/- 1 Standard Error";
layout overlay;
barchartparm category=type response=mean /
errorlower=eval(mean-stderr)
errorupper=eval(mean+stderr) ;
endlayout;
endgraph;
end;
run;
BIHISTOGRAM3DPARM Statement
Creates a three-dimensional bivariate histogram of three variables X, Y, and Z, where the values of X and
Y have been gridded. The Z variable represents a response value for the frequency, percentage counts, or
densities of each bin combination.
Restriction: BIHISTOGRAM3DPARM does not support the data tips that are enabled by the
IMAGEMAP= option in the ODS GRAPHICS statement.
Requirements: The input data must be binned by both X and Y. That is, the values for X column and
Y column must form a complete rectangular grid of bins. Input data with non-binned
columns should be preprocessed with the KDE procedure (SAS/STAT), which
enables you to set the number of bins for X and Y, or with a technique similar to that
used in “Example: BIHISTOGRAM3DPARM Statement” on page 288.
The BIHISTOGRAM3DPARM statement must be specified within a LAYOUT
OVERLAY3D statement and cannot be nested under an OVERLAY,
OVERLAYEQUATED, or PROTOTYPE layout.
The input data for Z= column must be nonnegative.
Note: In the plot display, the direction of the Z axis is upward rather than outward.
Syntax
BIHISTOGRAM3DPARM X=numeric-column | expression
Y=numeric-column | expression
Z=non-negative-numeric-column | expression </option(s)>;
Appearance options
DATATRANSPARENCY=number
specifies the degree of the transparency of the bins.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display outlined bins, filled bins, or outlined and filled
bins.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled bins.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the bin outlines.
XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the input X values represent midpoints, lower endpoints, or
upper endpoints of the bins.
YVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the input Y values represent midpoints, lower endpoints, or
upper endpoints of the bins.
Axes options
BINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for the axis tick marks.
BIHISTOGRAM3DPARM Statement 285
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
Label options
ENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the bin
endpoints (TRUE) or at the bin midpoints (FALSE).
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Required Arguments
X=numeric-column | expression
specifies the bin location of the numeric X values.
Y=numeric-column | expression
specifies the bin location of the numeric Y values.
Z=nonnegative-numeric-column | expression
specifies the response values, such as the frequency counts, percentages, or densities.
Optional Arguments
BINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for the axis tick marks.
TRUE
specifies that the ENDLABELS= option determines how the axis ticks and value
labels are displayed.
FALSE
specifies that standard axes are used. Bin boundaries and midpoints that are set
by the ENDLABELS= option are ignored.
Default TRUE
Interactions For this option to take effect, this plot must be the primary plot in the
parent OVERLAY3D layout. For more information, see the
PRIMARY= option.
When this option is set to TRUE, some X-axis options that are set on
the parent layout might not apply, such as INTEGER=,
TICKVALUELIST=, TICKVALUESEQUENCE=, and
INCLUDERANGES=.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bins.
Default 0
286 Chapter 6 • Plot Statements
Default STANDARD
ENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the bin endpoints
(TRUE) or at the bin midpoints (FALSE).
Default FALSE.
Interactions This option is ignored if this plot is not the primary plot in the parent
layout. For more information, see the PRIMARY= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
Restriction This option uses only the color specification in the style element or line
options. The line pattern and line thickness specifications are ignored.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
Default MIDPOINTS
Default MIDPOINTS
Details
Because the BIHISTOGRAM3DPARM statement does not perform a binning
computation on the input columns, you must pre-bin the data. In addition, input data for
288 Chapter 6 • Plot Statements
the statement must be binned by both X and Y. That is, the values for the X column and
the Y column must form a complete, rectangular grid of bins. Input data with non-binned
columns should be preprocessed with the KDE procedure (SAS/STAT), which enables
you to set the number of bins for X and Y. Alternatively, the data can be preprocessed
with a technique similar to the example, where a pre-defined bin width is used.
The bounding cube can be titled, rotated, and zoomed to provide a different viewpoint.
By default, the outline of the bounding cube is displayed and the viewing rotation angle
is 57 degrees, the tilt angle is 20 degrees and the zoom factor is 1. See the CUBE=,
ROTATE=, TILT=, and ZOOM= options of the LAYOUT OVERLAY3D statement for
information about how to change the viewpoint.
The X-axis, Y-axis, and Z-axis are linear by default. You can change axis properties with
the XAXISOPTS=, YAXISOPTS=, and ZAXISOPTS= options of the LAYOUT
OVERLAY3D statement.
Note: When BINAXIS=TRUE, some axis options for the X- and Y-axes might not
apply.
The following graph was generated by the “Example Program” on page 288:
Example Program
proc template;
define statgraph bihistogram;
begingraph;
entrytitle "Distribution of Height and Weight";
entryfootnote halign=right "SASHELP.HEART";
BLOCKPLOT Statement 289
data heart;
set sashelp.heart(keep=height weight);
if height ne . and weight ne .;
height=round(height,5);
weight=round(weight,25);
run;
BLOCKPLOT Statement
Creates one or more strips of rectangular blocks containing text values. The width of each block
corresponds to specified numeric intervals.
Syntax
BLOCKPLOT X=column | expression
BLOCK=column | expression </option(s)>;
Appearance options
ALTFILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of alternate fills.
BLOCKINDEX=positive-integer-column | expression
specifies indices for remapping the assignment of the color of the block fills.
CLASS=column | expression
creates a separate block plot for each unique value of the specified column or
expression.
DATATRANSPARENCY=number
specifies the degree of the transparency of the block fill and outline.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display an outlined, a filled, or an outlined and filled
block area.
EXTENDBLOCKONMISSING=TRUE | FALSE
specifies whether a missing value in the BLOCK column starts a new block
or reverts to the previous nonmissing value.
290 Chapter 6 • Plot Statements
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
Label options
BLOCKLABEL=column | expression
specifies alternative text to display for the internal block text values.
LABEL="string"
specifies an external label for a single block plot.
LABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the external block label(s).
LABELPOSITION=LEFT | RIGHT | TOP | BOTTOM
specifies the alignment of BLOCK label.
Text options
VALUEATTRS=style-element | style-element (text-options) | (text-options)
specifies the appearance of the internal block text values or the alternative
values that are specified by the BLOCKLABEL= option.
VALUEFITPOLICY=NONE | SHRINK | SPLIT | SPLITALWAYS | TRUNCATE
specifies how text values are adjusted to fit within the containing block.
VALUEHALIGN=LEFT | CENTER | RIGHT | START
specifies the horizontal alignment of the value text within the blocks.
VALUESPLITCHAR="character-list"
specifies one or more characters on which the values can be split, if needed.
VALUESPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed values.
VALUEVALIGN=TOP | CENTER | BOTTOM
specifies the vertical alignment of the value text within the blocks.
Required Arguments
X=column | expression
specifies numeric X axis positions. When the X-axis is numeric and the specified
column is numeric, values are expected to be in sorted, ascending order. If the X-axis
BLOCKPLOT Statement 291
is discrete and the specified column is numeric, values are treated as numeric-
discrete.
BLOCK=column | expression
specifies a value for each X position. Numeric values are converted to text strings
according to an assigned format or BEST6.
Optional Arguments
ALTFILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of alternate fills. This option in conjunction with the
FILLATTRS= option controls fill appearance when FILLTYPE=ALTERNATE.
Requirement FILLTYPE= ALTERNATE must set for this option to have any
effect.
Interaction For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
To make all block fill areas the same color, set the FILLATTRS= and
ALTFILLATTRS= options to the same value.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
BLOCKINDEX=positive-integer-column | expression
specifies indices for remapping the assignment of the color of the block fills.
Requirements FILLTYPE= MULTICOLOR must be set for this option to have any
effect.
All of the indices for a specific block value must be the same.
Otherwise, the results are unpredictable.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style element to use.
292 Chapter 6 • Plot Statements
If this option is not used, then the color values are mapped in the
order of GraphData1–GraphDataN.
BLOCKLABEL=column | expression
specifies alternative text to display for the internal block text values.
Interaction The DISPLAY= option must include VALUES for the alternative text
to appear.
Note The text for each block segment must be the same. Otherwise, the
results are unpredictable.
The font and color attributes for the alternative text are specified by the
VALUEATTRS= option.
CLASS=column | expression
creates a separate block plot for each unique value of the specified column or
expression. Each block plot is labeled externally by the class value.
Interactions The DISPLAY= option must include LABEL for any external labels to
appear.
Tip The font and color attributes for the external labels are specified by the
LABELATTRS= option.
DATATRANSPARENCY=number
specifies the degree of the transparency of the block fill and outline.
Default 0
Note This option does not affect the block values or labels.
Tip The ALTFILLATTRS= option can be used to set transparency for just the
alternate block fills. The FILLATTRS= option can be used to specify
transparency for the block fills. You can combine this option with
ALTFILLATTRS= and with FILLATTRS= to set one transparency for the
outlines but a different transparency for the block fills. Example:
datatransparency=0.2
altfillattrs=(transparency=0.6) fillattrs=(transparency=0.6)
Default STANDARD
EXTENDBLOCKONMISSING=TRUE | FALSE
specifies whether a missing value in the BLOCK column starts a new block or
reverts to the previous nonmissing value.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Requirement FILLTYPE= ALTERNATE must set for this option to have any
effect.
Interaction For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
To make all block fill areas the same color, set the FILLATTRS= and
ALTFILLATTRS= options to the same value.
294 Chapter 6 • Plot Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
FILLTYPE=MULTICOLOR | ALTERNATE
specifies how the blocks are filled.
MULTICOLOR
fills the blocks with the color specified by the COLOR attribute of the style
elements GraphData1–GraphDataN and GraphMissing (for missing BLOCK=
values), or the style elements indicated by the BLOCKINDEX= column.
ALTERNATE
alternates the block fill between the colors specified by the FILLATTRS= and
ALTFILLATTRS= options.
Default MULTICOLOR
Interactions For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
When this option is set to ALTERNATE, the block plot does not
support a DISCRETELEGEND entry.
INCLUDEMISSINGCLASS=TRUE | FALSE
specifies whether missing values in the class column are included in the plot.
Missing class values are included by default. When the data contains missing class
values, the label for those values is either blank for missing character values or a dot
for missing numeric values.
The following figure shows block plots for classes Class 1, Class 2, and any missing
class values.
Notice that the label for the missing class values is blank. You can use the
INCLUDEMISSINGCLASS=FALSE option to exclude the missing class values. If
you want to keep the missing class values, then you can create a format that specifies
a more meaningful label for the missing class. For example, here is a format that
specifies a label for missing character and numeric class values.
proc format;
value $missingClass " " = "(Missing)";
value missingClass . = "(Missing)";
run;
BLOCKPLOT Statement 295
A single space enclosed in quotation marks specifies a missing character value and a
dot specifies a missing numeric value. Although it might seem appropriate to use
empty quotation marks ('' or "") to specify a missing character value, doing so
produces unexpected results. To specify a missing character value, enclose a single
space in quotation marks (' ' or " "). You can use this format for the class columns in
the PROC SGRENDER statement. In that case, if the class columns contain missing
values, then the labels specified in the format statement are used for the missing
classes.
The following figure shows the previous example when format $missingClass is
applied to the class variable.
Note: In the second maintenance release of SAS 9.4 and in earlier releases, ODS
Graphics does not support Unicode values in user-defined formats. Starting with
the third maintenance release of SAS 9.4, ODS Graphics supports Unicode
values in user-defined formats only if they are preceded by the (*ESC*) escape
sequence. Example: "(*ESC*){unicode beta}". ODS Graphics does not
support an escape character that is defined in an ODS ESCAPECHAR statement
in user-defined formats.
Default TRUE
Interaction The CLASS= option must be specified for this option to have any
effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABEL="string"
specifies an external label for a single block plot.
The DISPLAY= option must include LABEL for any external label(s)
to appear.
Tip The font and color attributes for the external label are specified by the
LABELATTRS= option.
Interaction If one or more text options are specified and they do not include all of
the font properties such as color, family, size, weight, style, then the
non-specified properties are derived from the GraphLabelText style
element.
296 Chapter 6 • Plot Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default LEFT
NAME="string"
assigns a name to this plot statement for reference in other template statements. This
option is used mostly in the DISCRETELEGEND statement in order to coordinate
the use of colors and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interactions For this option to have any effect, the outlines must be enabled by the
ODS style or the DISPLAY= option.
If labels are displayed in the TOP or BOTTOM position, then they are
also outlined.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
REPEATEDVALUES=TRUE | FALSE
specifies whether contiguous block values that are identical create separate blocks.
FALSE
creates only one block when two or more identical block values appear
consecutively.
TRUE
creates one block for each identical value when two or more identical values
appear consecutively.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
BLOCKPLOT Statement 297
Interaction If one or more text options are specified and they do not include all of
the font properties such as color, family, size, weight, style, then the
non-specified properties are derived from the GraphValueText style
element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
SPLITALWAYS
splits each value at every occurrence of a split character. If the value does not
contain any of the specified split characters, then a split does not occur.
TRUNCATE
truncates any value that does not fit. For a numeric column, an asterisk (*) is
substituted for the entire value whenever truncation occurs. For a character
column, the truncated portion of the text is replaced by an ellipsis (...).
Default TRUNCATE
Interaction The SPLIT and SPLITALWAYS policies are ignored when the
BLOCKPLOT statement is placed in a DATALATTICE or
DATAPANEL layout and the BLOCKPLOT CLASS= option is set. In
that case, the TRUNCATE fit policy is used instead.
LEFT
left-aligned within the block
CENTER
center-aligned within the block
RIGHT
right-aligned within the block
START
center-aligned at the starting value of the block
Default LEFT
Requirement For this option to have any effect, the DISPLAY= option must
include VALUE.
VALUESPLITCHAR="character-list"
specifies one or more characters on which the values can be split, if needed. When
multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
value. In that case, all of the specified split characters together are treated as a single
split character.
When VALUESPLITPOLICY=SPLIT, if a value collision is detected, then the value
is split at each occurrence of any of the specified split characters. When
VALUESPLITPOLICY=SPLITALWAYS, the value is split unconditionally on each
of the specified split characters. If the value does not contain any of the specified
split characters, then the value is not split.
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
VALUESPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed values.
TRUE
drops a split character from the value when a split occurs at that character. Split
characters at which a split does not occur are left in place. The
VALUEFITPOLICY= option determines where the values are split. When
VALUEFITPOLICY=SPLIT, each value is split at a split character only where a
split is needed in order to make the value fit the available space. At each split
point, the split character is dropped, and the characters that follow the split
character, up to but not including the split character at the next split point, are
wrapped to the following line.
When VALUEFITPOLICY=SPLITALWAYS, each value is split at every
instance of a split character. All of the split characters are dropped. The
characters that follow each split character, up to but not including the next split
character, are wrapped to the next line.
The following figure shows how value Product*Group*1 is split when the
VALUESPLITCHARDROP=TRUE, VALUESPLITCHAR="*", and
VALUEHALIGN=CENTER options are specified with the SPLIT and
SPLITALWAYS fit policies.
Default TRUE. A split character is dropped from the value display when a
split occurs at that character.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default CENTER
Interaction For this option to have any effect, the DISPLAY= option must include
VALUE.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Example 1: BlockPlot Overlaid with SeriesPlot 301
Details
A block plot contains information about X locations and text values to be associated
with corresponding intervals along the X axis. There is no Y axis information in this
plot.
Examples
Example Output
Example Program
data MSevents;
input Date date9. Release $5.;
label Release="Windows Release";
datalines;
01jun1990 3.0
01sep1995 95
01jul1998 98
01mar2000 2000
01nov2001 XP
;
302 Chapter 6 • Plot Statements
data events;
merge MSstock MSevents;
by date;
run;
proc template;
define statgraph blockplot1;
begingraph;
entrytitle "Microsoft Share Prices";
entrytitle "and Significant OS Releases";
layout overlay;
blockplot x=date block=release /
datatransparency=0.3 valuevalign=top
labelposition=top display=(fill values label)
extendblockonmissing=true ;
seriesplot x=date y=close;
endlayout;
endgraph;
end;
run;
Program Description
Prepare the data. To prepare data for the graph, “event” information must be added to
the existing data for stock prices. Here is the SAS code that generates the data for this
example. Notice that the first DATA step creates a Release column. That column is later
specified on the BLOCK= argument to display text values on the wall of the block plot.
For more information about the merged input data, see “About the Merged Data” on
page 303.
data MSevents;
input Date date9. Release $5.;
label Release="Windows Release";
datalines;
01jun1990 3.0
01sep1995 95
01jul1998 98
01mar2000 2000
01nov2001 XP
;
run;
data events;
merge MSstock MSevents;
by date;
run;
Define the template. In the GTL template code, BLOCK=RELEASE is specified in the
BLOCKPLOT statement so that the RELEASE values are displayed on the wall of the
resulting block plot. In this template, the BLOCKPLOT statement sets
EXTENDBLOCKONMISSING= TRUE so that missing values in the data revert to the
previous nonmissing value in the block plot. Thus, in the block plot, values are missing
until 01JUN90, when the value changes from missing to 3.0. The block plot retains that
3.0 value for subsequent observations until the next nonmissing value replaces it (in
this case, the value95 on 01SEP95). In the example output shown in “Example Output”
on page 301, the fill color for each of the nonmissing values is determined by the style
elements GraphData1–GraphData5 in this case. The fill color for the missing values is
determined by the next available GraphDataN style element, which is GraphData6 in this
case.
proc template;
define statgraph blockplot1;
begingraph;
entrytitle "Microsoft Share Prices";
entrytitle "and Significant OS Releases";
layout overlay;
blockplot x=date block=release /
datatransparency=0.3 valuevalign=top
labelposition=top display=(fill values label)
extendblockonmissing=true ;
seriesplot x=date y=close;
endlayout;
endgraph;
end;
run;
Generate the graph. Format the date values on the X axis as four-digit year values, and
label the X axis “Year.”
proc sgrender data=events template=blockplot1;
format date year4.;
label date="Year";
run;
Example Output
Example Program
In this example, the lattice ROWWEIGHTS=(0.04 0.96) option apportions 4% of the
vertical space to the block plot. Here is the code for this example.
proc template;
define statgraph blockplot2;
begingraph;
entrytitle "Microsoft Share Prices";
entrytitle "and Significant OS Releases";
layout lattice / rowweights=(0.04 0.96);
blockplot x=date block=release / datatransparency=0.3
valuefitpolicy=shrink labelposition=left
display=(fill label outline values)
extendblockonmissing=true;
seriesplot x=date y=close;
endlayout;
endgraph;
end;
BOXPLOT Statement 305
run;
BOXPLOT Statement
Creates box plots that are computed from input data.
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Syntax
BOXPLOT Y=numeric-column | expression </option(s)>;
BOXPLOT X=column | expression
Y=numeric-column | expression </option(s)>;
Appearance options
BOXWIDTH=number
specifies the width of a box as a ratio of the maximum possible width.
CAPSHAPE=SERIF | LINE | BRACKET | NONE
specifies the shape at the ends of the whiskers.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing
or bin width.
CONNECT=MEAN | MEDIAN | Q1 | Q3 | MIN | MAX
specifies that a connect line joins a statistic from box to box.
CONNECTATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the lines connecting multiple boxes.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled boxes.
DATATRANSPARENCY=number
specifies the degree of the transparency of the box outlines, box fill,
whiskers, mean, median, caps, connect lines, outliers, and data labels, if
displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies which additional features of the box plot to display.
EXTREME=TRUE | FALSE
specifies whether the whiskers can extend beyond the fences.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the boxes.
306 Chapter 6 • Plot Statements
INDEX=positive-integer-column | expression
specifies indices for mapping box attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
INTERVALBOXWIDTH=AUTO | dimension
specifies the box width when an interval category (X) column is specified.
MEANATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the attributes of the marker representing the mean within the box.
MEDIANATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the line representing the median within the box.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and of the boxes.
OUTLIERATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the attributes of the markers representing the outliers.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the box outline.
SPREAD=TRUE | FALSE
specifies whether outliers with the same value are spread out to avoid
overlap.
WHISKERATTRS=style-element | style-element (line-options) | (line-options)
specifies the line properties of the whiskers and caps.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABEL=column
specifies the labels of the outliers. Either a numeric or a character column can
be used.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the outlier labels.
DATALABELSPLIT=TRUE | FALSE
BOXPLOT Statement 307
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LABELFAR=TRUE | FALSE
specifies whether all outliers or only far outliers are labeled.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all boxes from the discrete X ticks.
GROUP=column | discrete-attr-var | expression
creates a box plot for each unique group value of the specified column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how to display the boxes that represent group values for the
coordinate pairs.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Statistics options
DISPLAYSTATS=NONE | STANDARD | ALL | (statistics-list)
specifies the statistics to be displayed for each box.
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation
that is read.
PERCENTILE=1 | 2 | 3 | 4 | 5
specifies one of five definitions used to calculate percentiles.
WEIGHT=numeric-column | expression
specifies a column that contains a statistics calculation a priori weight for
each observation of the input data object.
WHISKERPERCENTILE=number
specifies the whisker length, in percentile units.
Required Arguments
Specifying only Y= creates a single box plot. Specifying both X= and Y= creates a box
plot for each unique value of X.
Y=numeric-column | expression
specifies the column for the Y values. This argument is required.
308 Chapter 6 • Plot Statements
X=column | expression
specifies the column for the X values. This argument is required if you want to create
a box plot for each unique X value.
Note For interval X values, if a user-defined format is applied to the X column, the
format should map each X value to only one unique formatted value.
Otherwise, unexpected results might occur.
Optional Arguments
BOXWIDTH=number
specifies the width of a box as a ratio of the maximum possible width.
Interactions For grouped box plots with a discrete X (category) axis, the box width
is a percentage of the CLUSTERWIDTH .
Interactions The cap color and the thickness are specified by the
WHISKERATTRS= option. The cap pattern is always solid.
The DISPLAY= option must include CAPS in order for cap lines to be
shown.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing or bin
width.
Default 0.7
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Requirement For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
Note When the X axis is an interval axis, the cluster width is a fraction of
the smallest data interval.
Interaction This option applies only when the X= argument is used to generate
multiple boxes.
Note Starting with the third maintenance release of SAS 9.4, the connect
lines are drawn in axis order. In prior releases, they are drawn in data
order.
310 Chapter 6 • Plot Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DATALABEL=column
specifies the labels of the outliers. Either a numeric or a character column can be
used.
If one or more label options are specified and they do not include all
the font properties (color, family, size, weight, style), then the non-
specified properties are derived from the GraphDataText style
element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters. When set to
TRUE, the data label is split unconditionally at each occurrence of any of the
specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
BOXPLOT Statement 311
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
312 Chapter 6 • Plot Statements
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the box outlines, box fill, whiskers, mean,
median, caps, connect lines, outliers, and data labels, if displayed.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the
interior fill area of the boxes. You can combine this option with
FILLATTRS= to set one transparency for the box outlines and the
whiskers, mean, median, caps, and connect lines, but a different
transparency for the box fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
DISCRETEOFFSET=number
specifies an amount to offset all boxes from the discrete X ticks.
Default 0 (no offset, all boxes are centered on the discrete ticks)
Range -0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right when ORIENT=VERTICAL, and
up when ORIENT=HORIZONTAL. (If the layout's axis options set
REVERSE=TRUE, then the offset direction is also reversed.)
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
In the equation, IQR (IQR=Q3-Q1) is the interquartile range and n is the sample size.
The medians (central lines) of the two boxes are significantly different at
approximately the 0.05 level if the corresponding notches do not overlap.
Notes Starting with the third maintenance release of SAS 9.4, connect lines
are drawn in axis order. They are drawn in data order in prior releases.
DATAMAX maximum data value that includes not only the maximum
whisker values but also the maximum outlier values. This
option is valid in the first maintenance release of SAS 9.4 and
later releases. The DATAMAX value is greater than or equal
to the MAX value and is always represented in the axis
range.
DATAMIN minimum data value that includes not only the minimum
whisker values but also the minimum outlier values. This
option is valid in the first maintenance release of SAS 9.4 and
later releases. The DATAMIN value is less than or equal to
the MIN value and is always represented in the axis range.
IQR interquartile range (Q3–Q1).
MAX maximum data value below the box upper fence.
MEAN mean data value for the box.
MEDIAN median data value for the box.
MIN minimum data value above the box lower fence.
N number of observations for the box.
Q1 lower quartile (25th percentile) for the box.
Q3 upper quartile (75th percentile) for the box.
RANGE range of the data (MAX–MIN).
316 Chapter 6 • Plot Statements
Default NONE
Note The notches in the box plot can extend beyond DATAMIN and
DATAMAX in some cases.
EXTREME=TRUE | FALSE
specifies whether the whiskers can extend beyond the fences. Fences are locations
above and below the box. The upper and lower fences are located at a distance 1.5
times the Interquartile Range (IQR) (IQR = Q3 - Q1). The upper and lower far
fences are located at a distance 3 times the IQR .
FALSE
specifies that whiskers be drawn from the upper edge of the box to the largest
value within the upper fence, and from the lower edge of the box to the smallest
value within the lower fence. This representation is sometime called a schematic
box plot or a Tukey box plot.
TRUE
specifies that whiskers be drawn to the largest and smallest data values, whether
these values are inside or outside the fences. The outliers and far outliers are not
displayed and are not labeled. This representation is sometime called a skeletal
box and whisker plot.
Default FALSE
“boolean ” on page 1339 for other Boolean values that you can use.
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
Tip The DATATRANSPARENCY option sets the transparency for the box
outlines, box fill, whiskers, mean, median, caps, connect lines, and
outliers. You can combine this option with DATATRANSPARENCY=
to set one transparency for the box outlines and the whiskers, mean,
median, caps, and connect lines, but a different transparency for the box
fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
BOXPLOT Statement 317
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation that is
read.
Restriction If the value of the numeric-column is missing or is less than 1, then the
observation is not used in the analysis. If the value is not an integer,
then only the integer portion is used.
Note If n is the value of the numeric column for a given observation, then
that observation is used n times for the purposes of any statistical
computation.
For example, the Sashelp.Cars data that is used in the “Example Program” on page
336 contains a column named Origin, which identifies the region that produces each
car. This column could be used in the BOXPLOT statement to group the box plots in
the display (see the GROUPDISPLAY= option to see the output for the grouped
boxes):
layout overlay / xaxisopts=(display=(line ticks tickvalues));
boxplot y=mpg_city x=cylinders / name="b"
datalabel=make spread=true
display=(caps fill mean median)
group=origin ;
discretelegend "b" / title="Vehicle Type: ";
endlayout;
Defaults Each distinct group value is represented in the plot by a different box
outline color. The outline colors are defined by the
GraphData1:ContrastColor–GraphDataN:ContrastColor style
references.
If box fills are enabled by the ODS style or by the DISPLAY= option,
then each distinct group value is represented in the plot by a different
fill color. The fill colors are defined by the Color attribute of the
GraphData1–GraphDataN and GraphMissing style elements.
By default, the group values are mapped in the order of the data. The
GROUPORDER= option can be used to control the sorting order of
the group values. The INDEX= option can be used to alter the default
sequence of colors and markers.
Tip The representations that are used to identify the groups can be
overridden individually. For example, each distinct group value is
represented by a different line pattern for the box outlines, but the
PATTERN= setting in the OUTLIERATTRS= option could be used to
assign the same line pattern to all box outlines and connect lines.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how to display the boxes that represent group values for the coordinate
pairs. The following example shows a box plot with GROUPDISPLAY=CLUSTER:
OVERLAY
draws boxes for a given group value at the exact coordinate. Depending on the
data, boxes at a given coordinate might overlap.
CLUSTER
draws boxes for a given group value adjacent to each other.
BOXPLOT Statement 319
Default OVERLAY
Tip Use the CLUSTERWIDTH= option to control the width of the clusters
when CLUSTER is in effect.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
320 Chapter 6 • Plot Statements
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping box attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
INTERVALBOXWIDTH=AUTO | dimension
specifies the box width when an interval category (X) column is specified.
AUTO
prior to the third maintenance release of SAS 9.4, AUTO uses 85% of the
smallest interval between any two boxes for the given plot. Starting with the third
maintenance release of SAS 9.4, AUTO uses the BOXWIDTH= option setting.
dimension
sets the box width to the specified value.
Default AUTO
Restriction The axis type for the category axis (X by default) must be LINEAR,
and the X column must be numeric.
Interaction Prior to the third maintenance release of SAS 9.4, this option controls
the box width for an interval box plot. Starting with the third
maintenance release of SAS 9.4, this option overrides the
BOXWIDTH= option for an interval box plot.
LABELFAR=TRUE | FALSE
specifies whether all outliers or only far outliers are labeled.
BOXPLOT Statement 321
FALSE
applies the labels specified by the DATALABEL= option to both the outliers and
the far outliers.
TRUE
applies the labels specified by the DATALABEL= option to the far outliers.
Default FALSE
“boolean ” on page 1339 for other Boolean values that you can use.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The Y= column label. If a label is not defined, then the Y= column
name is used.
Interaction This option is ignored if the DISPLAY= option does not display the
mean.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Interaction This option is ignored if the DISPLAY= option does not display the
median.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
322 Chapter 6 • Plot Statements
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and of the boxes.
Default VERTICAL
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
OUTLIERTIP=(role-list)
specifies the information to display when the cursor is positioned over an outlier. If
this option is used, then it replaces all of the information that is displayed by default.
Roles for columns that do not contribute to the box plot can be specified along with
roles that do contribute.
(role-list)
an ordered, space-separated list of unique BOXPLOT roles. BOXPLOT roles for
OUTLIERTIP include X, Y, STAT, and DATALABEL.
Note In the data tip, the STAT role displays the text “outlier” or “far
outlier” as applicable.
Example The following example displays data tips only for the column that is
assigned to the X role:
OUTLIERTIP=(X)
Default The columns assigned to these roles are automatically included in the
data tip information: X and Y .
Interaction The labels and formats for the OUTLIERTIP variables can be
controlled with the TIPLABEL= and TIPFORMAT= options.
See the TIP= option for specifying the information to display when the
cursor is positioned over a box or whisker in the box plot.
For grouped data and filled boxes, the LineStyle and LineThickness
attributes of the GraphOutlines style element, and the ContrastColor
attribute of the GraphData1–GraphDataN style elements.
For grouped data and unfilled boxes, the LineThickness attribute of the
GraphOutlines style element, and the ContrastColor and LineStyle
attributes of the GraphData1–GraphDataN style elements.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PERCENTILE=1 | 2 | 3 | 4 | 5
specifies one of five definitions used to calculate percentiles.
Note The percentile definition and default are the same as those that are used by
the PCTLDEF= option of the UNIVARIATE procedure and the
QNTLDEF= option of the SUMMARY procedure.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
324 Chapter 6 • Plot Statements
SPREAD=TRUE | FALSE
specifies whether outliers with the same value are spread out to avoid overlap. For
vertical box plots this means offsetting the outliers horizontally. If this option is
false, then outliers with the same value are plotted in the same position, which means
only one is visible.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a box or
whisker in the box plot. If this option is used, then it replaces all of the information
that is displayed by default.
(role-list)
an ordered, space-separated list of unique BOXPLOT roles. BOXPLOT roles for
TIP include DATAMAX, DATAMIN, MAX, MIN, MEAN, MEDIAN, N, Q1,
Q2, STD, SUMWGT, and X.
Note The roles DATAMAX, DATAMIN, and SUMWGT apply to the first
maintenance release of SAS 9.4 and later releases.
Tip Statistics such as N, MIN, and MAX are special roles, They are not
column-based like the X role.
Example The following example displays data tips only for the columns that
are assigned to the roles X (CATEGORY) and the statistic MEAN:
TIP=(X MEAN)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X, N, STD, MIN, MAX, Q1, Q3, MEAN, and
MEDIAN.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIP=(X Y)
TIPFORMAT=(X=4. Y=4.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the OUTLIERTIP= or TIP= options are
used.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIP=(X)
TIPLABEL=(X="Type")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the OUTLIERTIP= or TIP= options are
used.
WEIGHT=numeric-column | expression
specifies a column that contains a statistics calculation a priori weight for each
observation of the input data object.
Interaction If the value for an observation is missing or is less than 1, then the
observation is removed from the analysis.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
326 Chapter 6 • Plot Statements
WHISKERPERCENTILE=number
specifies the whisker length, in percentile units. When this option is specified,
number is used as the low percentile, and 100–number is used as the high percentile.
Here are some examples of values and their effect:
Default The whiskers are drawn from the box to the most extreme point that is less
than or equal to 1.5 times the IQR
Range 0–25
Notes When this option is specified, fences and far outliers are not drawn.
When this option is set to 25, no whiskers are drawn because the box
extends from the 25th to the 75th percentile.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
Statement Summary
The BOXPLOT statement displays a single box if given just a Y argument. It displays
multiple boxes if given both Y and X arguments and X has more than one unique value.
By default for numeric or character columns, the category (X) axis is
TYPE=DISCRETE. You can override the default and set the TYPE= to LINEAR or
TIME in the parent layout, provided that the X column is numeric. The axis for the
analysis (Y) column is always LINEAR. When the X axis is LINEAR, you must use the
INTERVALBOXWIDTH= option to specify the box width.
BOXPLOT Statement 327
When ORIENT= VERTICAL, the X (or X2) axis is used for the X column and the Y (or
Y2) axis is used for the Y column. When ORIENT=HORIZONTAL, the X (or X2) axis
is used for the Y column and the Y (or Y2) axis is used for the X column.
Two basic box plot representations can be drawn with the BOXPLOT statement: a
schematic (Tukey) box plot and a skeletal box plot. See the EXTREME= option for
details.
The following figure illustrates the box plot elements:
As shown in the figure, the bottom and top edges of the box are located at the 25th and
75th percentiles of the sample. Within the box, you can display the median (50th
percentile) as a line and the mean as a marker (see DISPLAY= option).
You can also display markers and data labels for outliers. Outliers are observations that
are more extreme than the upper and lower fences (± 1.5 IQR). Outliers that are beyond
upper and lower far fences (± 3 IQR) are called FAR OUTLIERS and can also be
identified and labeled. From a graphical perspective, the location of fences along the axis
are known, but there is no line or marker that displays a fence. (See DISPLAY= ,
LABELFAR= , and DATALABEL= options).
Finally, you can control the range represented by the whiskers. By default, the whiskers
are drawn from the upper edge of the box to the MAX value, and from the lower edge of
the box to the MIN value. (See the EXTREME= option.)
To place the different response values side by side, you can assign a different offset to
each BOXPLOT statement. The BOXWIDTH= option can be used in conjunction with
the DISCRETEOFFSET= option to create narrower boxes when desired.
layout overlay / cycleattrs=true
yaxisopts=(label="Miles Per Gallon");
boxplot x=type y=mpg_city / name="City"
discreteoffset=0.2 legendlabel="City";
boxplot x=type y=mpg_highway / name="Highway"
discreteoffset=-0.2 legendlabel="Highway";
discretelegend "City" "Highway";
endlayout;
BOXPLOT Statement 329
Calculating Percentiles
You can specify one of five definitions for computing the percentiles with the
PERCENTILE= option. Let n be the number of nonmissing values for a variable, and let
X 1, X 2, ..., X n represent the ordered values of the variable. X 1 is the smallest value, X 2 is
the next smallest, and X n is the largest value. Let the tth percentile be y, set:
t
p = 100
and let:
np = j + g
when PERCENTILE=4, where j is the integer part of np, and g is the fractional part of
np. Then the PERCENTILE= option defines the tth percentile, y, as described in the
following table:
2 Observation numbered y = xj 1
Used when g < 2 or when
closest to np
1
g = 2 and j is even
y = xj + 1 1
Used when g = 2 and j is
1
odd or when g > 2
330 Chapter 6 • Plot Statements
The two display options that are not the default are CONNECT (show connect lines) and
NOTCHES.
The STATISTICAL style is derived from the DEFAULT style and inherits the GraphBox
element from the parent DEFAULT style. The following code generates a box plot for
the STATISTICAL style:
/* Specify a path for the ODS output */
filename odsout "output-path";
proc template;
define statgraph boxplotdef;
begingraph;
entrytitle "Statistical Style";
layout overlay / xaxisopts=(label="Age" type=linear);
boxplot x=ageatstart y=cholesterol / intervalboxwidth=40;
endlayout;
endgraph;
end;
For this example, we want to change the following attributes on the default box plot:
• By default, serif caps are displayed at the end of the fences. We want to remove those
caps from the fence lines.
• By default, the boxes are filled. We want to display empty, notched boxes.
• By default, the mean values are represented by hollow diamonds. We want to display
filled diamonds and slightly reduce their size.
• By default, the marker symbols for the outliers are hollow black circles. We want to
change the size and shape of the marker symbols, and again reduce their size.
To make these changes, we can derive a new style from the STATISTICAL style and set
the attributes that we want to change. Any attribute settings that we do not change are
inherited from the parent STATISTICAL style. The following style template effects the
desired changes:
proc template;
define style Boxplot;
parent = styles.statistical;
style GraphBox from GraphBox /
capstyle = "line"
displayopts = "caps median mean outliers notches";
style GraphBoxMean from GraphBoxMean /
markersymbol="diamondfilled"
contrastcolor=GraphColors("gcdata1")
markersize = 5px;
style GraphOutlier from GraphOutlier /
markersize = 5px
markersymbol = "x"
contrastcolor = GraphColors("gcdata2");
end;
run;
334 Chapter 6 • Plot Statements
proc template;
define statgraph boxplotdef;
begingraph;
entrytitle "Boxplot Style";
layout overlay / xaxisopts=(label="Age" type=linear);
boxplot x=ageatstart y=cholesterol / intervalboxwidth=40;
endlayout;
endgraph;
end;
When making such style changes remember that you are affecting all box plot displays
for all procedures that produce box plots when this style is in effect. It is possible to
change the box plot appearance for specific procedures, but to do this, a specific graph
template must be modified, not a style template.
For a comprehensive description of the style elements affecting ODS graphics, see
“Graph Style Elements Used by ODS Graphics” in SAS Graph Template Language:
User's Guide.
The following graph was generated by the “Example Program” on page 336:
336 Chapter 6 • Plot Statements
Example Program
proc template;
define statgraph boxplot;
begingraph;
entrytitle "City Mileage for Vehicle Types";
layout overlay
xaxisopts=(offsetmin=0.1 offsetmax=0.1);
boxplot y=mpg_city x=type /
datalabel=make spread=true;
endlayout;
endgraph;
end;
run;
BOXPLOTPARM Statement
Creates side-by-side box plots specified by parameters.
Requirements: The input data must be precomputed. See “Input Data Requirements for the
BOXPLOTPARM Statement” on page 362.
Nonmissing Y values for statistical observations of Q1 and Q3 are required for a box
to be drawn.
The statistical values, if present, must conform to the following rules for a box to be
displayed:
Q1 <= MEDIAN <= Q3
BOXPLOTPARM Statement 337
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Syntax
BOXPLOTPARM Y=numeric-column | expression
STAT=string-column </option(s)>;
BOXPLOTPARM X=column | expression
Y=numeric-column | expression
STAT=string-column </option(s)>;
Appearance options
BOXWIDTH=number
specifies the width of a box as a ratio of the maximum possible width.
CAPSHAPE=SERIF | LINE | BRACKET | NONE
specifies the shape at the ends of the whiskers.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing
or bin width.
CONNECT=MEAN | MEDIAN | Q1 | Q3 | MIN | MAX
specifies that a connect line joins a statistic from box to box.
CONNECTATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the lines connecting multiple boxes.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled boxes.
DATATRANSPARENCY=number
specifies the degree of the transparency of the box outlines, box fill,
whiskers, mean, median, caps, connect lines, outliers, and data labels, if
displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies which additional features of the box plot to display.
EXTREME=TRUE | FALSE
specifies whether the whiskers can extend beyond the fences.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the boxes.
INDEX=positive-integer-column | expression
specifies indices for mapping box attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
INTERVALBOXWIDTH=AUTO | dimension
specifies the box width when an interval category (X) column is specified.
338 Chapter 6 • Plot Statements
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABEL=column
specifies the labels of the values that are identified as outlier or far outlier by
the STAT= column.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the outlier labels.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
BOXPLOTPARM Statement 339
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LABELFAR=TRUE | FALSE
specifies whether all outliers or only far outliers are labeled.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all boxes from the discrete X ticks.
GROUP=column | discrete-attr-var | expression
creates a box plot for each unique group value of the specified column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how to display the boxes that represent group values for the
coordinate pairs.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page that is displayed when a box or an outlier marker is
selected.
Statistics options
DISPLAYSTATS=NONE | STANDARD | ALL | (statistics-list)
specifies the statistics to be displayed for each box.
Required Arguments
Specifying only Y= creates a single box plot. Specifying both X= and Y= creates a box
plot for each unique value of X.
Y=numeric-column | expression
specifies the column for the Y values. The Y values must be the statistical values
needed for the box plot. At a minimum, there must be nonmissing values for the 25th
and 75th percentiles.
X=column | expression
specifies the column for the X values. The X values must qualify or classify the
values in the Y column. This optional argument is used to create a plot box for each
classifier.
340 Chapter 6 • Plot Statements
Restriction When you specify a numeric column for the X= argument and the
category axis is an interval axis, you should not change the column
value format. Doing so might result in incorrect output.
STAT=string-column
specifies the statistic that is represented by the value in the Y column. Valid STAT=
column values include the following (see the requirements listed at the end of this
description):
BOXWIDTH
specifies the width of the boxes as a ratio of the maximum possible width. The
range of values is 0 (narrowest) to 1 (widest). The default is 0.4. If the Y value
corresponding to BOXWIDTH is in range, then it overrides the setting that is
specified in the BOXWIDTH= option.
DATAMAX
specifies the maximum data value that includes not only the maximum whisker
values but the maximum outlier values as well. The DATAMAX value is greater
than or equal to the MAX value and is always represented in the axis range.
Note This statistic is valid in the first maintenance release of SAS 9.4 and later
releases.
DATAMIN
specifies the minimum data value that includes not only the minimum whisker
values but the minimum outlier values as well. The DATAMIN value is less than
or equal to the MIN value and is always represented in the axis range.
Note This statistic is valid in the first maintenance release of SAS 9.4 and later
releases.
FAROUTLIER
specifies the observations that are outside the lower and upper far fences. The far
fences are located at a distance 3 times the Interquartile Range (IQR = Q3–Q1)
above and below the box. The far outliers are labeled when the DATALABEL=
option is used. Specify that LABELFAR= TRUE to label only the far outliers but
not the outliers.
MAX
specifies the maximum data value less than or equal to the upper fence.
MEAN
specifies the data mean.
MEDIAN
specifies the data median.
MIN
specifies the minimum data value greater than or equal to the lower fence.
N
specifies the subgroup sample size. The N value is not shown in the plot but is
used to calculate notch locations when the DISPLAY= option displays notches.
OUTLIER
specifies the observations that are outside the lower and upper fences. The fences
are located at a distance 1.5 times the Interquartile Range (IQR = Q3–Q1) above
and below the box. The outliers are labeled when the DATALABEL= option is
used.
BOXPLOTPARM Statement 341
Q1
specifies the 1st quartile (25th percentile). The data must contain a nonmissing
value for this quartile.
Q3
specifies the 3rd quartile (75th percentile). The data must contain a nonmissing
value for this quartile.
STD
specifies the data standard deviation.
SUMWGT
specifies the sum of the weights for the box.
Note This statistic is valid in the first maintenance release of SAS 9.4 and later
releases.
The STAT values, if present, must conform to the following rules for
a box to be displayed:
Q1 <= MEDIAN <= Q3
MIN <= MAX
STD >= 0
N > 0
Optional Arguments
BOXWIDTH=number
specifies the width of a box as a ratio of the maximum possible width.
Interactions For grouped box plots with a discrete X (category) axis, the box width
is a percentage of the CLUSTERWIDTH .
LINE
specifies a line perpendicular to the whisker that extends the width of the box.
BRACKET
specifies a line perpendicular to the whiskers that extends the width of the box
and that has short extensions at each end. The extensions are drawn in the
direction of the box.
NONE
specifies that no shape appears at the ends of the whiskers.
The following figure shows each of the shapes.
Interactions The cap color and the thickness are specified by the
WHISKERATTRS= option. The cap pattern is always solid.
The DISPLAY= option must include CAPS in order for cap lines to be
shown.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing or bin
width.
Default 0.7
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
BOXPLOTPARM Statement 343
Requirement For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
Interaction This option applies only when the X= argument is used to generate
multiple boxes.
Note Starting with the third maintenance release of SAS 9.4, the connect
lines are drawn in axis order. In prior releases, they are drawn in data
order.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DATALABEL=column
specifies the labels of the values that are identified as outlier or far outlier by the
STAT= column. Either a numeric or a character column can be used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters. When set to
TRUE, the data label is split unconditionally at each occurrence of any of the
specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
BOXPLOTPARM Statement 345
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the box outlines, box fill, whiskers, mean,
median, caps, connect lines, outliers, and data labels, if displayed.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the
interior fill area of the boxes. You can combine this option with
FILLATTRS= to set one transparency for the box outlines and the
whiskers, mean, median, caps, and connect lines, but a different
transparency for the box fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
BOXPLOTPARM Statement 347
DISCRETEOFFSET=number
specifies an amount to offset all boxes from the discrete X ticks.
Default 0 (no offset, all boxes are centered on the discrete ticks)
Range -0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right when ORIENT=VERTICAL, and
up when ORIENT=HORIZONTAL. (If the layout's axis options set
REVERSE=TRUE, then the offset direction is also reversed.)
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
In the equation, IQR is the interquartile range and n is the sample size.
348 Chapter 6 • Plot Statements
Restriction The display features requested can be displayed only if the input data
includes this information.
Notes Starting with the third maintenance release of SAS 9.4, the connect
lines are drawn in axis order. They are drawn in data order in prior
releases.
(statistics-list)
a space-separated list of one or more of the following statistics, enclosed in
parentheses:
DATAMAX maximum data value that includes not only the maximum
whisker values but also the maximum outlier values. This
option is valid in the first maintenance release of SAS 9.4 and
later releases. The DATAMAX value is greater than or equal
to the MAX value and is always represented in the axis
range.
DATAMIN minimum data value that includes not only the minimum
whisker values but also the minimum outlier values. This
option is valid in the first maintenance release of SAS 9.4 and
later releases. The DATAMIN value is less than or equal to
the MIN value and is always represented in the axis range.
IQR interquartile range (Q3–Q1).
MAX maximum data value below the box upper fence.
MEAN mean data value for the box.
MEDIAN median data value for the box.
MIN minimum data value above the box lower fence.
N number of observations for the box.
Q1 lower quartile (25th percentile) for the box.
Q3 upper quartile (75th percentile) for the box.
RANGE range of the data (MAX–MIN).
STD standard deviation of the data for the box.
SUMWGT sum of the weights for the box. This option is valid in the
first maintenance release of SAS 9.4 and later releases.
Default NONE
Only those statistics that are included in the STAT= column can be
displayed. RANGE requires both MAX and MIN to be included. IQR
requires both Q1 and Q3 to be included.
Note The notches in the box plot can extend beyond DATAMIN and
DATAMAX in some cases.
EXTREME=TRUE | FALSE
specifies whether the whiskers can extend beyond the fences. Fences are locations
above and below the box. The upper and lower fences are located at a distance 1.5
times the Interquartile Range (IQR) (IQR = Q3 - Q1). The upper and lower far
fences are located at a distance 3 times the IQR .
FALSE
specifies that whiskers be drawn from the upper edge of the box to the largest
value within the upper fence, and from the lower edge of the box to the smallest
value within the lower fence. This representation is sometime called a schematic
box plot or a Tukey box plot.
350 Chapter 6 • Plot Statements
TRUE
specifies that whiskers be drawn to the largest and smallest data values, whether
these values are inside or outside the fences. The outliers and far outliers are not
displayed and are not labeled. This representation is sometime called a skeletal
box and whisker plot.
Default FALSE
“boolean ” on page 1339 for other Boolean values that you can use.
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
Tip The DATATRANSPARENCY= option sets the transparency for the box
outlines, box fill, whiskers, mean, median, caps, connect lines, and
outliers. You can combine this option with DATATRANSPARENCY=
to set one transparency for the box outlines and the whiskers, mean,
median, caps, and connect lines, but a different transparency for the box
fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
The box plot display depends on the setting for the GROUPDISPLAY= option. This
option can be used to group the box plots in the display.
Defaults Each distinct group value is represented in the plot by a different box
outline color. The outline colors are defined by the ContrastColor
attribute of the GraphData1–GraphDataN and GraphMissing style
elements.
BOXPLOTPARM Statement 351
If box fills are enabled by the ODS style or by the DISPLAY= option,
then each distinct group value is represented in the plot by a different
fill color. The fill colors are defined by the Color attribute of the
GraphData1–GraphDataN and GraphMissing style references.
Tips By default, the group values are mapped in the order of the data. The
GROUPORDER= option can be used to control the sorting order of
the group values. The INDEX= option can be used to alter the default
sequence of colors and markers.
See the GROUPDISPLAY= option to see the output for the grouped boxes
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how to display the boxes that represent group values for the coordinate
pairs. The following example shows a box plot with GROUPDISPLAY=CLUSTER:
352 Chapter 6 • Plot Statements
OVERLAY
draws boxes for a given group value at the exact coordinate. Depending on the
data, boxes at a given coordinate might overlap.
CLUSTER
draws boxes for a given group value adjacent to each other. This option is
available only when the category (X) column is discrete.
Default OVERLAY
The groups in the legend are shown in the order that is specified in
GROUPORDER by default.
Tip Use the CLUSTERWIDTH= option to control the width of the clusters
when CLUSTER is in effect.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
BOXPLOTPARM Statement 353
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping box attributes (fill and outline) to one of the
GraphData1–GranphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
354 Chapter 6 • Plot Statements
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
INTERVALBOXWIDTH=AUTO | dimension
specifies the box width when an interval category (X) column is specified.
AUTO
prior to the third maintenance release of SAS 9.4, AUTO uses 85% of the
smallest interval between any two boxes for the given plot. Starting with the third
maintenance release of SAS 9.4, AUTO uses the BOXWIDTH= option setting or
the Y value when STAT=BOXWIDTH and the corresponding Y value is in
range.
dimension
sets the box width to the specified value.
Default AUTO
Restriction The axis type for the category axis (X by default) must be LINEAR,
and the X column must be numeric.
Interactions Starting with the third maintenance release of SAS 9.4, this option is
overridden by the Y value when the STAT= column value is
BOXWIDTH and the corresponding Y value is in range.
Prior to the third maintenance release of SAS 9.4, this option controls
the box width for an interval box plot. Starting with the third
maintenance release of SAS 9.4, this option overrides the
BOXWIDTH= option for an interval box plot.
LABELFAR=TRUE | FALSE
specifies whether all outliers or only far outliers are labeled.
FALSE
applies the labels specified by the DATALABEL= option to both the outliers and
the far outliers.
TRUE
applies the labels specified by the DATALABEL= option to the far outliers.
Default FALSE
“boolean ” on page 1339 for other Boolean values that you can use.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
BOXPLOTPARM Statement 355
Default The Y= column label. If a label is not defined, then the Y= column
name is used.
Interaction This option is ignored if the DISPLAY= option does not display the
mean.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Interaction This option is ignored if the DISPLAY= option does not display the
median.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and of the boxes.
Default VERTICAL
356 Chapter 6 • Plot Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
OUTLIERTIP=(role-list)
specifies the information to display when the cursor is positioned over an outlier. If
this option is used, then it replaces all of the information that is displayed by default.
(role-list)
an ordered, space-separated list of unique BOXPLOTPARM roles and user-
defined roles. BOXPLOTPARM roles for OUTLIERTIP include X, Y, STAT, and
DATALABEL.
Note In the data tip, the STAT role displays the text “outlier” or “far
outlier” as applicable.
Example The following example displays data tips for the columns that are
assigned to the X and Y roles, and also the data column Obs, which is
not assigned to any pre-defined BOXPLOTPARM role. The Obs
column must first be assigned a role:
ROLENAME=(TIP1=OBS)
OUTLIERTIP=(X Y TIP1)
Default The columns assigned to these roles are automatically included in the
data tip information: X and Y .
Interaction The labels and formats for the OUTLIERTIP variables can be
controlled with the TIPLABEL= and TIPFORMAT= options.
the TIP= option for specifying the information to display when the
cursor is positioned over a box or whisker in the box plot.
For grouped data and filled boxes, the LineStyle and LineThickness
attributes of the GraphOutlines style element, and the ContrastColor
attribute of the GraphData1–GraphDataN style elements.
For grouped data and unfilled boxes, the LineThickness attribute of the
GraphOutlines style element, and the ContrastColor and LineStyle
attributes of the GraphData1–GraphDataN style elements.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the OUTLIERTIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles DATAMAX, DATAMIN, MAX, MIN, MEAN,
MEDIAN, N, Q1, Q2, STD, SUMWGT, and X.
Note The roles DATAMAX, DATAMIN, and SUMWGT are valid in the
first maintenance release of SAS 9.4 and later releases.
SPREAD=TRUE | FALSE
specifies whether outliers with the same value are spread out to avoid overlap. For
vertical box plots this means offsetting the outliers horizontally. If this option is
358 Chapter 6 • Plot Statements
false, then outliers with the same value are plotted in the same position, which means
only one is visible.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a box or
whisker in the box plot. If this option is used, then it replaces all of the information
that is displayed by default. Roles for columns that do not contribute to the box plot
can be specified along with roles that do contribute.
(role-list)
an ordered, space-separated list of unique BOXPLOTPARM roles.
BOXPLOTPARM roles for TIP include DATAMAX, DATAMIN, MAX, MIN,
MEAN, MEDIAN, N, Q1, Q2, STD, SUMWGT, and X.
Note The roles DATAMAX, DATAMIN, and SUMWGT are valid in the
first maintenance release of SAS 9.4 and later releases.
Tip Statistics such as N, MIN, and MAX are special roles, They are not
column-based like the X role.
Example The following example displays data tips only for the columns that
are assigned to the roles X (CATEGORY) and the statistic MEAN:
TIP=(X MEAN)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: DATAMAX, DATAMIN, MAX, MIN, MEAN,
MEDIAN, N, Q1, Q2, STD, SUMWGT, and X.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
BOXPLOTPARM Statement 359
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the OUTLIERTIP= or TIP= options are
used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the OUTLIERTIP= or TIP= options are
used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page that is displayed when a box or an outlier marker is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
box or outlier marker that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
The character column can specify different target URLs for each box and outlier
marker.
Requirements The target URLs for the boxes must be specified in the Q1 statistic
observations, and the target URLs for the outlier markers must be
specified in the OUTLIER statistic observations. URLs that are
specified in observations other than Q1 and OUTLIER are ignored.
360 Chapter 6 • Plot Statements
Tip The URL value can be blank for a box or outlier, meaning that no
action is taken when that box or outlier marker is selected.
Example The following vehicle mileage data sample shows box and outlier
URLs specified in column URL for Sedan.
STAT X VALUE DATALABEL URL
...
N Sedan 262.0
MEAN Sedan 08
MEDIAN Sedan 20.00
Q1 Sedan 18.00 ./mileageSedan.html
Q3 Sedan 24.00
STD Sedan 4.23
OUTLIER Sedan 36.00 Honda ./mileageHonda.html
OUTLIER Sedan 35.00 Toyota ./mileageToyota.html
OUTLIER Sedan 35.00 Toyota ./mileageToyota.html
OUTLIER Sedan 38.00 Volkswagen ./mileageVolkswagen.html
MIN Sedan 12.00 Volvo
MAX Sedan 33.00 Volvo
...
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
Statement Summary
The BOXPLOTPARM statement requires precomputed input data. One reason to choose
this statement over the BOXPLOT statement is that you can control the computational
technique used to compute various statistics for the box plot, such as the mean, quartiles,
location of fences, outlier definition, and so on. See Appendix 5, “Generalized Macro for
BOXPLOTPARM Data,” on page 1357 for examples of such computations using PROC
SUMMARY and multiple DATA steps.
The BOXPLOTPARM statement displays a single box if given just Y and a STAT
argument. It displays multiple boxes if given both Y and X and a STAT argument and X
has more than one unique value.
By default for numeric or character columns, the category (X) axis is
TYPE=DISCRETE. You can override the default and specify TYPE=LINEAR in the
parent layout, provided that the X column is numeric. The axis for the analysis (Y)
column is always LINEAR. When the X axis is LINEAR, you can use the
INTERVALBOXWIDTH= option to specify the box width.
When ORIENT= VERTICAL, the X (or X2) axis is used for the X column and the Y (or
Y2) axis is used for the Y column. When ORIENT=HORIZONTAL, the X (or X2) axis
is used for the Y column and the Y (or Y2) axis is used for the X column.
Two basic box plot representations can be drawn with the BOXPLOTPARM statement: a
schematic (Tukey) box plot and a skeletal box plot. See the EXTREME= option for
details.
The following figure illustrates the box plot elements:
362 Chapter 6 • Plot Statements
As shown in the figure, the bottom and top edges of the box are located at the 1st
quartile (25th percentile) and 3rd quartile (75th percentile) of the sample. Within the
box, you can display the median (50th percentile) as a line and the mean as a marker (see
the DISPLAY= option).
You can also display markers and data labels for outliers. Outliers are observations that
are more extreme than the upper and lower fences (±1.5 IQR). Outliers that are beyond
upper and lower far fences (±3 IQR) are called FAR OUTLIERS and can also be
identified and labeled. From a graphical perspective, the location of fences along the axis
are known, but there is no line or marker that displays a fence. (See DISPLAY= ,
LABELFAR= , and DATALABEL= options).
Finally, you can control the range represented by the whiskers. By default, the whiskers
are drawn from the upper edge of the box to the MAX value, and from the lower edge of
the box to the MIN value. (See the EXTREME= option.)
PowerOutputs Statistic
3180.00 MIN
3340.00 Q1
3487.40 MEAN
3490.00 MEDIAN
3610.00 Q3
4050.00 MAX
20.00 N
To plot the data from the preceding table, the following BOXPLOTPARM statement
uses the Y= and STAT= arguments to generate a single box plot for the recorded
statistics:
If the data contain statistics for multiple days of the process, then a third column in the
data must be present to identify the days that the statistics were recorded. For example,
the following data show the statistics that are calculated for two days of this process:
04JUL 3340.00 Q1
04JUL 3610.00 Q3
04JUL 20.00 N
05JUL 3333.50 Q1
05JUL 3605.00 Q3
05JUL 20.00 N
To plot the data from the preceding table, the BOXPLOTPARM statement needs the Y=,
STAT=, and X= arguments to generate a separate box plot for each day that the statistics
were recorded:
See Appendix 5, “Generalized Macro for BOXPLOTPARM Data,” on page 1357 for a
more complete example of providing input data for BOXPLOTPARM.
To place the different response values side by side, you can assign a different offset to
each BOXPLOTPARM statement. The BOXWIDTH= option can be used in conjunction
with the DISCRETEOFFSET= option to create narrower boxes when desired.
layout overlay / cycleattrs=true
yaxisopts=(label="Miles Per Gallon");
The following graph was generated by the “Example Program” on page 367:
BUBBLEPLOT Statement 367
Example Program
The following input data generates the box for Sedan in the graph. See Appendix 5,
“Generalized Macro for BOXPLOTPARM Data,” on page 1357 to see the code for
creating all of the data.
/* Use the BOXCOMPUTE macro to generate the data for this plot. */
%boxcompute(indsn=sashelp.cars,x=type,y=mpg_city,datalabel=make);
BUBBLEPLOT Statement
Creates a bubble plot of the input data. The locations of the bubble centers correspond to the values of X
and Y columns in the data, and the bubble radii correspond to the values of a SIZE column.
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
368 Chapter 6 • Plot Statements
Syntax
BUBBLEPLOT X=column | expression
Y=column | expression
SIZE=numeric-column | expression </option(s)>;
Appearance options
BUBBLERADIUSMAX=dimension
specifies the drawing size of the largest bubble.
BUBBLERADIUSMIN=dimension
specifies the drawing size of the smallest bubble.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the numeric column or range attribute map variableto use to
determine the bubble colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bubbles.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bubble fills and bubble
outlines
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display outlined bubbles, filled bubbles, or outlined and
filled bubbles.
DRAWORDER=SIZE | DATA
specifies whether the bubbles are drawn according to bubble size or
according to data order.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled bubble areas.
INDEX=positive-integer-column | expression
specifies indices for mapping bubble attributes (fill and outline) to one of the
GraphData1–GraphDataN style elements.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the bubble outlines.
RELATIVESCALE=TRUE | FALSE
specifies whether the SIZE= column values are interpreted as relative values.
RELATIVESCALETYPE=LINEAR | PROPORTIONAL
specifies the type of scaling that is to be applied to the SIZE= column values.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
SIZETHRESHOLDMAX=numeric-value
specifies a SIZE= column value threshold at which bubble size is clamped to
the BUBBLERADIUSMAX= option value.
Axes options
PRIMARY=TRUE | FALSE
BUBBLEPLOT Statement 369
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABEL=column | expression
specifies a column for bubble labels.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the bubble labels.
DATALABELPOSITION=TOPRIGHT | TOP | TOPLEFT | LEFT | CENTER |
RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the bubble labels relative to the bubble.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate bubble color for each unique grouping that is specified.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page to display when a bubble is selected.
370 Chapter 6 • Plot Statements
Required Arguments
X=column | expression
specifies the column for the X values of the bubble centers.
Y=column | expression
specifies the column for the Y values of the bubble centers.
SIZE=numeric-column | expression
specifies the bubble SIZE values.
Optional Arguments
BUBBLERADIUSMAX=dimension
specifies the drawing size of the largest bubble.
BUBBLERADIUSMIN=dimension
specifies the drawing size of the smallest bubble.
Default GraphDataDefault:markerSize
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
BUBBLEPLOT Statement 371
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To reverse the start and end colors of the ramp that is assigned to the
color model, use the REVERSECOLORMODEL= option.
Interactions The mapped color used for the bubbles is also used for the data labels.
When only the outlines are displayed, this option overrides suboption
COLOR= in the OUTLINEATTRS= option and varies the outline
color according to the color gradient or the attribute map.
372 Chapter 6 • Plot Statements
Note When both the fill and outline are displayed, the bubble fill color
varies according to the color gradient or attribute map but the bubble
outline color remains fixed on the color specified in option
OUTLINEATTRS=.
DATALABEL=column | expression
specifies a column for bubble labels. The label positions are adjusted to prevent them
from overlapping.
For grouped data, the text color is derived from the GraphData1–
GraphDataN style elements. The data label color changes to match the
group color derived from the ContrastColor attribute of the style
element that is in effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default TOPRIGHT
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters. When set to
TRUE, the data label is split unconditionally at each occurrence of any of the
specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
BUBBLEPLOT Statement 373
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
374 Chapter 6 • Plot Statements
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, DISPLAY= FILL must be in effect.
Otherwise, this option is ignored.
When a data skin is applied, all bubble outlines are set by the skin,
and the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bubble fills and bubble outlines
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the filled
bubble areas. You can combine this option with FILLATTRS= to set one
transparency for the bubble outlines but a different transparency for the
bubble fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
Default STANDARD
DRAWORDER=SIZE | DATA
specifies whether the bubbles are drawn according to bubble size or according to
data order.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
SIZE
draws the bubbles according to bubble size, from the largest to the smallest
DATA
draws the bubbles according to data order
The following figure shows the effect of SIZE and DATA on four bubbles. The
bubble labels indicate the data order, and the bubble sizes increase linearly starting
with 1.
Default SIZE
BUBBLEPLOT Statement 377
Interactions For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default The bubble attributes for each unique group value are derived from the
GraphData1–GraphDataN and GraphMissing style elements. If the
bubbles are filled, then the COLOR attribute is used for bubble fill and
the CONTRASTCOLOR attribute is used for the bubble outlines. If
the bubbles are not filled, then the CONTRASTCOLOR and
PATTERN attributes are used for the bubble outlines.
Interactions If a discrete attribute map variable is specified, then the color mapping
for the bubbles is defined by the associated DISCRETEATTRMAP
statement. See “DISCRETEATTRMAP Statement” on page 1287.
The mapped color that is used for outlines is also used as the color of
the data labels.
Note All bubbles have only one fill and one outline color as specified by the
FILLATTRS= and OUTLINEATTRS options.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping bubble attributes (fill and outline) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The SIZE= column label. If a label is not defined, then the SIZE=
column name is used.
BUBBLEPLOT Statement 379
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
380 Chapter 6 • Plot Statements
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
RELATIVESCALE=TRUE | FALSE
specifies whether the SIZE= column values are interpreted as relative values.
Relative means that the size values do not translate directly into bubble radii. Rather,
the bubble sizes are scaled to represent the value range of the SIZE= column.
For example, when RELATIVESCALE=TRUE, if only two bubbles are drawn with
sizes of 2 and 4, then they appear the same as only two bubbles with sizes of 4000
and 8000. By contrast, when RELATIVESCALE=FALSE, the size values are
interpreted in the same units as the axes.
If you set this option to FALSE, then it is recommended that you also place the
BUBBLEPLOT statement in a LAYOUT OVERLAYEQUATED container. This
ensures that the X and Y axis units are the same. For more information, see “Details”
on page 384.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
RELATIVESCALETYPE=LINEAR | PROPORTIONAL
specifies the type of scaling that is to be applied to the SIZE= column values.
LINEAR
increases the size of the bubbles in linear proportion to the range of the SIZE=
column values. For example, if only two bubbles are drawn with sizes of 2 and 4,
then they appear the same as only two bubbles with sizes of 4000 and 8000.
PROPORTIONAL
increases the size of each bubble in direct proportion to its corresponding SIZE=
column value. For example, if only two bubbles are drawn with sizes of 50 and
100, then the bubble for SIZE=50 is drawn to half the size of the bubble for
SIZE=100.
BUBBLEPLOT Statement 381
Default LINEAR
If all the values for the SIZE= column are negative, then
RELATIVESCALETYPE=PROPORTIONAL is ignored, and the
default value is used.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y , SIZE, GROUP, DATALABEL, and
COLORRESPONSE.
SIZETHRESHOLDMAX=numeric-value
specifies a SIZE= column value threshold at which bubble size is clamped to the
BUBBLERADIUSMAX= option value. The size of the bubbles for all SIZE=
column values that equal or exceed the specified threshold value is set to the
BUBBLERADIUSMAX= value.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the bubbles. If
this option is used, then it replaces all of the information that is displayed by default.
Roles for columns that do not contribute to the bubble plot can be specified along
with roles that do.
(role-list)
an ordered, space-separated list of unique BUBBLEPLOT and user-defined roles.
BUBBLEPLOT roles include X, Y, SIZE, GROUP, DATALABEL, and
COLORRESPONSE.
Example The following example displays data tips for the columns assigned to
the roles X, Y, and SIZE, as well as the column Pop_2009. The
POP_2009 column is not assigned to any pre-defined BUBBLEPLOT
role, so it must first be assigned a role:
ROLENAME=(TIP1=POP_2009)
TIP=(TIP1 X Y SIZE)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X , Y , SIZE , GROUP , DATALABEL , and
COLORRESPONSE .
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
BUBBLEPLOT Statement 383
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a bubble is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
bubble that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Requirement To generate a plot with selectable bubbles, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tips The URL value can be blank for some X and Y pairs, meaning that
no action is taken when the corresponding point is selected.
The URL value can be the same for any X and Y pairs. In that case,
the same action is taken when the bubbles for those X and Y pairs are
selected.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
384 Chapter 6 • Plot Statements
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
The BUBBLEPLOT statement displays one bubble for each row in the data, provided
that row contains nonmissing values for X, Y, and SIZE. By default, the bubbles are
displayed as filled, outlined circles. Regardless of the data order, the bubbles are always
drawn from the largest size to the smallest size.
By default, the minimum and maximum values of the SIZE= column establish a range
over which the bubble radii increase in linear proportion. The actual drawing size of the
smallest and largest bubble is set automatically. You can adjust the smallest and largest
bubble sizes with the BUBBLERADIUSMIN= and BUBBLERADIUSMAX= options.
In these cases where the bubble sizes are proportional to each other, the default setting
RELATIVESCALE=TRUE is appropriate.
If the SIZE= values are in the same units as the X and Y values, and both X and Y are
numeric, then you can generate a plot where the bubble-radius units match the axis-scale
units. To do so, specify the BUBBLEPLOT statement within a LAYOUT
OVERLAYEQUATED block, and in the BUBBLEPLOT statement, set
RELATIVESCALE=FALSE.
By default, for character columns, the X and Y axes are always discrete. For numeric
columns, the X and Y axes are linear. You can change axis type for numeric axes with
the layout options XAXISOPTS= and YAXISOPTS=.
Note: Within a LAYOUT OVERLAY, the unit-interval of the X and Y axes are not
necessarily the same and the bubbles might be distorted into ellipses when
RELATIVESCALE=FALSE. The OVERLAYEQUATED container ensures that the
bubbles are displayed as circles, assuming that both the X= and Y= arguments
specify numeric columns.
data influence;
input x y radius category;
datalines;
2 4 1 1
5 5 2 1
6 3 2 2
12 7 3 2
;
proc template;
define statgraph equatedbubbles;
begingraph;
entrytitle 'Radius of Influence';
entrytitle 'Bubbles Show Distance Covered by Observation';
layout overlayequated /
Example: BUBBLEPLOT Statement 385
xaxisopts = (griddisplay=on)
yaxisopts = (griddisplay=on);
bubbleplot x=x y=y size=radius /
group=category datatransparency=0.5
relativescale=false ;
endlayout;
endgraph;
end;
The following graph was generated by the “Example Program” on page 386 :
386 Chapter 6 • Plot Statements
Example Program
data bubbleintro;
input Engineer $ Salary number;
format Salary dollar7.0 number comma6.0;
datalines;
Electric 59000 89382
Civil 54000 73273
Software 56000 34833
Chemical 62000 25541
Mechanical 60000 19601
;
proc template;
define statgraph engineer;
begingraph;
entrytitle 'Median Salary for Entry Level Engineers';
entrytitle 'Bubbles Show Number of Engineers in Survey';
layout overlay;
bubbleplot x=engineer y=salary
size=number / datalabel=number;
endlayout;
endgraph;
end;
CONTOURPLOTPARM Statement
Creates a contour plot representing a response variable evaluated over a grid of X and Y values.
Restriction: Contour plots do not support data tips.
CONTOURPLOTPARM Statement 387
Tips: By default, the CONTOURPLOTPARM statement assumes that the X-Y grid is
complete and does not contain any missing or irregular values. If the X-Y grid is not
complete, specify GRIDDED=FALSE in the CONTOURPLOTPARM statement so
that the values needed to complete the grid are calculated. Otherwise, unexpected
results might occur.
You can use a legend to display the contour level values. For
CONTOURTYPE=LINE and CONTOURTYPE=LABELEDLINE, use a
DISCRETELEGEND statement to add a legend. For all other contour types, use a
CONTINUOUSLEGEND statement to add a legend.
For filled contour types, there might be small, visible gaps between the axes and the
contour boundaries. To eliminate the gaps, specify the following axis options in the
layout statement for the plots parent layout:
XAXISOPTS=(OFFSETMIN=0 OFFSETMAX=0
LINEAROPTS=(THRESHOLDMIN=0 THRESHOLDMAX=0))
YAXISOPTS=(OFFSETMIN=0 OFFSETMAX=0
LINEAROPTS=(THRESHOLDMIN=0 THRESHOLDMAX=0))
Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Syntax
CONTOURPLOTPARM X=numeric-column | expression
Y=numeric-column | expression
Z=numeric-column | expression </option(s)>;
Appearance options
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used to determine the colors of filled or
gradient contours.
CONTOURTYPE=LINE | FILL | GRADIENT | LINEFILL | LINEGRADIENT |
LABELEDLINE | LABELEDLINEFILL | LABELEDLINEGRADIENT
specifies how the contour is displayed.
GRIDDED=TRUE | FALSE
specifies whether the X and Y values are equally spaced in a rectangular grid.
LEVELS=(contour-value-list)
specifies a list of contour level values.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the contour lines.
NHINT=integer
specifies the suggested number of contour levels for the Z column.
NLEVELS=integer
specifies the actual number of contour levels for the Z column.
REVERSECOLORMODEL=TRUE | FALSE
388 Chapter 6 • Plot Statements
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
LINELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the contour line labels.
LINELABELBASELINE=HORIZONTAL | TANGENT
specifies the text alignment of the contour line labels.
LINELABELFORMAT=format
specifies the format to use for the contour line labels.
LINELABELPOSITION=MIDDLE | BEGIN | END
specifies the position for the contour line labels.
Required Arguments
X=numeric-column | expression
specifies the X coordinates for the grid.
Y=numeric-column | expression
specifies the Y coordinates for the grid.
Z=numeric-column | expression
specifies the contour response values.
Optional Arguments
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used to determine the colors of filled or gradient
contours.
style-element
specifies the name of a style element. The style element can contain these style
attributes:
Interactions The fill colors of the types that enable FILL or GRADIENT are
controlled by the COLORMODEL= option.
GRIDDED=TRUE | FALSE
specifies whether the X and Y values are equally spaced in a rectangular grid. If set
to FALSE, then additional calculations are performed in order to complete the grid.
For information about the algorithm used to calculate the grid, see “Mesoscale
Objective Map Analysis Using Weighted Time-Series Observations.”1
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Barnes,
1 Stanley L March 1973. “Mesoscale Objective Map Analysis Using Weighted Time-Series Observations.” Technical
Memorandum (NOAA TM ERLNSSL-62), United States National Oceanic and Atmospheric Administration, Environmental
Research Labs, Norman, OK..
CONTOURPLOTPARM Statement 391
Default The Z-column label. If a label is not defined, then the Z-column name
is used.
LEVELS=(contour-value-list)
specifies a list of contour level values.
(contour-value-list)
a space-separated list of numeric values, enclosed in parentheses.
Default The number of levels and the level values are determined internally
using the NHINT= or NLEVELS= option value.
Note Values that are outside of the data range are ignored.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LINELABELBASELINE=HORIZONTAL | TANGENT
specifies the text alignment of the contour line labels. Each contour line has a
precomputed label point.
HORIZONTAL
specifies that each label is parallel to the X-axis. The label intersects its contour
line and is centered at the label point.
TANGENT
specifies that each label is drawn tangent to the contour line at the label point.
This reduces intersection with the contour line and causes labels to be tilted at
various angles in relation to the X-axis.
Default HORIZONTAL
392 Chapter 6 • Plot Statements
LINELABELFORMAT=format
specifies the format to use for the contour line labels.
Default MIDDLE
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to indicate the colors
associated with the Z values.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
NHINT=integer
specifies the suggested number of contour levels for the Z column.
Default 7
NLEVELS=integer
specifies the actual number of contour levels for the Z column.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
CONTOURPLOTPARM Statement 393
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
A CONTOURPLOTPARM statement uses the CONTOURTYPE= option to specify the
type of contour plot to generate. Contour types that display fills or gradients but no
contour lines can use only a CONTINUOUSLEGEND statement to represent the contour
level values in a legend. Contour types that display lines can use either a
CONTINUOUSLEGEND or DISCRETELEGEND statement to identify contour level
values.
By default, the CONTOURPLOTPARM statement assumes that the X-Y grid is
complete. If the grid is not complete, then set the GRIDDED= option to FALSE so that
the plot calculates the values needed to complete into a grid with a bounding rectangle.
394 Chapter 6 • Plot Statements
For filled or gradient contour types, small gaps might be visible between the axes and
the bounding box of the contour data. To eliminate these gaps, set the axis options of the
LAYOUT OVERLAY statement as follows:
XAXISOPTS=(OFFSETMIN=0 OFFSETMAX=0
LINEAROPTS=(THRESHOLDMIN=0 THRESHOLDMAX=0))
YAXISOPTS=(OFFSETMIN=0 OFFSETMAX=0
LINEAROPTS=(THRESHOLDMIN=0 THRESHOLDMAX=0))
Contour plots do not support the data tips that are enabled by the IMAGEMAP= option
in the ODS GRAPHICS statement.
The following graph was generated by the “Example Program” on page 394:
Example Program
proc template;
define statgraph contourplotparm;
begingraph;
entrytitle "Contour Plot of Height and Weight";
layout overlay /
xaxisopts=(offsetmin=0 offsetmax=0
linearopts=(thresholdmin=0 thresholdmax=0))
yaxisopts=(offsetmin=0 offsetmax=0
linearopts=(viewmax=250
thresholdmin=0 thresholdmax=0));
DENDROGRAM Statement 395
DENDROGRAM Statement
Creates a tree diagram that is typically used to display the results of a hierarchical clustering analysis.
Syntax
DENDROGRAM NODEID=column | expression
PARENTID=column | expression
CLUSTERHEIGHT=numeric-column | expression </option(s)>;
Appearance options
CLUSTERS=numeric-column | expression
specifies a numeric column containing the resultant number of clusters at
each node.
CUT=TRUE | FALSE
specifies whether the tree is to be cut.
CUTOPTS=(pruning-options)
specifies pruning options for cutting the dendrogram.
DATATRANSPARENCY=number
specifies the degree of the transparency of the dendrogram lines.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the dendrogram lines.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the dendrogram leaf axis.
TREETYPE=RECTANGULAR | TRIANGULAR
specifies the type of tree structure to draw.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
396 Chapter 6 • Plot Statements
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Required Arguments
NODEID=column | expression
specifies a column for the ID values of the nodes. Each node ID value must be
unique. If duplicate NODEID values are found, then the dendrogram is not
rendered . The column can be numeric or character, but it must be of the same type
and have the same formatted length as the ParentID column.
The maximum number of nodes that are supported by the dendrogram is determined
by the DISCRETEMAX= option in the ODS GRAPHICS statement. The default
value is DISCRETEMAX=1000. If the graph data contains more than 1000 discrete
values, then the dendrogram is not drawn and a warning is written to the SAS log. In
that case, you can use the DISCRETEMAX= option to increase the maximum
number of discrete values that are allowed.
PARENTID=column | expression
specifies a column for the parent ID values of the nodes. The column can be numeric
or character, but it must be of the same type and have the same formatted length as
the NodeID column.
CLUSTERHEIGHT=numeric-column | expression
specifies the column for the height values for each node.
Optional Arguments
CLUSTERS=numeric-column | expression
specifies a numeric column containing the resultant number of clusters at each node.
Interaction For this option to take effect, the pruning options in the CUTOPTS=
option must set TYPE=NCLUSTERS and specify a number for the
NCLUSTERS= setting.
CUT=TRUE | FALSE
specifies whether the tree is to be cut.
Default FALSE
Tip To set the properties of the CUT, use the CUTOPTS= option.
DENDROGRAM Statement 397
See “boolean ” on page 1339 for other Boolean values that you can use.
CUTOPTS=(pruning-options)
specifies pruning options for cutting the dendrogram. The following pruning-options
must be specified as a space-separated list of option = value pairs enclosed in
parentheses.
CUTHEIGHT=number
specifies the height at which the tree is to be pruned.
NCLUSTERS=number
specifies the number of clusters to use for pruning the tree.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TYPE=CUTHEIGHT | NCLUSTERS
specifies which rule to use to prune the tree.
Default CUTHEIGHT
DATATRANSPARENCY=number
specifies the degree of the transparency of the dendrogram lines.
Default 0
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the dendrogram leaf axis.
Default VERTICAL
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a dendrogram
line. If this option is used, then it replaces all of the information that is displayed by
default.
(role-list)
an ordered, space-separated list of unique DENDROGRAM roles, which include
NODEID , PARENTID , and CLUSTERHEIGHT .
DENDROGRAM Statement 399
Example The following example displays data tips for the columns assigned to
the roles NODEID and PARENTID.
TIP=(NODEID PARENTID)
NONE
suppresses data tips from the plot.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIPFORMAT=(CLUSTERHEIGHT=4.1)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIPLABEL=(CLUSTERHEIGHT="Height")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
TREETYPE=RECTANGULAR | TRIANGULAR
specifies the type of tree structure to draw.
400 Chapter 6 • Plot Statements
Default RECTANGULAR
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
A dendrogram is a tree diagram that is typically used to show the cluster arrangements in
hierarchical data. The DENDROGRAM statement supports clusters with only a single
root. If multiple roots are found in the data, then a warning is written to the SAS log and
the dendrogram is not drawn. The maximum number of nodes that is supported by the
DENDROGRAM statement is determined by the DISCRETEMAX= option in the ODS
GRAPHICS statement, which is 1000 by default.
In the Graph Template Language, a DENDROGRAM plot typically appears by itself in a
LAYOUT OVERLAY container. You can overlay REFERENCELINE or BANDPLOT
statements on a DENDROGRAM, but overlaying other plot types might produce
unexpected results.
Using the DENDROGRAM statement in layouts where the axis ranges are merged
across cells might produce unexpected results.
The following graph was generated by the “Example Program” on page 401:
Example: DENDROGRAM Statement 401
Example Program
data clustree;
input id $ parent $7-12 height nClus;
label id="Cluster ID" parent="Parent ID";
datalines;
clus1 3 1
clus2 clus1 0.2 7
clus3 clus1 1.75 2
clus4 clus3 0.7 4
clus5 clus3 0.8 3
clus6 clus4 0.4 5
clus7 clus6 0.1 9
clus8 clus5 0.25 6
clus9 clus8 0.15 8
1 clus9 0 10
2 clus6 0 10
3 clus2 0 10
4 clus7 0 10
5 clus7 0 10
6 clus2 0 10
7 clus4 0 10
8 clus5 0 10
9 clus8 0 10
10 clus9 0 10
run;
proc template;
define statgraph dendrogram;
begingraph;
layout overlay;
dendrogram nodeID=id parentID=parent clusterheight=height;
402 Chapter 6 • Plot Statements
endlayout;
endgraph;
end;
run;
DENSITYPLOT Statement
Creates a univariate probability density curve computed from input data.
Tips: If the data density is not known, then use the KERNEL distribution option in the
DENSITYPLOT statement.
Starting with the third maintenance release of SAS 9.4, subpixel rendering is enabled
by default. To disable subpixel rendering, specify SUBPIXEL=OFF in the
BEGINGRAPH statement or in an ODS GRAPHICS statement. For information
about the BEGINGRAPH statement SUBPIXEL= option, see SUBPIXEL= on page
33.For information about the ODS GRAPHICS statement SUBPIXEL= option, see
“ODS GRAPHICS Statement” in SAS ODS Graphics: Procedures Guide.
Syntax
DENSITYPLOT numeric-column | expression </<distribution-option> <option(s)>>;
Appearance options
DATATRANSPARENCY=number
specifies the degree of the transparency of the density curve and curve label.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the density curve.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABEL="string"
specifies a label for the density curve.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the density curve label.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the density curve label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the density curve label relative to the curve line.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the curve label at the specified split characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the curve label can be split if
needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the curve label text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the curve label block.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate density curve for each unique group value in the specified
column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Statistics options
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation
that is read.
WEIGHT=numeric-column | expression
specifies a column that contains a density-curve calculation a priori weight
for each observation of the input data object.
Required Arguments
numeric-column
specifies a numeric column of data values that are used to calculate the parameters
for the probability distribution.
expression
specifies an expression that calculates values when those values are not stored in the
data.
404 Chapter 6 • Plot Statements
Optional Arguments
CURVELABEL="string"
specifies a label for the density curve.
Restriction This option is not valid when the GROUP= option is specified.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the density curve label relative to the plot area.
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
MAX
forces the density label to appear near maximum density X-values (typically, to
the right).
DENSITYPLOT Statement 405
MIN
forces the density label to appear near minimum density X-values (typically, to
the left).
START
forces the density label to appear near the beginning of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
END
forces the density label to appear near the end of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the curve label at the specified split characters. When a
curve label is split, the label is split on each occurrence of the specified split
characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the curve label can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
curve label. In that case, all of the specified split characters together are treated as a
single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the curve
label is split unconditionally at each occurrence of any of the specified split
characters. If the curve label does not contain any of the specified characters, then
the label is not split.
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the curve label text.
TRUE
drops the split characters from the curve label text.
FALSE
includes the split characters in the curve label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a curve label with the following
specifications:
DENSITYPLOT Statement 407
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
curve for reference.
Default TRUE. The split characters are dropped from the curve label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
DATATRANSPARENCY=number
specifies the degree of the transparency of the density curve and curve label.
Default 0
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation that is
read.
Restriction If the value of the numeric-column is missing or is less than 1, then the
observation is not used in the analysis. If the value is not an integer,
then only the integer portion is used.
Note If n is the value of the numeric column for a given observation, then
that observation is used n times for the purposes of any statistical
computation.
For example, the Sashelp.Cars data contains a column named Origin, which
identifies the region that produces each car. This column could be used in the
DENSITYPLOT statement to group the density curves in the display:
proc template;
define statgraph densityplot;
begingraph;
entrytitle "Highway Mileage Distribution by Origin";
DENSITYPLOT Statement 409
layout overlay /
xaxisopts=(griddisplay=on
gridattrs=(color=lightgray pattern=dot))
yaxisopts=(griddisplay=on
gridattrs=(color=lightgray pattern=dot));
densityplot mpg_highway / name="densityplot" group=origin;
discretelegend "densityplot" / title="Origin:";
endlayout;
endgraph;
end;
run;
Default Each distinct group value is represented in the plot by a different line color
and pattern. The line color is determined by the ContrastColor attribute of
the GraphData1–GraphDataN and GraphMissing style elements. The line
pattern is determined by the LineStyle attribute of the GraphData1–
GraphDataN and GraphMissing style elements.
Note The group values are mapped in the order in which they appear in the data.
Tip You can individually override the representations that are used to identify
the groups. For example, in some ODS styles, each distinct group value is
represented by a different line color and pattern. In that case, you can use
the PATTERN= setting on the LINEATTRS= option to assign the same line
pattern to all of the curves.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default TRUE
410 Chapter 6 • Plot Statements
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the MISSING= system option changes the default missing character, or
a user-defined format is applied to the group value. In those cases, the
attributes of the missing group value are determined by a GraphData1–
GraphDataN style element instead of by the GraphMissing style
element.
See “boolean ” on page 1339 for other Boolean values that you can use.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis.
Default VERTICAL
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
DENSITYPLOT Statement 411
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIPFORMAT=(Y=6.2)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIPLABEL=(Y="Curve")
Default The column label or column name of the column assigned to the role.
Note The columns assigned to the X and Y roles are automatically included in
the data tip information.
WEIGHT=numeric-column | expression
specifies a column that contains a density-curve calculation a priori weight for each
observation of the input data object.
Interaction If the value for an observation is missing or is less than 1, then the
observation is removed from the analysis.
412 Chapter 6 • Plot Statements
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Distribution Options
KERNEL (<C=positive-number> <WEIGHTFUNCTION=NORMAL |
QUADRATIC | TRIANGULAR> <MAXPOINTS=positive-integer>)
specifies a nonparametric kernel density estimate. The general form of the kernel
density estimator is as follows.
n x − xi
fλ x =
100h %
nλ ∑ K0 λ
i=1
For more information, see the discussion of Kernel Density Estimates for the
UNIVARIATE procedure in the documentation for Base SAS.
TIP Use the KERNEL distribution option when the data density is not known.
C=positive-number
specifies a positive number (0 < number <= 100) that represents the standardized
bandwidth.
The value of λ, referred to as the bandwidth parameter, determines the degree of
smoothness in the estimated density function. You specify λ indirectly by
specifying a standardized bandwidth c with the C=kernel-option. If Q is the
interquartile range and n is the sample size, then c is related to λ by the following
equation:
1
λ = cQn − 5
Default Calculated from the data as the bandwidth that minimizes the
approximate mean integrated square error (MISE).
QUADRATIC
3
K0 t = 4
1 − t2 for t ≤ 1
TRIANGULAR
K 0 t = 1 − t for t ≤ 1
Default NORMAL
Note In prior SAS releases, the weight function was specified with the
WEIGHT= option. In SAS 9.4 and later releases, the WEIGHT= option
is not valid as a distribution option. You must use the
WEIGHTFUNCTION= option instead.
MAXPOINTS=positive-integer
specifies the maximum number of points generated for the curve.
Default 512
In the equation, μ is the mean and σ is the standard deviation (σ > 0). You can
specify μ with the MU= suboption and σ with the SIGMA= suboption. By default,
ODS estimates μ with the sample mean and σ with the sample standard deviation.
For more information, see the discussion of Kernel Density Estimates for the
UNIVARIATE procedure in the documentation for Base SAS.
MU=number
specifies the mean.
SIGMA=number
specifies the standard deviation.
MAXPOINTS=number
specifies the maximum number of points generated for the curve.
Default: 200
414 Chapter 6 • Plot Statements
Details
A typical DENSITYPLOT statement specifies either the NORMAL or the KERNEL
distribution option. If no distribution option is specified, then the NORMAL() option is
used. The following syntax explicitly shows the default case:
DENSITYPLOT numeric-column / NORMAL()
If more than one distribution option is specified, then the last distribution option
specified is used.
Examples
Example Program
When used as a stand-alone plot or overlaid with other density plots, the dependent axis
shows the computed density values.
proc template;
define statgraph densityplot1;
begingraph;
entrytitle "Fitted Density Curves";
entrytitle "of Patient Weight";
entryfootnote halign=left "Framingham Heart Study";
layout overlay;
densityplot weight / normal()
lineattrs=graphfit name="n" legendlabel="Normal";
Example 2: Density Plot and Histogram 415
Example Program
proc template;
define statgraph densityplot2;
begingraph;
entrytitle "Patient Weight Distribution";
entrytitle "with Fitted Normal Curve";
entryfootnote halign=left "Framingham Heart Study";
layout overlay;
histogram weight / primary=true scale=count;
densityplot weight / normal() lineattrs=graphfit;
endlayout;
endgraph;
end;
run;
416 Chapter 6 • Plot Statements
DROPLINE Statement
Creates a horizontal or vertical drop line from a point to an axis.
Requirement: A DROPLINE statement must be used within a 2-D layout (for example, an
OVERLAY, OVERLAYEQUATED, DATALATTICE, or DATAPANEL layout).
Syntax
DROPLINE X=x-axis-value | column | expression
Y=y-axis-value | column | expression </option(s)>;
Appearance options
CLIP=TRUE | FALSE
specifies whether the data for the line are considered when determining the
data ranges for the axes.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the drop line.
DATATRANSPARENCY=number
specifies the degree of the transparency of the drop line.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the drop line.
Axes options
DISCRETEOFFSET=number
specifies an amount to offset all drop lines from discrete X values, or Y
values, or both.
DROPTO=X | Y | BOTH
specifies the axis to which the line is dropped.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
LABEL="string" | string-column
specifies a label for the point(s) indicated by the X= and Y= arguments.
LABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the drop line label(s).
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template
statements.
Required Arguments
X=x-axis-value | column | expression
specifies the X coordinate of the drop line(s).
Requirement Values must agree in type with the X-axis data type. For example,
you should use numeric SAS date or time values (or SAS date/time
constants) for a time axis.
Note When a character value is specified, leading blanks are honored and
trailing blanks are ignored when the specified value is compared with
the data values.
Requirement Values must agree in type with the Y-axis data type.
Note When a character value is specified, leading blanks are honored and
trailing blanks are ignored when the specified value is compared with
the data values.
Optional Arguments
CLIP=TRUE | FALSE
specifies whether the data for the line are considered when determining the data
ranges for the axes.
FALSE
specifies that the reference line values are to be considered when the axis range is
determined. The reference lines are drawn as follows based on the axis type:
• For a discrete axis, the reference line values that are not already on the axis
are added to the end of the axis data list. When applicable, the axis values are
then sorted:
• If the axis values are numeric values, then they are sorted ordinally.
• If the axis values are character values and a sorting option is applied to the
axis, then they are sorted as specified by the sorting option.
Reference lines are then drawn at the specified locations.
• For a linear, log, or time axis, a new axis data list is created by performing a
mathematical union of the data values and the reference line values. The
reference lines are then drawn at the locations specified.
418 Chapter 6 • Plot Statements
TRUE
specifies that the reference line values are not to be considered when the axis
range is determined. The reference lines are drawn as follows based on the axis
type:
• For a discrete axis, if the reference line value exactly matches a value on the
axis, then a reference line is drawn at that location. Otherwise, the reference
line is not drawn.
Note: If the axis values are formatted, then the reference line value must
exactly match the formatted axis value in order for the line to be drawn.
• For a linear, log, or time axis, if the reference line value is within the axis
data range, then the reference line is drawn at the specified location.
Otherwise, the reference line is not drawn.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
DATATRANSPARENCY=number
specifies the degree of the transparency of the drop line.
DROPLINE Statement 419
Default 0
DISCRETEOFFSET=number
specifies an amount to offset all drop lines from discrete X values, or Y values, or
both.
Default 0 (no offset, all drop lines are centered on discrete X values, or discrete
Y values, or both)
Range -0.5 to +0.5 where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
DROPTO=X | Y | BOTH
specifies the axis to which the line is dropped.
X
draws one or more droplines to an X axis.
Tip The XAXIS= option determines whether the X axis or X2 axis is the
endpoint for the line.
Y
draws one or more droplines to a Y axis.
Tip The YAXIS= option determines whether the Y axis or Y2 axis is the
endpoint for the line.
BOTH
draws one or more droplines to both axes.
Note This option is valid in the first maintenance release of SAS 9.4 and later
releases.
Default X
LABEL="string" | string-column
specifies a label for the point(s) indicated by the X= and Y= arguments.
Interaction If drawing multiple drop lines using X=column or Y=column, then you
can assign corresponding labels by using a column to define the labels.
420 Chapter 6 • Plot Statements
Note Starting with the first maintenance release of SAS 9.4, space is reserved
at the maximum end of the X axis to accommodate the length of the
labels regardless of where the labels appear in the plot.
Tips You can use the OFFSETMAX= axis option to adjust the amount of
space that is reserved on the X axis for the labels.
The font and color attributes for the label are specified by the
LABELATTRS= option.
Interaction For this option to have any effect, the LABEL= option must also be
specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Example: DROPLINE Statement 421
Restriction Another plot that establishes a data range for the designed axis must be
included.
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Restriction Another plot that establishes a data range for the designed axis must be
included.
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
A drop line is always drawn perpendicular from the specified point to the X (bottom),
X2 (top), Y (left), or Y2 (right) axis. Axis offsets do not apply to drop lines, so they
always meet the axis line.
The DROPTO= option controls whether a horizontal or vertical drop line is created.
DROPTO=X specifies the horizontal axis for a vertical drop line, and DROPTO=Y
specifies the vertical axis for a horizontal drop line.
A DROPLINE statement can be used only within a 2-D overlay-type layout (OVERLAY,
OVERLAYEQUATED, PROTOTYPE). Another plot statement that is derived from data
values that provide boundaries for the axis area must be included in the layout. For
example, it can be used with a scatter plot or a histogram. You can generate multiple
drop lines by specifying a column for X and Y. The column type (numeric or string)
must agree with the type of data presented on the axis.
To generate both a vertical and a horizontal drop line from a single point, use multiple
DROPLINE statements.
Example Graph
The following graph was generated by the “Example Program” on page 422. The graph
shows two DROPLINE statements originating from the same point (X=3, Y=5). One
statement uses DROPTO=X and the other uses DROPTO=Y.
422 Chapter 6 • Plot Statements
Example Program
proc template;
define statgraph dropline;
begingraph;
entrytitle "Drop lines at Inflection Point";
layout overlay / yaxisopts=(linearopts=(viewmin=0));
seriesplot x=x y=y;
dropline x=3 y=5 / dropto=x
lineattrs=(color=blue pattern=dot) label="(3,5)";
dropline x=3 y=5 / dropto=y
lineattrs=(color=blue pattern=dot);
endlayout;
endgraph;
end;
run;
data test;
do X=0 to 8 by 0.25;
Y=(x-3)*(x-3) + 5;
output;
end;
run;
ELLIPSE Statement
Creates a confidence ellipse computed from input data.
ELLIPSE Statement 423
Syntax
ELLIPSE X=numeric-column | expression
Y=numeric-column | expression </option(s)>;
Appearance options
CLIP=TRUE | FALSE
specifies whether the data for the ellipse are considered when determining the
data ranges for the axes.
DATATRANSPARENCY=number
specifies the degree of the transparency of the ellipse fill color and outline.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display an outlined ellipse, a filled ellipse, or an outlined
and filled ellipse.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the ellipse.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the ellipse outline.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate ellipse for each unique group value in the specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Statistics options
424 Chapter 6 • Plot Statements
ALPHA=positive-number
sets a significance value for the confidence level to compute for the ellipse.
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation
that is read.
TYPE=MEAN | PREDICTED
specifies the type of ellipse.
Required Arguments
X=numeric-column | expression
specifies the numeric column for the X values.
Y=numeric-column | expression
specifies the numeric column for the Y values.
Optional Arguments
ALPHA=positive-number
sets a significance value for the confidence level to compute for the ellipse.
Default 0.05
See TYPE=
CLIP=TRUE | FALSE
specifies whether the data for the ellipse are considered when determining the data
ranges for the axes.
FALSE
The data for the ellipse contribute to the data range for each axis. Each axis
might be extended to force the display of the entire ellipse.
TRUE
The data for the ellipse are ignored when establishing axis scales. Each axis scale
is determined by the other plots in the parent layout. This might result in the
ellipse not being entirely displayed (clipped) if its data range is not within the
data ranges of the other plots.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
DATATRANSPARENCY=number
specifies the degree of the transparency of the ellipse fill color and outline.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the
ellipse fill. You can combine this option with FILLATTRS= to set one
transparency for the ellipse outline but a different transparency for the
ellipse fill. Example:
ELLIPSE Statement 425
datatransparency=0.2 fillattrs=(transparency=0.6)
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation that is
read.
Restriction If the value of the numeric-column is missing or is less than 1, then the
observation is not used in the analysis. If the value is not an integer,
then only the integer portion is used.
Note If n is the value of the numeric column for a given observation, then
that observation is used n times for the purposes of any statistical
computation.
426 Chapter 6 • Plot Statements
For example, the Sashelp.Iris data contains a column named Species, which
identifies the species of each plant. This column could be used in the ELLIPSE
statement to group the ellipses in the display:
proc template;
define statgraph ellipsegroup;
begingraph;
entrytitle "95% Prediction By Species";
layout overlay;
scatterplot x=petallength y=petalwidth / name="sp"
group=species;
ellipse x=petallength y=petalwidth / group=species
type=predicted alpha=0.05 name="p95";
mergedlegend "sp" "p95" / location=inside
autoalign=(topleft) across=1;
endlayout;
endgraph;
end;
run;
Default Each distinct group value is represented in the plot by a different line color
and pattern. The line color is determined by the ContrastColor attribute of
ELLIPSE Statement 427
Note The group values are mapped in the order in which they appear in the data.
Tip You can individually override the representations that are used to identify
the groups. For example, in some ODS styles, each distinct group value is
represented by a different line color and pattern. In that case, you can use
the PATTERN= setting on the OUTLINEATTRS= option to assign the
same line pattern to all of the ellipses.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the MISSING= system option changes the default missing character, or
a user-defined format is applied to the group value. In those cases, the
attributes of the missing group value are determined by a GraphData1–
GraphDataN style element instead of by the GraphMissing style
element.
See “boolean ” on page 1339 for other Boolean values that you can use.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
Interaction For this option to have any effect, the outlines must be enabled by the
ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TYPE=MEAN | PREDICTED
specifies the type of ellipse.
MEAN
specifies a confidence ellipse of the mean
PREDICTED
specifies a prediction ellipse for a new observation
Default MEAN
For statistical details about how the ellipse is calculated, see “Confidence
and Prediction Ellipses ” on page 429.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
Statement Description
The ELLIPSE statement can be used only within 2-D overlay-type layouts. It computes
an ellipse for a set of points specified by the X and Y columns and a confidence level
specified by the ALPHA= option. Use the TYPE= option to control whether a predicted
or confidence ellipse is generated.
Example: ELLIPSE Statement 429
T 2 = n(Z − μ)′S−1(Z − μ)
Z new − Z = (Z new − μ) − (Z − μ)
is distributed as a bivariate normal variate with mean zero (the zero vector) and
1
covariance (1 + n )Σ, and it is independent of S. A 100(1 − α) % prediction ellipse is then
given by the following equation:
n 2(n + 1)
n−1
(Z − μ)′S−1(Z − μ) = n−2
F2, n − 2(1 − α)
The family of ellipses generated by different critical values of the F distribution has a
common center (the sample mean) and common major and minor axis directions.
The shape of an ellipse depends on the aspect ratio of the plot. The ellipse indicates the
correlation between the two variables if the variables are standardized (by dividing the
variables by their respective standard deviations). In this situation, the ratio between the
major and minor axis lengths is:
1+ r
1− r
The following graph was generated by the “Example Program” on page 430:
430 Chapter 6 • Plot Statements
Example Program
This example overlays two ELLIPSE statements on a SCATTERPLOT of the same data.
Both ELLIPSE statements use TYPE= PREDICTED. One ELLIPSE statement uses
ALPHA= 0.2, and the other uses ALPHA=0.05.
proc template;
define statgraph ellipse;
begingraph;
entrytitle "Prediction Ellipses";
layout overlayequated / equatetype=equate;
scatterplot x=petallength y=petalwidth /
datatransparency=0.5;
ellipse x=petallength y=petalwidth /
type=predicted alpha=0.2
name="p80" legendlabel="80%"
outlineattrs=graphconfidence;
ellipse x=petallength y=petalwidth /
type=predicted alpha=0.05
name="p95" legendlabel="95%"
outlineattrs=graphconfidence2;
discretelegend "p80" "p95" /
location=inside autoalign=(topleft);
endlayout;
entryfootnote halign=left "Fisher's Iris Data";
endgraph;
end;
run;
proc sgrender data=sashelp.iris template=ellipse;
run;
ELLIPSEPARM Statement 431
ELLIPSEPARM Statement
Creates an ellipse specified by slope, axis, and origin parameters.
Requirements: An ELLIPSEPARM statement must be used in a two-dimensional overlay-type layout
(for example, an OVERLAY, OVERLAYEQUATED, or PROTOTYPE layout).
The ELLIPSEPARM statement must be overlaid with another plot that is derived from
data values that provide boundaries for the axis area. It is typically overlaid with a
scatter plot.
Tip: You can generate a single ellipse by specifying a constant for each required
argument. You can generate multiple ellipses by specifying a numeric column for any
or all required arguments. If any of the SEMIMAJOR= , SEMIMINOR= , XORIGIN=
or YORIGIN= constants or columns contains a missing value, then no ellipse is
drawn. To request a vertical major axis, specify SLOPE=. (missing value) as a
constant or column value.
Syntax
ELLIPSEPARM SEMIMAJOR=number | numeric-column | expression
SEMIMINOR=number | numeric-column | expression
SLOPE=number | numeric-column | expression
XORIGIN=number | numeric-column | expression
YORIGIN=number | numeric-column | expression </option(s)>;
Appearance options
CLIP=TRUE | FALSE
specifies whether the data for the ellipse are considered when determining the
data ranges for the axes.
DATATRANSPARENCY=number
specifies the degree of the transparency of the ellipse fill color and outline.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display an outlined ellipse, a filled ellipse, or an outlined
and filled ellipse.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the ellipse.
INDEX=positive-integer-column | expression
specifies indices for mapping ellipse attributes (fill and outline) to one of the
GraphData1–GraphDataN style elements.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the ellipse outline.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
432 Chapter 6 • Plot Statements
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate ellipse for each unique group value of the specified
column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
SEMIMAJOR=number | numeric-column | expression
specifies half the length of the major axis for the ellipse. Values are in the same units
as the data. The SEMIMAJOR value can be greater than, smaller than, or equal to
the SEMIMINOR value.
Note The slope value is in the data space and might or might not be maintained in
the screen space. Thus, setting SLOPE=1 does not always generate a 45
degree line on the screen.
Tip Setting SLOPE=0 creates a major axis parallel to the X-axis. Setting
SLOPE=. (missing value) creates a major axis parallel to the Y-axis.
ELLIPSEPARM Statement 433
Tip By default, if the value specified for the XORIGIN= option is outside of the X-
axis data range, then the data range is extended to include the specified point.
This behavior can be changed with the CLIP= option.
Tip By default, if the value specified for the YORIGIN= option is outside of the Y-
axis data range, then the data range is extended to include the specified point.
This behavior can be changed with the CLIP= option.
Optional Arguments
CLIP=TRUE | FALSE
specifies whether the data for the ellipse are considered when determining the data
ranges for the axes.
FALSE
The data for the ellipse contribute to the data range for each axis. Each axis
might be extended to force the display of the entire ellipse.
TRUE
The data for the ellipse are ignored when establishing axis scales. Each axis scale
is determined by the other plots in the parent layout. This might result in the
ellipse not being entirely displayed (clipped) if its data range is not within the
data ranges of the other plots.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
DATATRANSPARENCY=number
specifies the degree of the transparency of the ellipse fill color and outline.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the
ellipse fill. You can combine this option with FILLATTRS= to set one
transparency for the ellipse outline but a different transparency for the
ellipse fill. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
(display-options)
a space-separated list of one or more of the following options enclosed in
parentheses:
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
The representations that are used to identify the groups can be overridden
individually. For example, each distinct group value might be represented by a
different line pattern for the ellipses, but the PATTERN= suboption of the
OUTLINEATTRS= option could be used to assign the same line pattern to all ellipse
outlines, letting outline color distinguish group values.
Restriction When the GROUP= option is specified, the group value must be a
character or numeric column. For each group value, there must be a
numeric column that does not contain missing values for
SEMIMAJOR=, SEMIMINOR=, XORIGIN=, and YORIGIN=.The
SLOPE=column can contain missing values. Under these
circumstances, an ellipse is drawn for each group value.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping ellipse attributes (fill and outline) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
436 Chapter 6 • Plot Statements
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Restriction Another plot that establishes a data range for the designed axis must be
included.
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Example: ELLIPSEPARM Statement 437
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Restriction Another plot that establishes a data range for the designed axis must be
included.
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
The ELLIPSEPARM statement plots an ellipse with specified semimajor and semiminor
axis lengths, a specified slope for the major axis, and the ellipse center. The ellipse
center is the point of intersection of the semimajor and semiminor axes. It can be used
only within a two-dimensional overlay-type layout (for example, an OVERLAY,
OVERLAYEQUATED, or PROTOTYPE layout). The ELLIPSEPARM statement does
not perform computations on input data to derive the location and shape of the ellipse.
Another plot that is derived from data values that provide boundaries for the axis area
must be included in the layout. It is typically overlaid with a scatter plot. See “ELLIPSE
Statement” on page 422 for information about computed ellipses.
The following graph was generated by the “Example Program” on page 438:
438 Chapter 6 • Plot Statements
Overview
This is a simplified version of the CorrLoadPlot template for PROC PLS in the
SAS/STAT product. It consists of overlaid scatter plots of the scores of the first two
factors, the loadings of the model effects, and the loadings of the dependent variables.
The loadings are scaled so that the amount of variation in the variables that is explained
by the model is proportional to the distance from the origin; circles indicating various
levels of explained variation are also overlaid.
The circles are drawn with ELLIPSEPARM statements by setting the SEMIMAJOR and
SEMIMINOR lengths to be the same. Notice that all circles are concentric because they
share the same origin (0,0). The radius of each circle is passed dynamically.
Also note that an OVERLAYEQUATED layout was used to force the length of unit
intervals on both axes to be the same.
The input data shown is representative of that computed by PROC PLS for the
Correlation Loadings Plot. For more details, see the first example for PROC PLS in the
SAS/STAT user’s guide.
Example Program
Here is the SAS program for this example.
proc template;
define statgraph ellipseparm;
dynamic RADIUS1 RADIUS2 RADIUS3 RADIUS4 ;
begingraph;
entrytitle "Correlation Loading Plot";
layout overlayequated / equatetype=square
commonaxisopts=
(tickvaluelist=(-1 -0.75 -0.5 -0.25 0 0.25 0.5 0.75 1)
viewmin=-1 viewmax=1)
xaxisopts=
(label="Factor 1" offsetmin=0.05 offsetmax=0.05)
yaxisopts=
(label="Factor 2" offsetmin=0.05 offsetmax=0.05);
ellipseparm semimajor=RADIUS1 semiminor=RADIUS1 slope=0
xorigin=0 yorigin=0 / clip=true display=(outline)
outlineattrs=(pattern=dash) datatransparency=0.75;
ellipseparm semimajor=RADIUS2 semiminor=RADIUS2 slope=0
xorigin=0 yorigin=0 / clip=true display=(outline)
outlineattrs=(pattern=dash) datatransparency=0.75;
ellipseparm semimajor=RADIUS3 semiminor=RADIUS3 slope=0
xorigin=0 yorigin=0 / clip=true display=(outline)
outlineattrs=(pattern=dash) datatransparency=0.75;
ellipseparm semimajor=RADIUS4 semiminor=RADIUS4 slope=0
xorigin=0 yorigin=0 / clip=true display=(outline)
outlineattrs=(pattern=dash) datatransparency=0.75;
run;
data corrplot;
infile cards missover;
input Corr1 Corr2 CorrGroup &$18. CorrLabel :$7.
xCircleLabel yCircleLabel CircleLabel :$8.;
datalines;
-0.179 -0.268 Predictor Loading S1 0 0.5 25%
0.105 0.332 Predictor Loading S2 0 -0.5 25%
-0.654 0.094 Predictor Loading S3 0 0.707 50%
-0.653 0.685 Predictor Loading S4 0 -0.707 50%
0.096 0.059 Predictor Loading S5 0 0.866 75%
0.132 0.036 Predictor Loading L1 0 -0.866 75%
0.087 0.156 Predictor Loading L2 0 1 100%
0.940 0.160 Predictor Loading L3 0 -1 100%
0.607 -0.350 Predictor Loading L4
0.096 0.059 Predictor Loading L5
-0.111 -0.534 Predictor Loading P1
0.003 0.256 Predictor Loading P2
0.293 0.551 Predictor Loading P3
-0.480 0.643 Predictor Loading P4
-0.096 -0.059 Predictor Loading P5
0.946 0.279 Response Loading log_RAI
-0.196 0.403 Observation 1
0.020 -0.001 Observation 2
-0.195 0.324 Observation 3
0.021 -0.079 Observation 4
-0.009 -0.274 Observation 5
0.567 0.294 Observation 6
-0.096 -0.059 Observation 7
0.258 0.210 Observation 8
-0.104 -0.309 Observation 9
-0.187 -0.458 Observation 10
0.051 -0.078 Observation 11
0.017 -0.260 Observation 12
-0.621 0.372 Observation 13
0.392 0.138 Observation 14
0.080 -0.221 Observation 15
run;
FRINGEPLOT Statement
Creates a fringe plot on the X axis of an X-Y plot.
Syntax
FRINGEPLOT numeric-column | expression </option(s)>;
440 Chapter 6 • Plot Statements
Appearance options
DATATRANSPARENCY=number
specifies the degree of the transparency of the fringe.
FRINGEHEIGHT=dimension
specifies the height of the fringe lines.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of
the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the fringe lines for the data points.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a distinct set of lines for each unique group value of the specified
column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Argument
numeric-column | expression
specifies a column that provides the X coordinates of the data values.
FRINGEPLOT Statement 441
Optional Arguments
DATATRANSPARENCY=number
specifies the degree of the transparency of the fringe.
Default 0
FRINGEHEIGHT=dimension
specifies the height of the fringe lines.
Default 10 px
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of colors and line
patterns.
Note You can override the representations that are used to identify the
groups. For example, you can use the
LINEATTRS=(PATTERN=pattern) option to assign the same line
pattern to all of the plot’s line patterns, letting line color indicate group
values. Likewise, you can use LINEATTRS=(COLOR=color) to
assign the same color to all lines, letting line pattern indicate group
values.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
442 Chapter 6 • Plot Statements
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The X-column label. If a label is not defined, then the X-column name
is used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined role X.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a fringe line.
If this option is used, then it replaces all of the information that is displayed by
default. Roles for columns that do not contribute to the fringe plot can be specified
along with roles that do.
role-list
an ordered, space-separated list of unique FRINGEPLOT and user-defined roles.
The FRINGEPLOT role is X.
Example The following example displays data tips for the columns assigned to
the roles X and Y, as well as the column Pct, which is not assigned to
any pre-defined FRINGEPLOT role. The Pct column should appear
first in the data tip:
ROLENAME=(TIP1=PCT)
TIP=(X TIP1)
NONE
suppresses data tips from the plot.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
444 Chapter 6 • Plot Statements
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Example: FRINGEPLOT Statement 445
Note The display of the fringe lines is always anchored on the X-axis (at the
bottom of the plot area), even when the FRINGEPLOT’s X-column
data range is mapped to the X2 axis.
Details
In a FRINGEPLOT, each fringe line represents the location of the corresponding raw
data value on the X axis. All fringe lines are of equal length.
The following graph was generated by the “Example Program” on page 445:
Example Program
proc template;
define statgraph fringeplot;
dynamic VAR VARLABEL;
begingraph;
entrytitle "Histogram and Fringeplot";
layout overlay / xaxisopts=(label=VARLABEL)
yaxisopts=(offsetmin=0.03);
fringeplot VAR / datatransparency=0.75
fringeheight=3pct;
histogram VAR;
endlayout;
endgraph;
end;
run;
446 Chapter 6 • Plot Statements
HEATMAP Statement
Creates a plot of color-coded rectangles for the response variable of a pair of X and Y variables after it bins
the data in two dimensions.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Syntax
HEATMAP X=numeric-column | expression
Y=numeric-column | expression </option(s)>;
Appearance options
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies a numeric column that is used to color the heat map regions.
COLORSTAT= FREQ | PCT | PROPORTION | SUM | MEAN
specifies the statistic to be calculated for the COLORRESPONSE= column.
DATATRANSPARENCY=number
specifies the degree of the transparency of the outline and fill for each region.
DISPLAY=ALL | STANDARD | (display-options)
specifies the degree of the transparency of the rectangles.
FILLATTRS=(TRANSPARENCY=number)
specifies the transparency of the interior fill area of the regions.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the rectangle outlines.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient that is specified by the ODS style
that is in effect or by the COLORMODEL= option.
WEIGHT=numeric-column
specifies a variable in the input data set that contains values to be used as a
priori weights for the colored-region calculations.
XGAP=number
specifies the amount of horizontal space on either side of each color-coded
region in the heat map.
YGAP=number
specifies the amount of horizontal space on either side of each color-coded
region in the heat map.
Axes options
PRIMARY=TRUE | FALSE
HEATMAP Statement 447
specifies that the data columns for this plot are used for determining default
axis features.
XAXIS=X | X2
specifies whether data is mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
XBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for x-axis tick marks.
XENDLABELS=TRUE | FALSE
specifies whether the X axis ticks and tick values are placed at the bin end-
points or at the bin mid-points.
YAXIS=Y | Y2
specifies whether data is mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
YBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for x-axis tick marks.
YENDLABELS=TRUE | FALSE
specifies whether the Y axis ticks and tick values are placed at the bin end-
points or at the bin mid-points.
Binning options
NXBINS=positive-integer
specifies the number of bins to use for the X role.
NYBINS=positive-integer
specifies the number of bins to use for the Y role.
XBINSIZE=positive-number
specifies the size of bins along the X role, in data units.
XBINSTART=number
specifies the data value for the first bin of the X role.
XBOUNDARY=UPPER | LOWER
specifies how an input value is counted when it lies on the endpoint of an X
bin.
XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the XBINSTART= value represents the midpoint, lower
endpoint, or upper endpoint of the bin.
YBINSIZE=positive-number
specifies the size of bins along the Y role, in data units.
YBINSTART=number
specifies the data value for the first bin of the Y role.
YBOUNDARY=UPPER | LOWER
specifies how an input value is counted when it lies on the endpoint of an Y
bin.
YVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the YBINSTART= value represents the midpoint, lower
endpoint, or upper endpoint of the bin.
Data option
DISCRETEX=TRUE | FALSE
specifies whether the X axis is discrete when X= specifies a numeric column.
DISCRETEY=TRUE | FALSE
specifies whether the Y axis is discrete when Y= specifies a numeric column.
448 Chapter 6 • Plot Statements
Statistics options
FREQ=numeric-column | expression
specifies a column for the frequency count for each observation in the input
data.
Required Arguments
X=column | expression
specifies the column for the X values.
Y=column | expression
specifies the column for the Y values.
Optional Arguments
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
HEATMAP Statement 449
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To reverse the start and end colors of the ramp that is assigned to the
color model, use the REVERSECOLORMODEL= option.
Use the COLORSTAT= option to specify the statistic to compute for the
COLORRESPONSE= column.
Default FREQ
See COLORRESPONSE=
FREQ=
WEIGHT=
DATATRANSPARENCY=number
specifies the degree of the transparency of the outline and fill for each region.
Default 0
Tip Use the FILLATTRS= option to set transparency for just the rectangle fills.
You can combine this option with FILLATTRS= to set one transparency for
the rectangle outlines and a different transparency for the rectangle fills.
Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
DISCRETEX=TRUE | FALSE
specifies whether the X axis is discrete when X= specifies a numeric column.
Default FALSE
Requirement If X= specifies a numeric column and the X axis type is discrete, then
you must specify DISCRETEX=TRUE. Otherwise, the heat map
might not be drawn.
DISCRETEY=TRUE | FALSE
specifies whether the Y axis is discrete when Y= specifies a numeric column.
Default FALSE
Requirement If Y= specifies a numeric column and the Y axis type is discrete, then
you must specify DISCRETEY=TRUE. Otherwise, the heat map
might not be drawn.
Default STANDARD
FILLATTRS=(TRANSPARENCY=number)
specifies the transparency of the interior fill area of the regions.
Tip Use this option when you want the region fill to have a different degree
of transparency than the outline.
FREQ=numeric-column | expression
specifies a column for the frequency count for each observation in the input data.
Restrictions If the value of FREQ for a given observation is missing or is less than
1, that observation is not used in the analysis.
NAME="string"
assigns a name to a HEATMAP statement for reference in other template statements
and log messages.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
NXBINS=positive-integer
specifies the number of bins to use for the X role. The system determines the
XBINSIZE= and XBINSTART= values if they are not specified. The bins always
span the range of the data.
NYBINS=positive-integer
specifies the number of bins to use for the Y role. The system determines the
YBINSIZE= and YBINSTART= values if they are not specified. The bins always
span the range of the data.
Interaction For this option to have any effect, outlines must be enabled by the ODS
style or by the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element value
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot are used for determining default axis
features.
Tip This option is needed only when there are two or more plots within an
overlay that contribute to a common axis. If PRIMARY=TRUE for
one of them, then that plot’s data columns are used to determine the
axis features, regardless of where this plot statement occurs within the
OVERLAY layout block.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient that is specified by the ODS style that is in
effect or by the COLORMODEL= option.
Default FALSE
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
HEATMAP Statement 453
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, COLORGROUP=, and
COLORRESPONSE=.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a rectangle. If
this option is used, the specified information replaces all the information that is
displayed by default. You can specify roles for columns that do not contribute to the
bar chart along with roles that do.
(role-list)
an ordered, space-separated list of unique HEATMAP roles and user-defined
roles. HEATMAP roles include X, Y, and the implicit count.
Example To display data tips for the columns assigned to the roles X and Y as
well as the user-defined role TIP1:
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
NONE
suppresses data tips and URLs (if requested) in the graph output.
Default The columns assigned to these roles are automatically included in the
data tip information: X and Y
Tip You can control the labels and formats for the TIP variables with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns.
(role-format-list)
a space-separated list of role-name = format pairs.
Default The column format of the variable assigned to the role or BEST6. if
no format is assigned to a numeric column.
Requirement This option provides a way to control the formats of columns that
appear in data tips. Only the roles that appear in the TIP= option are
used.
TIPLABEL=(role-label-list)
specifies display labels for tip columns.
454 Chapter 6 • Plot Statements
(role-label-list)
a space-separated list of role-name ="string" pairs.
Default The column label or column name of the variable assigned to the
role.
Requirement This option provides a way to control the labels of columns that
appear in data tips. Only the roles that appear in the TIP= option are
used.
WEIGHT=numeric-column
specifies a variable in the input data set that contains values to be used as a priori
weights for the colored-region calculations.
XAXIS=X | X2
specifies whether data is mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
XBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for x-axis tick marks. When this option is
FALSE, a standard axis is used, ignoring bin boundaries and midpoints.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
HEATMAP Statement 455
XBINSIZE=positive-number
specifies the size of bins along the X role, in data units. The system determines the
NXBINS= and XBINSTART= values if they are not specified. The bins always span
the X data range.
XBINSTART=number
specifies the data value for the first bin of the X role. The system determines the
NXBINS= and XBINSIZE= values if they are not specified. The bins always span
the X data range.
XBOUNDARY=UPPER | LOWER
specifies how an input value is counted when it lies on the endpoint of an X bin. If
this option is set to UPPER, then the value is counted as one of the values in the
upper bin. Otherwise, it is counted in the lower bin.
Default UPPER
XENDLABELS=TRUE | FALSE
specifies whether the X axis ticks and tick values are placed at the bin end-points or
at the bin mid-points.
Default FALSE. The axis ticks and tick values are placed at the bin mid-
points.
Tip The axis ticks and tick value placements are independent of the
XVALUES= option.
XGAP=number
specifies the amount of horizontal space on either side of each color-coded region in
the heat map.
Default 0
Default MIDPOINTS
YAXIS=Y | Y2
specifies whether data is mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for x-axis tick marks. When this option is
FALSE, a standard axis is used, ignoring bin boundaries and midpoints.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
YBINSIZE=positive-number
specifies the size of bins along the Y role, in data units. The system determines the
NYBINS= and YBINSTART= values if they are not specified. The bins always span
the Y data range.
YBINSTART=number
specifies the data value for the first bin of the Y role. The system determines the
NYBINS= and YBINSIZE= values if they are not specified. The bins always span
the Y data range.
YBOUNDARY=UPPER | LOWER
specifies how an input value is counted when it lies on the endpoint of an Y bin. If
this option is set to UPPER, then the value is counted as one of the values in the
upper bin. Otherwise, it is counted in the lower bin.
Default UPPER
HEATMAP Statement 457
YENDLABELS=TRUE | FALSE
specifies whether the Y axis ticks and tick values are placed at the bin end-points or
at the bin mid-points.
Default FALSE. The axis ticks and tick values are placed at the bin mid-
points.
Tip The axis ticks and tick value placements are independent of the
YVALUES= option.
YGAP=number
specifies the amount of horizontal space on either side of each color-coded region in
the heat map.
Default 0
Default MIDPOINTS
The following graph was generated by the “Example Program” on page 458.
Example Program
proc template;
define statgraph heatmap;
begingraph;
entrytitle "Vehicle Mileage By Curb Weight";
layout overlay /
xaxisopts=(label="Curb Weight (LBS)");
heatmap x=weight y=mpg_city / name="heatmap"
nybins=11 ybinstart=10 ybinsize=5
nxbins=11 xbinstart=2000 xbinsize=500;
continuouslegend "heatmap" / title="Count"
location=outside;
endlayout;
endgraph;
end;
run;
HEATMAPPARM Statement
Creates a two-dimensional plot that represents the values of three variables. Generating an X, Y grid of
rectangles from the values of two independent variables, it colors the rectangles to represent the values of
a third variable, which can be a response variable or a group variable.
Requirements: The COLORGROUP= or the COLORRESPONSE= role must be specified.
The data for a parameterized heat map in a single-cell graph or in a cell in a
classification panel must have at least two bins for both the X and Y axes.
Otherwise, the heat map is not drawn.
Note: The data for a parameterized heat map should contain only one observation for each
X and Y value pair.
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Syntax
HEATMAPPARM X=column | expression
Y=column | expression
COLORGROUP=column | discrete-attr-var | expression </option(s)>;
HEATMAPPARM X=column | expression
Y=column | expression
COLORRESPONSE=numeric-column | range-attr-var | expression </option(s)>;
Appearance options
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
DATATRANSPARENCY=number
specifies the degree of the transparency of the filled rectangles.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display outlined, colored rectangles or just colored
rectangles.
FILLATTRS=(TRANSPARENCY=number)
specifies the transparency of the area fill in the rectangles.
INCLUDEMISSINGCOLOR=TRUE | FALSE
specifies whether missing values of the color-group variable or of the color-
response variable are included in the plot.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the outlines of the filled rectangles.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
460 Chapter 6 • Plot Statements
XGAP=number
specifies the amount of horizontal space on either side of each filled
rectangle.
XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the input X values represent midpoints, lower endpoints, or
upper endpoints of the bins.
YGAP=number
specifies the amount of vertical space on either side of each filled rectangle.
YVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the input Y values represent midpoints, lower endpoints, or
upper endpoints of the bins.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
XBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for X-axis tick marks.
XBOUNDARIES=(numeric-list)
specifies the boundaries of the X-value bins.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
YBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for Y-axis tick marks.
YBOUNDARIES=(numeric-list)
specifies the boundaries of the Y-value bins.
Data option
DISCRETEX=TRUE | FALSE
specifies whether the X axis is discrete when X= specifies a numeric column.
DISCRETEY=TRUE | FALSE
specifies whether the Y axis is discrete when Y= specifies a numeric column.
Label options
XENDLABELS=TRUE | FALSE
HEATMAPPARM Statement 461
specifies whether the axis ticks and value labels are drawn at the endpoints of
the bins or midpoints of the bins.
YENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the endpoints of
the bins or midpoints of the bins.
ODS options
URL=string-column
specifies an HTML page to display when a rectangle is selected.
Required Arguments
X=column | expression
specifies the column for the X values.
Y=column | expression
specifies the column for the Y values.
When numeric-column or expression is specified, the colors for each region are
computed by mapping the values to a color ramp that is defined by the
COLORMODEL= option. When attr-variable is specified, the colors defined in the
associated RANGEATTRVAR or DISCRETEATTRVAR statement are used to color
the regions.
Optional Arguments
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To reverse the start and end colors of the ramp that is assigned to the
color model, use the REVERSECOLORMODEL= option.
HEATMAPPARM Statement 463
DATATRANSPARENCY=number
specifies the degree of the transparency of the filled rectangles.
Default 0
DISCRETEX=TRUE | FALSE
specifies whether the X axis is discrete when X= specifies a numeric column.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default FALSE
DISCRETEY=TRUE | FALSE
specifies whether the Y axis is discrete when Y= specifies a numeric column.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default FALSE
ALL
displays outlined, colored rectangles
(display-options)
a space-separated list of one or more of options enclosed in parentheses.
Currently, only the OUTLINE option is supported, which displays outlines
around the filled rectangles (same as keyword ALL).
Default STANDARD
FILLATTRS=(TRANSPARENCY=number)
specifies the transparency of the area fill in the rectangles.
INCLUDEMISSINGCOLOR=TRUE | FALSE
specifies whether missing values of the color-group variable or of the color-response
variable are included in the plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default TRUE
“boolean ” on page 1339 for other Boolean values that you can use.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction For this option to have any effect, outlines must be enabled by the ODS
style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, COLORGROUP=, and
COLORRESPONSE=.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a filled
rectangle. If this option is used, then it replaces all of the information that is
displayed by default. Roles for columns that do not contribute to the heat map can be
specified along with roles that do.
(role-list)
an ordered, space-separated list of unique HEATMAPPARM and user-defined
roles. HEATMAPPARM roles include X and Y.
Example The following example displays data tips for the columns X and PCT.
The Pct column is not assigned to any pre-defined HEATMAPPARM
role, so it must first be assigned a role:
ROLENAME=(TIP1=PCT)
TIP=(X TIP1)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X and Y, and COLORGROUP= or
COLORRESPONSE=.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP variables can be controlled with
the TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
HEATMAPPARM Statement 467
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a rectangle is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
rectangle that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Tips The URL value can be blank for some X and Y pairs. In that case, no
action is taken when the corresponding rectangle is selected.
The URL value can be the same for any X and Y pairs. In that case,
the same action is taken when the rectangle for those X and Y pairs is
selected.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
468 Chapter 6 • Plot Statements
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
XBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for X-axis tick marks. When this option is
FALSE, a standard axis is used, ignoring bin boundaries and midpoints.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
XBOUNDARIES=(numeric-list)
specifies the boundaries of the X-value bins. The boundaries are specified as a space-
separated list of values enclosed in parentheses. The keywords MIN and MAX can
be used as one of the values in the list of boundaries. Keywords MIN and MAX
indicate the minimum and maximum data values for the X variable.
XENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the endpoints of the
bins or midpoints of the bins.
Default FALSE. The axis ticks and values labels are drawn at the bin
midpoints.
Interactions If this option is set to FALSE, then the axis ticks and value labels are
drawn at the bin midpoints, regardless of whether the XVALUES=
option identifies the X data as endpoint values or midpoint values.
See “boolean ” on page 1339 for other Boolean values that you can use.
XGAP=number
specifies the amount of horizontal space on either side of each filled rectangle.
Default 0
Default MIDPOINTS
See XENDLABELS=
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YBINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for Y-axis tick marks. When this option is
FALSE, a standard axis is used, ignoring bin boundaries and midpoints.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
YBOUNDARIES=(numeric-list)
specifies the boundaries of the Y-value bins. The boundaries are specified as a space-
separated list of values enclosed in parentheses. The keywords MIN and MAX can
be used as one of the values in the list of boundaries. Keywords MIN and MAX
indicate the minimum and maximum data values for the Y variable. Example:
yboundaries=(MIN 20 200 250 MAX)
YENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the endpoints of the
bins or midpoints of the bins.
Default FALSE. The axis ticks and values labels are drawn at the bin
midpoints.
Interactions If this option is set to FALSE, then the axis ticks and value labels are
drawn at the bin midpoints, regardless of whether the YVALUES=
option identifies the Y data as endpoint values or midpoint values.
See “boolean ” on page 1339 for other Boolean values that you can use.
470 Chapter 6 • Plot Statements
YGAP=number
specifies the amount of vertical space on either side of each filled rectangle.
Default 0
Default MIDPOINTS
See YENDLABELS=
Details
A heat map is useful for visualizing the magnitude of a response variable in relation to
two independent variables. For example, in molecular biology, heat maps can be used to
track the expression of genes across multiple sample studies. In the HEATMAPPARM
statement, you specify the independent variables in the X and Y arguments. For a
response variable that has discrete values, use the COLORGROUP argument, or for a
response variable that has interval values, use the COLORRESPONSE argument. For
interval response variables, you can use the COLORMODEL= option to define the color
ramp that is used to fill the rectangles.
The following graph was generated by the “Example Program” on page 471:
HIGHLOWPLOT Statement 471
Example Program
proc template;
define statgraph heatmapparm;
begingraph;
layout overlay;
heatmapparm x=height y=weight colorresponse=count /
name="heatmapparm" xbinaxis=false ybinaxis=false;
continuouslegend "heatmapparm" / location=outside valign=bottom;
endlayout;
endgraph;
end;
run;
HIGHLOWPLOT Statement
Creates a display of floating vertical or horizontal lines or bars that connect the minimum and maximum
response values for each value of a categorical variable.
Requirements: Either the X= or Y= argument must be specified, but you cannot specify both on the
same HIGHLOWPLOT statement.
The HIGH= and LOW= arguments are required.
Note: Specifying the X= option creates a vertical high-low chart, which would typically be
used in the financial industry to plot stock values over time. Specifying the Y= option
creates a horizontal high-low chart, which would typically be used in the Health and
Life Sciences industry to display over time the duration of adverse events or of
adverse reactions to medication.
Tips: For charts that have a large number of bars that are very close together, slight
variations in spacing that normally occur due to integer rounding can become more
obvious. Subpixel rendering provides more precise bar spacing in that case. In the
second maintenance release of SAS 9.4 and in earlier releases, specify
SUBPIXEL=ON in the BEGINGRAPH statement to enable subpixel rendering. See
SUBPIXEL= on page 33. Starting with the third maintenance release of SAS 9.4,
subpixel rendering is enabled by default.
To disable subpixel rendering in the third maintenance release of SAS 9.4 and in
later releases, specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an
ODS GRAPHICS statement. For information about the BEGINGRAPH statement
SUBPIXEL= option, see SUBPIXEL= on page 33. For information about the ODS
GRAPHICS statement SUBPIXEL= option, see “ODS GRAPHICS Statement” in
SAS ODS Graphics: Procedures Guide.
Syntax
HIGHLOWPLOT X=column | expression
LOW=numeric-column | expression
HIGH=numeric-column | expression </option(s)>;
HIGHLOWPLOT Y=column | expression
LOW=numeric-column | expression
HIGH=numeric-column | expression </option(s)>;
472 Chapter 6 • Plot Statements
Appearance options
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
CLIPCAP=TRUE | FALSE
specifies whether a special clip cap is displayed to indicate where clipping
occurred.
CLIPCAPSHAPE=DEFAULT | BARBEDARROW | CLIPPEDARROW |
CLOSEDARROW | FILLEDARROW | OPENARROW | SERIF
specifies the shape of the arrowhead on the clipped end of a line or bar when
CLIPCAP=TRUE.
CLOSE=numeric-column | expression
specifies a column or expressions whose values are used to display a closing-
value indicator.
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group
clusters as a fraction of the minimum interval between adjacent data values.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute variable to use to map the bar or line
colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bars or lines of a high-low chart.
DATATRANSPARENCY=number
specifies the degree of the transparency of the colored regions, and the high-
end and low-end labels.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display outlined colored regions or just colored regions.
ENDCAPDISPLAYPOLICY=AUTO | ALWAYS
specifies the policy for displaying end caps when end caps are present.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the bars.
HIGHCAP=column | NONE | SERIF | BARBEDARROW | FILLEDARROW |
OPENARROW | CLOSEDARROW
specifies the type of cap used at the high end of the bar or line.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) or bar
attributes (fill and outline) to one of the GraphData1–GraphDataN style
elements.
INTERVALBARWIDTH=dimension
specifies the width of the floating bars.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the floating plot lines.
LOWCAP=column | NONE | SERIF | BARBEDARROW | FILLEDARROW |
OPENARROW | CLOSEDARROW
specifies the type of cap used at the low end of the bar or line.
OPEN=numeric-column | expression
HIGHLOWPLOT Statement 473
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
HIGHLABEL=column | expression
specifies the label to display at the high end of the bar or line.
LABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the labels for the bars or lines.
LOWLABEL=column | expression
specifies the label to appear at the low end of each floating bar or line.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all bars or lines from the category midpoints
when graphing multiple response variables side by side on a common axis.
GROUP=column | discrete-attr-var | expression
creates a distinct set of floating bars or lines for each unique group value in
the specified column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies whether grouped bars or lines are overlaid or clustered around the
category midpoints.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
474 Chapter 6 • Plot Statements
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
Either the X= or Y= argument must be specified, but you cannot specify both on the
same HIGHLOWPLOT statement. The HIGH= and LOW= arguments are required.
X=column | expression
specifies a column or expression representing the values in a vertical high-low chart.
The values can be character or numeric.
Y=column | expression
specifies a column or expression representing the values in a horizontal high-low
chart. The values can be character or numeric.
LOW=numeric-column | expression
specifies a column or expression representing the values of the lower end of the
floating bar or line.
HIGH=numeric-column | expression
specifies a column or expression representing the values of the higher end of the
floating bar or line.
Optional Arguments
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
Default 0.85
Interaction Prior to the third maintenance release of SAS 9.4, this option is ignored
for an interval high-low plot, and the bar width is controlled by the
INTERVALBARWIDTH= option. Starting with the third maintenance
release of SAS 9.4, this option is honored for an interval high-low plot
but it can be overridden by the INTERVALBARWIDTH= option.
CLIPCAP=TRUE | FALSE
specifies whether a special clip cap is displayed to indicate where clipping occurred.
When the VIEWMIN= and VIEWMAX= axis options are specified for an axis and a
data value exceeds the specified axis range, the bar for that value is clipped. In that
HIGHLOWPLOT Statement 475
case, when CLIPCAP=TRUE, a special clip cap is displayed at the clipped end of the
bar. If the bar already has a high or low cap, then it is replaced by the clip cap.
For vertical bars, the clip cap is added to the end of the bar that is clipped by the Y
axis range. The default clip cap is a vertical clipped arrowhead that points toward the
clip edge ( or ). For horizontal bars, the cap is added to the end of the bar that is
clipped by the X axis range. The default clip cap is a horizontal clipped arrowhead
that points toward the clip edge ( or ). If an entire bar is clipped, then a clip cap
is displayed at the high or low side where the bar was clipped.
The following figure shows a side-by-side comparison of a vertical line high-low
chart with no clipping and with clipping when CLIPCAP=TRUE.
The first graph shows the default case in which no clipping occurs. The second graph
shows the case in which VIEWMIN= and VIEWMAX= specify a range that causes
clipping on the Y axis. In the second graph, the clip caps indicate clipping for each
category line as follows:
Default FALSE
Interaction Clip caps appear only when CLIPCAP=TRUE and the data values
exceed the axis range that is specified by the VIEWMIN= and
VIEWMAX= options. When the VIEWMIN= and VIEWMAX=
options are not specified, the axis range is adjusted to accommodate the
data values and clipping does not occur.
Note If the HIGHLABEL= and LOWLABEL= options are in effect and the
bar is clipped, then the label value at the clipped end is drawn at the tip
of the clip cap. If the entire bar is clipped, then the labels are not
shown.
476 Chapter 6 • Plot Statements
See “boolean ” on page 1339 for other Boolean values that you can use.
In the first maintenance release of SAS 9.4 and earlier releases, this option specifies
the arrowhead shape only for the clipped end of clipped lines (TYPE=LINE). For
bars (TYPE=BAR), this option is ignored, and CLIPPEDARROW is always used as
the arrowhead shape for the clipped end of clipped bars.
Starting with the second maintenance release of SAS 9.4, this option specifies the
arrowhead shape for the clipped end of clipped lines or clipped bars. For bars, you
can specify the CLIPPEDARROW shape for filled and unfilled bars. When any
value other than CLIPPEDARROW or DEFAULT is specified for bars, the
FILLEDARROW shape is used for filled bars, and the CLOSEDARROW shape is
used for unfilled bars.
CLOSE=numeric-column | expression
specifies a column or expressions whose values are used to display a closing-value
indicator. This option is typically used when TYPE=LINE, but it can be used when
TYPE=BAR. For vertical high-low charts, the value is represented by a short
horizontal line extending from the side that displays the higher X values. For
horizontal high-low charts, the value is represented by a short vertical line extending
from the side that displays the higher Y values.
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group clusters as a
fraction of the minimum interval between adjacent data values.
Default 0.85
HIGHLOWPLOT Statement 477
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Interaction For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
When only the outlines are displayed, this option overrides suboption
COLOR= in the OUTLINEATTRS= option and varies the outline
color according to the color gradient or the attribute map.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
HIGHLOWPLOT Statement 479
DATATRANSPARENCY=number
specifies the degree of the transparency of the colored regions, and the high-end and
low-end labels.
Default 0
Tip The FILLATTRS option can be used to set transparency for just the colored
regions. You can combine this option with FILLATTRS= to set one
transparency for the outlines but a different transparency for the region
fills . Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
DISCRETEOFFSET=number
specifies an amount to offset all bars or lines from the category midpoints when
graphing multiple response variables side by side on a common axis.
Default 0 (no offset, all bars or lines are centered on the category midpoints)
Range –0.5 to +0.5, where 0.5 represents half the distance between category
ticks. Normally, a positive offset is to the right for a vertical plot and up
for a horizontal plot. (If the layout's axis options set
REVERSE=TRUE, then the offset direction is also reversed.)
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
Interaction For this option to take effect, TYPE=BAR must also be specified.
ENDCAPDISPLAYPOLICY=AUTO | ALWAYS
specifies the policy for displaying end caps when end caps are present.
AUTO
draws the end caps only for the elements with a low-to-high range that is large
enough to accommodate the end caps. Draws just the bar or line for the rest.
ALWAYS
always draws the end caps.
Note When the low-to-high range is not large enough for the end caps, the end
caps might overlap. The data ranges that are smaller than the end-cap size
might not be resolvable beyond the rendered size of the end caps.
Default AUTO
Interactions This option is honored only when the option TYPE=LINE is in effect.
Interactions For this option to take effect, TYPE=BAR must also be specified, and
the DISPLAY= option must allow the fill to be displayed.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
discrete-attr-var
specifies a discrete attribute map variable that is defined in a
DISCRETEATTRVAR statement.
Defaults For filled bars, each distinct group value is represented in the plot by a
different fill color. The fill colors are defined by the Color attribute of
the GraphData1–GraphDataN and GraphMissing style elements.
For floating lines and outlined bars, each distinct group value is
represented in the plot by a different line color and line pattern. The
line colors and line patterns are defined by the ContrastColor and
LineStyle attributes of the GraphData1–GraphDataN and
GraphMissing style elements.
Interactions If the X or Y role is discrete, then the bars or lines representing the
group can be drawn in a cluster or overlaid, based on the setting for
the GROUPDISPLAY= option. However, if the X or Y role is interval,
then the lines representing the group are overlaid and the
GROUPDISPLAY= option is ignored.
By default, the group values are mapped in the order of the data. Use
the GROUPORDER= option to control the sorting order of the
grouped bar segments. Use the INDEX= option to alter the default
sequence of colors and line patterns.
Tip The representations that are used to identify the groups can be
overridden. For example, if each distinct group value is represented by
a different line pattern, you can use the
LINEATTRS=(PATTERN=pattern) specification to assign the same
line pattern to all the plot lines. In that case, the line color denotes
group values. Likewise, you can use LINEATTRS=(COLOR=color)
to assign the same color to all lines, letting line pattern denote group
values.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies whether grouped bars or lines are overlaid or clustered around the category
midpoints.
OVERLAY
centers the bars or lines for matching category values on the midpoints. The bars
or lines in each set of group values are superimposed on each other.
CLUSTER
clusters the bars or lines for matching category values around the midpoints.
Each cluster of group values is centered at the midpoint for the category.
482 Chapter 6 • Plot Statements
The following example shows the effect of clustering the lines in a stock report when
the category values are grouped into a single response variable. Note that if your
category values are not grouped in the same column but are stored in separate
columns, then you can get this same effect by using the DISCRETEOFFSET=
option.
layout overlay /
yaxisopts=(label="Stock Value");
highlowplot x=month high=high low=low /
close=close open=open
legendlabel="Stock" name="cluster"
group=stock groupdisplay=cluster
lineattrs=(pattern=solid);
discretelegend "cluster" / title="Stock"
location=inside halign=right valign=top;
endlayout;
Default OVERLAY
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
HIGHLOWPLOT Statement 483
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
Default NONE
Interaction When TYPE=BAR, the caps are drawn to fit within the bar width. The
width of the bar itself is reduced.
Note If the length of the high-low element is smaller than the cap, then the
cap is not drawn.
HIGHLABEL=column | expression
specifies the label to display at the high end of the bar or line.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) or bar attributes
(fill and outline) to one of the GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped
according to the setting of the GROUPORDER= option.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
HIGHLOWPLOT Statement 485
INTERVALBARWIDTH=dimension
specifies the width of the floating bars.
Defaults Prior to the third maintenance release of SAS 9.4, 85% of the smallest
interval between any two bars for the given plot
Restriction For this option to take effect, TYPE=BAR must be set, and the
independent variable must be of type interval.
Interaction Prior to the third maintenance release of SAS 9.4, this option controls
the bar width for a high-low plot. Starting with the third maintenance
release of SAS 9.4, this option overrides the BARWIDTH= option.
Defaults In the second maintenance release of SAS 9.4 and earlier releases, the
GraphDataText style element.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
Interaction For this option to have any effect, TYPE= LINE must also be specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default NONE
Interaction When TYPE=BAR, the caps are drawn to fit within the bar width. The
width of the bar itself is reduced.
Note If the length of the high-low element is smaller than the cap, then the
cap is not drawn.
LOWLABEL=column | expression
specifies the label to appear at the low end of each floating bar or line.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
OPEN=numeric-column | expression
specifies a column or expressions whose values are used to display an opening-value
indicator. This option is typically used when TYPE=LINE, but it can be used when
TYPE=BAR. For vertical high-low charts, the value is represented by a short
horizontal line extending from the side that displays the lower X values. For
horizontal high-low charts, the value is represented by a short vertical line extending
from the side that displays the lower Y values.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the outlines of the filled regions.
Interactions For this option to have any effect, TYPE=BAR must be specified, and
outlines must be enabled by the ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, LOW, HIGH, OPEN, and CLOSE.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a bar or line.
If this option is used, then the information specified replaces all of the information
that is displayed by default. You can specify roles for columns that do not contribute
to the bar chart along with roles that do.
(role-list)
an ordered, space-separated list of unique HIGHLOWPLOT and user-defined
roles. HIGHLOWPLOT roles include X, Y, LOW, HIGH, OPEN, CLOSE,
GROUP, and COLORRESPONSE.
Example The following example displays data tips for the columns X and Pct.
The Pct column is not assigned to any pre-defined HIGHLOWPLOT
role, so it must first be assigned a role.
ROLENAME=(TIP1=PCT)
TIP=(X TIP1)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X or Y and GROUP.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement with the IMAGEMAP option specified,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
HIGHLOWPLOT Statement 489
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TYPE=LINE | BAR
specifies whether data values should be represented by bars or lines.
Default LINE
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
Statement Description
A high-low chart specifies that floating vertical or horizontal lines or bars connect the
minimum and maximum response values for each value of a categorical variable. The
data should have at least two response values for every category value. Otherwise, the
single value is displayed without the connecting line or bar. In the statement syntax, the
X and Y arguments can specify a column with character or numeric values. The LOW
and HIGH arguments must specify a numeric column.
The HIGHLOWPLOT statement can be used to create a plot showing the high and low
response values for observations along a time axis. The independent variable can be
interval or discrete. The HIGHLOWPLOT has two common uses:
• One typical use of a high-low chart is in the financial industry to plot stock values by
day. The OPEN= and CLOSE= options are typically used in the plot, and the TYPE=
490 Chapter 6 • Plot Statements
Examples
Example Program
proc template;
define statgraph highlow;
begingraph;
layout overlay /
492 Chapter 6 • Plot Statements
Example Program
data highlowbar;
length cap $ 12;
input drug $ 1-10 low high cap $;
datalines;
Drug A 10 20 NONE
Drug A 30 60 FILLEDARROW
Drug B 20 35 NONE
Drug B 50 75 FILLEDARROW
Drug C 30 90 FILLEDARROW
;
proc template;
define statgraph highlowbar;
begingraph;
entrytitle 'Medications Plot';
layout overlay /
HISTOGRAM Statement 493
xaxisopts=(
griddisplay=on
linearopts=(viewmin=0 viewmax=100)
display=(line ticks tickvalues))
yaxisopts=(
griddisplay=on
display=(line ticks tickvalues));
highlowplot y=drug high=high low=low /
group=drug outlineattrs=(pattern=solid)
datatransparency=0.4
type=bar barwidth=0.4
highcap=cap lowcap=cap;
endlayout;
endgraph;
end;
HISTOGRAM Statement
Creates a univariate histogram computed from input data.
Note: When a histogram is placed on a log axis, binning is done on a linear scale, but the
bins are drawn on the log scale. As a result, the bins might have different widths
along the log axis.
Syntax
HISTOGRAM numeric-column | expression </option(s)>;
Appearance options
BINSTART=number
specifies the X coordinate of the first bin.
BINWIDTH=positive-number
specifies the bin width.
BOUNDARY=UPPER | LOWER
specifies how a boundary is counted when it lies on the endpoint of a bin.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bars.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fills and bar outlines.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display outlined bars, filled bars, or outlined and filled
bars.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the bars.
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
494 Chapter 6 • Plot Statements
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
NBINS=positive-integer
specifies the number of bins.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the line properties of the bar outlines.
XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the input X values represent midpoints, lower endpoints, or
upper endpoints of the bins.
Axes options
BINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for the axis tick marks.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
SCALE=PERCENT | COUNT | PROPORTION | DENSITY
specifies the scale for the Y axis.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABELTYPE=NONE | AUTO | COUNT | DENSITY | PERCENT |
PROPORTION
specifies the statistic to display at the end of each bar.
ENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the bin
endpoints (TRUE) or at the bin midpoints (FALSE).
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate bar segment or bar for each unique group value in the
specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
HISTOGRAM Statement 495
Statistics options
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation
that is read.
WEIGHT=numeric-column | expression
specifies a column that contains a bin-width calculation a priori weight for
each observation of the input data object.
Required Argument
numeric-column | expression
specifies a column that contains numeric values, or a dynamic variable that refers to
such a column.
Optional Arguments
BINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for the axis tick marks.
TRUE
specifies that the ENDLABELS= option determines how the axis ticks and value
labels are displayed.
FALSE
specifies that standard axes are used. Bin boundaries and midpoints that are set
by the ENDLABELS= option are ignored.
Default TRUE
Interactions This option is ignored when this histogram is not the primary plot. For
more information about primary plots, see “When Plots Share Data
and a Common Axis” on page 880.
When this option is set to TRUE, some X-axis options that are set on
the parent layout might not apply, such as INTEGER=,
TICKVALUELIST=, TICKVALUESEQUENCE=, and
INCLUDERANGES=.
See “boolean ” on page 1339 for other Boolean values that you can use.
BINSTART=number
specifies the X coordinate of the first bin. This option can be used with the
BINWIDTH= and NBINS= options to specify the bins.
Interaction This option is ignored if the specified number is greater than the
minimum data value. In that case, the default starting bin is used
instead.
496 Chapter 6 • Plot Statements
Note If the BINSTART= value is less than the minimum data value, then the
lower end of the histogram might be padded with zero-height bins in
order to accommodate the BINSTART= value.
See XVALUES=
BINWIDTH=positive-number
specifies the bin width. This option can be used with the BINSTART= and NBINS=
options to specify the bins.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of bins is limited to approximately 10,000. If the number of
bins computed from the data and the BINWIDTH= value exceeds
10,000, SAS computes a new bin-width value that yields approximately
10,000 bins. A warning of the change is written to the SAS log in that
case.
Interaction This option is ignored when the NBINS= option is also specified (with
or without the BINSTART= option) and the resulting data range does
not completely span the unbinned input data range. In that case, the
NBINS= option is honored and the default bin width is used instead.
Note When BINSTART=, NBINS=, or both are specified with this option
and the resulting data range is greater than the unbinned input data
range, the histogram might be padded with zero-height bins in order to
accommodate the BINSTART=, NBINS=, and BINWIDTH= option
values.
BOUNDARY=UPPER | LOWER
specifies how a boundary is counted when it lies on the endpoint of a bin. If this
option is set to UPPER, then the value is counted as one of the values in the upper
bin (the bin to the right). Otherwise, it is counted in the lower bin.
Default UPPER
Default NONE
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fills and bar outlines.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the bar
fills. You can combine this option with FILLATTRS= to set one
transparency for the bar outlines but a different transparency for the bar
fills. Example:
498 Chapter 6 • Plot Statements
datatransparency=0.2 fillattrs=(transparency=0.6)
Note This option is valid in the first maintenance release of SAS 9.4 and
later releases.
ENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the bin endpoints
(TRUE) or at the bin midpoints (FALSE).
Default FALSE.
Interactions This option is ignored if this plot is not the primary plot in the parent
layout. For more information, see the PRIMARY= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults In the first maintenance release of SAS 9.4 and earlier releases, the
Color attribute of the GraphDataDefault style element
Starting with the second maintenance release of SAS 9.4, the Color
attribute of the GraphDataDefault style element for non-grouped data or
the GraphData1–GraphDataN style elements for grouped data.
HISTOGRAM Statement 499
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
Tip The DATATRANSPARENCY= option sets the transparency for bar fills
and bar outlines. You can combine this option with
DATATRANSPARENCY= to set one transparency for the outlines but
a different transparency for the fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
style-element
specifies the name of a style element. You can specify only one of the elements
GraphData1–GraphDataN.
Restriction The only styles that are delivered by SAS that support fill patterns
are JOURNAL2, JOURNAL3, and MONOCHROMEPRINTER. If
any other such style is in effect and this option uses style-element in
its specification, then this option is ignored.
(fill-pattern-options)
a space-separated list of one or more of the following options, enclosed in
parentheses:
COLOR=color | style-reference
specifies a color to use for the bar-fill-pattern lines.
PATTERN=line-pattern
specifies a line pattern to use for the bar fill.
To specify a line-pattern, combine a line-direction prefix (R for right, L for
left, and X for cross hatch) with a line-identification number:
Interaction For this option to take effect, the DISPLAY= option must include
FILLPATTERN among the display options.
See DISPLAY=
500 Chapter 6 • Plot Statements
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
SOLID
each bar is filled with the color that is assigned to that bar.
GRADIENT
an alpha gradient is used to determine the bar fill color. Each bar is filled with a
color and a transparency gradient that starts at the bar top with the specified fill
color and transparency, and transitions to fully transparent at the bar baseline.
The initial fill color is determined by a style element or by the FILLATTRS=
option COLOR= suboption. The initial transparency is determined by the
DATATRANSPARENCY= option or by the FILLATTRS= option
TRANSPARENCY= suboption.
Default SOLID
Interaction The DISPLAY= option must include FILL for this option to have any
effect.
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation that is
read.
Restriction If the value of the numeric-column is missing or is less than 1, then the
observation is not used in the analysis. If the value is not an integer,
then only the integer portion is used.
Note If n is the value of the numeric column for a given observation, then
that observation is used n times for the purposes of any statistical
computation.
For example, the Sashelp.Cars data contains a column named Origin, which
identifies the region that produces each car. This column could be used in the
HISTOGRAM statement to group the bars in the display:
proc template;
define statgraph histogram;
begingraph;
entrytitle "Highway Mileage Distribution by Origin";
layout overlay /;
histogram mpg_highway / name="histogram" group=origin;
discretelegend "histogram" / title="Origin:";
endlayout;
endgraph;
end;
run;
Defaults If bar fills or fill patterns are enabled by the ODS style or by the
DISPLAY= option, then each distinct group value is represented in the
plot by a different fill color or fill pattern. The fill colors are defined by
the Color attribute of the GraphData1–GraphDataN and GraphMissing
style elements. The fill patterns are defined by the FillPattern attribute of
the GraphData1–GraphDataN and GraphMissing style elements.
If bar outlines are enabled by the ODS style or by the DISPLAY= option,
then each distinct group value is represented in the plot by a different
outline. The outline colors are defined by the ContrastColor attribute of
the GraphData1–GraphDataN and GraphMissing style elements. The
outline thickness and pattern are defined by the LineThickness and
LineStyle attributes of the GraphOutlines style element
502 Chapter 6 • Plot Statements
Note The group values are mapped in the order in which they appear in the
data.
Tip You can individually override the representations that are used to identify
the groups. For example, in some ODS styles, each distinct group value is
represented by a different line pattern for the bar outlines. In that case,
you can use the PATTERN= setting on the OUTLINEATTRS= option to
assign the same line pattern to all of the bar outlines.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the MISSING= system option changes the default missing character, or
a user-defined format is applied to the group value. In those cases, the
attributes of the missing group value are determined by a GraphData1–
GraphDataN style element instead of by the GraphMissing style
element.
See “boolean ” on page 1339 for other Boolean values that you can use.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
HISTOGRAM Statement 503
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
NBINS=positive-integer
specifies the number of bins. This option can be used with the BINSTART= and
BINWIDTH= options to specify the bins.
Note When BINWIDTH=, BINSTART=, or both are specified with this option
and the resulting data range is greater than the unbinned input data range,
the histogram might be padded with zero-height bins in order to
accommodate the BINSTART=, BINWIDTH=, and NBINS= option
values.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
Default VERTICAL
In the first maintenance release of SAS 9.4 and earlier releases, for
grouped data and filled bars, the ContrastColor and LineStyle attributes
of the GraphData1–GraphDataN style elements, and the LineThickness
attribute of the GraphOutlines style element.
Starting with the second maintenance release of SAS 9.4, for grouped
data and filled bars, the ContrastColor attribute of the GraphData1–
GraphDataN style elements, and the LineThickness and LineStyle
attributes of the GraphOutlines style element.
Interaction For this option to have any effect, the outlines must be enabled by the
ODS style or by the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
Default PERCENT
Tip When SCALE=PERCENT, the response axis tick values do not include a
percent sign after each value. To add a percent sign after each response axis
tick value in that case, use SCALE=PROPORTION, and then specify the
options shown in the following example for the response axis:
yaxisopts=(label="Percent" linearopts=(tickvalueformat=percent.))
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIPFORMAT=(Y=6.2)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Note The X role represents the binned value. The Y role represents the
computed amount of X in the units specified by the SCALE= option.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIPLABEL=(Y="Percent")
HISTOGRAM Statement 505
Default The column label or column name of the column assigned to the role.
Note The Y role represents the computed amount of X in the units specified by
the SCALE= option.
WEIGHT=numeric-column | expression
specifies a column that contains a bin-width calculation a priori weight for each
observation of the input data object.
Interaction If the value for an observation is missing or is less than 1, then the
observation is removed from the analysis.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Default MIDPOINTS
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
The histogram’s default bin width is computed by using the number of observations and
the range of the data. When a curve is overlaid on the histogram, the histogram’s bin
width is used to scale the curve so that the area under the curve is equal to the area of the
histogram.
The X-axis and Y-axis are linear by default. You can change axis properties with the
XAXISOPTS= and YAXISOPTS= options of the layout statement.
506 Chapter 6 • Plot Statements
The following graph was generated by the “Example Program” on page 506:
Example Program
proc template;
define statgraph histogram;
begingraph;
entrytitle "Histogram of Vehicle Weights";
layout overlay /
xaxisopts=(label="Vehicle Weight (LBS)")
yaxisopts=(griddisplay=on);
histogram weight;
endlayout;
endgraph;
end;
run;
HISTOGRAMPARM Statement
Creates a univariate histogram for specified values of bin midpoints and bin frequencies.
Restriction: Only uniform width bins are supported.
HISTOGRAMPARM Statement 507
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Syntax
HISTOGRAMPARM X=numeric-column | expression
Y=non-negative-numeric-column | expression </option(s)>;
Appearance options
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bars.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bars (outline and fill).
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display outlined bars, filled bars, or outlined and filled
bars.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the interior fill area of the bars.
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the line properties of the bar outlines.
XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTS
specifies whether the input X values represent midpoints, lower endpoints, or
upper endpoints of the bins.
Axes options
BINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for the axis tick marks.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data
tips.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a
histogram bin.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns.
TIPLABEL=(role-label-list)
specifies display labels for tip columns.
Label options
DATALABEL=column | expression
specifies a column for the bar labels.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the bar labels.
DATALABELFITPOLICY=AUTO | NONE | ROTATE | SPLIT | SPLITALWAYS
specifies a policy for avoiding collisions among the bar labels when labels
are displayed.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
ENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the bin
endpoints (TRUE) or at the bin midpoints (FALSE).
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Required Arguments
X=numeric-column | expression
specifies the column for the midpoint values.
Y=non-negative-numeric-column | expression
specifies the column for the frequency values. These values can be frequency counts,
percentages, or proportions between 0 and 1.
Optional Arguments
BINAXIS=TRUE | FALSE
specifies whether to use bins as the basis for the axis tick marks.
HISTOGRAMPARM Statement 509
TRUE
specifies that the ENDLABELS= option determines how the axis ticks and value
labels are displayed.
FALSE
specifies that standard axes are used. Bin boundaries and midpoints that are set
by the ENDLABELS= option are ignored.
Default TRUE
Interactions This option is ignored when this histogram is not the primary plot. For
more information about primary plots, see “When Plots Share Data
and a Common Axis” on page 880.
When this option is set to TRUE, some X-axis options that are set on
the parent layout might not apply, such as INTEGER=,
TICKVALUELIST=, TICKVALUESEQUENCE=, and
INCLUDERANGES=.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABEL=column | expression
specifies a column for the bar labels. The labels appear at the top or end of each bar,
depending on the chart orientation.
Interactions The DATALABEL= option must be specified for this option to have
any effect.
When text options are specified, any font properties that are not
specified (color, family, size, weight, and style) are derived from the
GraphDataText style element.
Tip If character labels do not fit after splitting, then try using ROTATE instead
of AUTO.
NONE
does not attempt to fit bar labels that collide.
ROTATE
rotates the bar labels for vertical bars if the labels collide in the available width.
SPLIT
splits the label for vertical bars at a split character only if a split is needed at that
character in order to make the label fit the available space. No split occurs at split
characters that occur where a split is not needed. If the label does not contain any
of the specified split characters, then a split does not occur. In that case, if the
label does not fit the available space, then it might collide with the adjoining
labels.
SPLITALWAYS
splits the label for vertical bars at every occurrence of a split character. If the
label does not contain any of the specified split characters, then a split does not
occur.
Default AUTO
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split. When multiple
split characters are specified, each character in the list is treated as a separate split
character unless the specified characters appear consecutively in the data label. In
that case, all of the specified split characters together are treated as a single split
character.
When DATALABELFITPOLICY=SPLIT, data labels are split on a split character
only if a split is needed at that point in order to make the label fit. When
DATALABELFITPOLICY=SPLITALWAYS, the data labels are split
unconditionally on each occurrence of a split character. If the data label does not
contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops a split character from the data label when a split occurs at that character.
Split characters at which a split does not occur are left in place. The
DATALABELFITPOLICY= option determines where the labels are split. When
DATALABELFITPOLICY=SPLIT, each label is split at a split character only
where a split is needed in order to make the label fit the available space. At each
split point, the split character is dropped, and the characters that follow the split
character, up to but not including the split character at the next split point, are
wrapped to the following line.
When DATALABELFITPOLICY=SPLITALWAYS, each label is split at every
instance of a split character. All of the split characters are dropped. The
characters that follow each split character, up to but not including the next split
character, are wrapped to the next line.
The following figure shows how label “Product*Group*1” is split when the
DATALABELSPLITCHARDROP=TRUE and DATALABELSPLITCHAR="*"
options are used with the SPLIT and SPLITALWAYS fit policies.
FALSE
includes the split characters in the data label. The DATALABELFITPOLICY=
option determines how the split characters are displayed. When
DATALABELFITPOLICY=SPLIT, each data label is split at a split character
only where a split is needed in order to make the label fit the available space. A
split might not occur at every split character in the label. At each split point, the
split character remains as the last character in the current line. The characters that
follow the split character, up to and including the split character at the next split
point, are then wrapped to the following line. This process repeats until the entire
data label is displayed.
When DATALABELFITPOLICY=SPLITALWAYS, each data label is split at
every instance of a split character in the label regardless of whether a split is
actually needed. Each split character remains as the last character in the current
line. The characters that follow each split character, up to and including the next
split character, are then wrapped to the next line.
The following figure shows how label “Product*Group*1” is split when the
DATALABELSPLITCHARDROP=FALSE and DATALABELSPLITCHAR="*"
options are used with the SPLIT and SPLITALWAYS fit policies.
Default TRUE. A split character is dropped from thedata label when a split
occurs at that character.
See “boolean ” on page 1339 for other Boolean values that you can use.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bars (outline and fill).
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the bar
fills. You can combine this option with FILLATTRS= to set one
transparency for the bar outlines but a different transparency for the bar
fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
STANDARD
displays outlined, filled bars. (Currently, the same as ALL.)
ALL
displays outlined, filled bars.
(display-options)
a space-separated list of one or more of the following options, enclosed in
parentheses:
OUTLINE
displays outlined bars.
FILL
displays bars with a color fill.
FILLPATTERN
displays bars with a patterned fill.
Note This option is valid in the first maintenance release of SAS 9.4 and
later releases.
ENDLABELS=TRUE | FALSE
specifies whether the axis ticks and value labels are drawn at the bin endpoints
(TRUE) or at the bin midpoints (FALSE).
Default FALSE.
Interactions This option is ignored if this plot is not the primary plot in the parent
layout. For more information, see the PRIMARY= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
Tip The DATATRANSPARENCY= option sets the transparency for bar fills
and bar outlines. You can combine this option with
DATATRANSPARENCY= to set one transparency for the outlines but
a different transparency for the fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
HISTOGRAMPARM Statement 515
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FILLPATTERNATTRS=style-element | (fill-pattern-options)
specifies the appearance of the pattern-filled bar area.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
style-element
specifies the name of a style element. You can specify only one of the elements
GraphData1–GraphDataN.
Restriction The only styles that are delivered by SAS that support fill patterns
are JOURNAL2, JOURNAL3, and MONOCHROMEPRINTER. If
any other such style is in effect and this option uses style-element in
its specification, then this option is ignored.
(fill-pattern-options)
a space-separated list of one or more of the following options, enclosed in
parentheses:
COLOR=color | style-reference
specifies a color to use for the bar-fill-pattern lines.
PATTERN=line-pattern
specifies a line pattern to use for the bar fill.
To specify a line-pattern, combine a line-direction prefix (R for right, L for
left, and X for cross hatch) with a line-identification number:
Interaction For this option to take effect, the DISPLAY= option must include
FILLPATTERN among the display options.
See DISPLAY=
FILLTYPE=SOLID | GRADIENT
specifies the bar fill type.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
SOLID
each bar is filled with the color that is assigned to that bar.
516 Chapter 6 • Plot Statements
GRADIENT
an alpha gradient is used to determine the bar fill color. Each bar is filled with a
color and a transparency gradient that starts at the bar top with the specified fill
color and transparency, and transitions to fully transparent at the bar baseline.
The initial fill color is determined by a style element or by the FILLATTRS=
option COLOR= suboption. The initial transparency is determined by the
DATATRANSPARENCY= option or by the FILLATTRS= option
TRANSPARENCY= suboption.
Default SOLID
Interaction The DISPLAY= option must include FILL for this option to have any
effect.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis and the bars.
Default VERTICAL
Interaction For this option to have any effect, the outlines must be enabled by the
ODS style or the DISPLAY= option.
HISTOGRAMPARM Statement 517
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, and DATALABEL.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a histogram
bin. If this option is used, then it replaces all of the information that is displayed by
default. Roles for columns that do not contribute to the histogram can be specified
along with roles that do.
(role-list)
an ordered, space-separated list of unique HISTOGRAMPARM and user-defined
roles. HISTOGRAMPARM roles include X, Y, and DATALABEL.
Example The following example displays data tips for the columns assigned to
the roles X and Y, as well as the column Pct, which is not assigned to
any pre-defined HISTOGRAMPARM role. The Pct column must first
be assigned a role:
518 Chapter 6 • Plot Statements
ROLENAME=(TIP1=PCT)
TIP=(X Y TIP1)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X and Y.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Example: HISTOGRAMPARM Statement 519
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Default MIDPOINTS
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
When a curve is overlaid on the histogram, the histogram bin width is used to scale the
curve so that the area under the curve is equal to the area of the histogram.
The X-axis and Y-axis are linear by default. You can change axis properties with the
XAXISOPTS= and YAXISOPTS= options of the LAYOUT OVERLAY statement.
The following graph was generated by the “Example Program” on page 520:
520 Chapter 6 • Plot Statements
Example Program
proc template;
define statgraph histogramparm;
begingraph;
entrytitle "Histogram of Vehicle Weights";
layout overlay;
histogramparm x=midpoint y=frequency;
endlayout;
endgraph;
end;
run;
data bins;
input Midpoint Frequency;
label midpoint="Vehicle Weight (LBS)";
datalines;
2000 18
3000 208
4000 159
5000 36
6000 6
7000 1
;
run;
LINECHART Statement
Creates a line chart that is computed from input data.
Restrictions: GROUPDISPLAY= STACK has stringent requirements for the data. If the
requirements are not met for all the data, then the line chart is not drawn. If the
LINECHART statement is in a LAYOUT DATALATTICE or LAYOUT DATAPANEL
block, then the requirements are tested for all of the data, not for each individual
panel.
The category axis (the X-axis when ORIENT=VERTICAL or the Y-axis when
ORIENT=HORIZONTAL) is always discrete.
The response axis (the Y-axis when ORIENT=VERTICAL or the X-axis when
ORIENT=HORIZONTAL) is always numeric.
The LINECHART statement performs discrete binning for a numeric category column
only.
Note: Specifying only the CATEGORY= option creates a computed line chart with vertices
representing frequency counts or percents of unique CATEGORY values. For a non-
grouped chart, specifying both the CATEGORY= and RESPONSE= options creates
a computed line chart with vertices representing the summarized values of the
RESPONSE values that are categorized by unique CATEGORY values.
Tips: The line segments in the chart always join the categorical values in the order in
which they appear on the axis. By default, the vertices in the line chart appear in the
order in which the X values occur in the input data. To change the categorical axis
tick value order, use the SORTORDER= or TICKVALUELIST= suboption of the
DISCRETEOPTS= option for the X-axis. For example:
XAXISOPTS=(DISCRETEOPTS=(SORTORDER=ASCENDINGFORMATTED))
The response axis of the line chart includes the zero value by default. You can use
the BASELINEINTERCEPT= to change the Y intercept.
By default, missing category values are ignored. To treat missing category values as
a category, include the INCLUDEMISSINGDISCRETE=TRUE option in the
BEGINGRAPH statement.
Starting with the third maintenance release of SAS 9.4, subpixel rendering is enabled
by default. To disable subpixel rendering, specify SUBPIXEL=OFF in the
BEGINGRAPH statement or in an ODS GRAPHICS statement. For information
about the BEGINGRAPH statement SUBPIXEL= option, see SUBPIXEL= on page
33.For information about the ODS GRAPHICS statement SUBPIXEL= option, see
“ODS GRAPHICS Statement” in SAS ODS Graphics: Procedures Guide.
See: “LAYOUT DATALATTICE Statement” on page 45
“LAYOUT DATAPANEL Statement” on page 70
Chapter 8, “Axis Options in Layouts,” on page 889
“BEGINGRAPH Statement” on page 21
Syntax
LINECHART CATEGORY=column | expression </option(s)> ;
LINECHART CATEGORY=column | expression
RESPONSE=numeric-column | expression </option(s) > ;
522 Chapter 6 • Plot Statements
Appearance options
BREAK=TRUE | FALSE
breaks the line at missing values of the RESPONSE variable.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute variable to use to map the line, marker,
and fill colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the lines and markers.
DATATRANSPARENCY=number
specifies the degree of the transparency of the line, markers, and vertex
labels, if displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies which graphical features to display.
FILLATTRS=style-element | (fill-options)
specifies the appearance of the filled area.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
GROUPDISPLAY=OVERLAY | STACK
specifies how to display grouped lines.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line
pattern) and fill attributes to one of the GraphData1–GraphDataN style
elements.
LINEATTRS=style-element | (line-options)
specifies the appearance of the line.
MARKERATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the attributes of the data markers.
MARKERFILLATTRS=style-element | (fill-options)
specifies the appearance of the filled markers.
MARKEROUTLINEATTRS=style-element | (line-options)
specifies the appearance of the marker outlines.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis.
SMOOTHCONNECT=TRUE | FALSE
specifies that a smoothed line passes through all vertices.
Axes options
BASELINEINTERCEPT=number | AUTO | AXISMIN | AXISMINEXTEND |
AXISMAX | AXISMAXEXTEND
specifies the Y-intercept for the baseline.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
LINECHART Statement 523
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
VERTEXLABEL=TRUE | FALSE
specifies whether to label the vertices with their response value (or statistic).
VERTEXLABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the vertex labels.
VERTEXLABELFORMAT=format
specifies the format used to display the vertex label response or statistic.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate line for each unique group value in the specified column.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page to display when a line segment, marker, or fill area
is selected.
Statistics options
STAT=FREQ | PCT | SUM | MEAN | PROPORTION
specifies the statistic to be computed for the Y-axis.
Required Argument
CATEGORY=column | expression
specifies the column or expression for the category values. Duplicated category
values are summarized into a unique value. All values are treated as discrete.
524 Chapter 6 • Plot Statements
Optional Arguments
BASELINEINTERCEPT=number | AUTO | AXISMIN | AXISMINEXTEND |
AXISMAX | AXISMAXEXTEND
specifies the Y-intercept for the baseline.
number
specifies the Y coordinate of the baseline. This value is included in the data range
that is reported by the line chart.
AUTO
bases the intercept on the response axis range in the following ways:
• If the response axis range has both positive and negative values or contains 0,
then the intercept is 0.
• If the response axis range contains all positive values, then AUTO is
interpreted as AXISMINEXTEND.
• If the response axis range contains only negative values, then AUTO is
interpreted as AXISMAXEXTEND.
AXISMIN
places the baseline at the minimum value of the axis range.
AXISMINEXTEND
places the baseline at the start of the minimum offset in the wall. This location
corresponds to the bottom edge of the wall when there is no inner margin plot
and the axis is not reversed. If there is an inner margin plot at the bottom, then
the baseline is placed at the boundary of the inner margin and the minimum
offset.
AXISMAX
places the baseline at the maximum value of the axis range.
AXISMAXEXTEND
places the baseline at the start of the maximum offset in the wall. This location
corresponds to the top edge of the wall when there is no inner margin plot, and
the axis is not reversed. If there is an inner margin plot at the top, then the
baseline is placed at the boundary of the inner margin and the maximum offset.
Default AUTO
When DISPLAY= includes FILL, the fill extends to the baseline that
is specified by the BASELINEINTERCEPT= option.
BREAK=TRUE | FALSE
breaks the line at missing values of the RESPONSE variable.
Default FALSE
LINECHART Statement 525
Note If BREAK=FALSE, then missing values are skipped and a continuous line
is drawn.
See “boolean ” on page 1339 for other Boolean values that you can use.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
LINECHART Statement 527
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
The skin appearance is based on the color that is in effect for the lines
and markers.
DATATRANSPARENCY=number
specifies the degree of the transparency of the line, markers, and vertex labels, if
displayed.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the fills.
You can combine this option with FILLATTRS= to set one transparency for
the lines but a different transparency for the fills. For example:
datatransparency=0.2 fillattrs=(transparency=0.6)
LINE
displays line segments that join the vertices.
MARKERS
displays markers at each vertex.
Default STANDARD
FILLATTRS=style-element | (fill-options)
specifies the appearance of the filled area.
Interactions For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
TRUE
draws filled markers (marker symbols with the suffix FILLED) using both fill
and an outline. When this option is TRUE, the fill color and outline color for
filled markers are determined in the following ways:
• If the GROUP= option is specified, then by default, the fill color is derived
from the GraphData1–GraphDataN style elements Color attribute, and the
marker outlined color is derived from the GraphData1–GraphDataN style
elements ContrastColor attribute.
• If the GROUP= option is not specified, then by default, the fill color is
derived from the GraphDataDefault style elements Color attribute, and the
marker outlined color is derived from the GraphOutline style elements
ContrastColor attribute.
FALSE
draws the markers using fill or an outline, but not both.
Default FALSE
Tip To specify the marker fill and outline colors for a non-grouped plot, set this
option to TRUE, and then use the MARKERFILLATTRS= and
MARKEROUTLINEATTRS= options to specify the colors.
“boolean ” on page 1339 for other Boolean values that you can use.
LINECHART Statement 529
Tip The representations that are used to identify the groups can be
overridden individually. For example, each distinct group value is
represented by a different line pattern for the lines, but you can use the
PATTERN= suboption of the LINEATTRS= option to assign the same
line pattern to all lines.
GROUPDISPLAY=OVERLAY | STACK
specifies how to display grouped lines.
OVERLAY
displays group values overlaid on top of each other.
STACK
displays group values as stacked lines.
Default OVERLAY
DATA
orders the groups within a category in the group-column data order.
REVERSEDATA
orders the groups within a category in the reverse group-column data order.
Note: This feature applies to the second maintenance release of SAS 9.4 and to
later releases.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line pattern)
and fill attributes to one of the GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default If the RESPONSE= option is specified, then the response variable label
is used. Otherwise, the CATEGORY= variable label is used. If a label
is not assigned to the response variable or category variable, then the
variable name is used.
LINEATTRS=style-element | (line-options)
specifies the appearance of the line.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
MARKERFILLATTRS=style-element | (fill-options)
specifies the appearance of the filled markers.
MARKEROUTLINEATTRS=style-element | (line-options)
specifies the appearance of the marker outlines.
Interaction This option is ignored when a data skin is applied by the current style
or by the DATASKIN= option. In the latter case, the outline is set by
the data skin.
NAME="string"
assigns a name to this plot statement for reference in other template statements. This
option is used mostly in the CONTINUOUSLEGEND on page 1098 statement in
order to coordinate the use of colors and line patterns between the plot and the
legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the Y axis.
Default VERTICAL
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
534 Chapter 6 • Plot Statements
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles CATEGORY, RESPONSE, DATALABEL, and
GROUP.
SMOOTHCONNECT=TRUE | FALSE
specifies that a smoothed line passes through all vertices.
Default FALSE. Straight line segments are used if the vertices are to be
connected.
See “boolean ” on page 1339 for other Boolean values that you can use.
SUM
MEAN
Defaults SUM for line charts that specify the RESPONSE= argument.
FREQ for line charts that do not specify the RESPONSE= argument.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a line. If this
option is used, then the information specified replaces all of the information that is
LINECHART Statement 535
displayed by default. You can specify roles for columns that do not contribute to the
line chart along with roles that do.
(role-list)
an ordered, space-separated list of unique LINECHART roles and user-defined
roles. LINECHART roles include CATEGORY, RESPONSE,
COLORRESPONSE, DATALABEL, and GROUP.
Note The COLORRESPONSE role is valid starting with the third maintenance
release of SAS 9.4.
NONE
suppresses data tips and URLs (if requested) from the plot.
Restriction Data tips are available only for graphs that are written to the ODS
HTML destination.
Note The RESPONSE role represents the computed values for the
CATEGORY role (and RESPONSE= role), based on the STAT=
option.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
Example To display data tips for the columns assigned to the roles X and Y as
well as the user-defined role TIP1:
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
536 Chapter 6 • Plot Statements
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a line segment, marker, or fill area is
selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
line that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Requirement To generate selectable line segments, markers, and fill areas, you
must include an ODS GRAPHICS ON statement that specifies the
IMAGEMAP option, and you must write the output to the ODS
HTML destination.
Notes For non-grouped data, the values of the column are expected to be
same for each unique X value. If they are not, then the results might
be unpredictable.
For grouped data, the values of the column are expected to be the
same for each unique X and GROUP combination.
Tips The URL value can be blank for some X values, meaning that no
action is taken when the line segments for those X values are
selected.
LINECHART Statement 537
The URL value can be the same for different X values, meaning that
the same action is taken when the line segments for those X values
are selected.
VERTEXLABEL=TRUE | FALSE
specifies whether to label the vertices with their response value (or statistic).
Default FALSE
Tips You can modify the visual attributes for the label by using the
VERTEXLABELATTRS= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction If one or more text options are specified and they do not include all
the font properties (color, family, size, weight, style), then non-
specified properties are derived from the GraphDataText style
element.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
VERTEXLABELFORMAT=format
specifies the format used to display the vertex label response or statistic.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
538 Chapter 6 • Plot Statements
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
A line chart shows the relationship of one variable to another as trends in the data over a
period of time. The trends are shown by connecting the successive data points with a
line. Typically, a line chart is used to chart a response value against a discrete categorical
value where each value on the horizontal axis has only one corresponding value on the
vertical axis. A grouping variable can be used to show multiple trends based on the
group values.
In a line chart, the category axis (X) is always discrete, and the response axis (Y) is
always linear. The line segments in the chart always join the categorical values in the
order in which they appear on the axis. The vertices in the line chart appear in the order
in which the categorical values appear in the input data.
Examples
Example 1: Grouped Line Chart with Custom Line and Fill Attributes
This example shows you how to generate a simple line chart by using the LINECHART
statement and how to use the statement options to customize the plot.
Example 1: Grouped Line Chart with Custom Line and Fill Attributes 539
The following graph was generated by the “Example Program” on page 539. It shows
the trend of the average closing price of the IBM, Intel, and Microsoft stocks from 1995
through 2005.
Example Program
Here is the SAS code for this example.
/* Extract per-year data for 1995 through 2005 from SASHELP.STOCKS */
data linechartdata;
set sashelp.stocks(where=(year(date) between 1995 and 2005));
year=year(date);
label year="Year";
run;
group=stock
/* Add a legend */
discretelegend "linechart";
endlayout;
endgraph;
end;
run;
Example Program
Here is the SAS code for this example.
/* Define the line chart template */
proc template;
define statgraph linechart;
begingraph;
/* Create a dynamic variable for the year */
dynamic year;
/* Associate the attribute map with input data column Stock and
assign the name STOCKATTRS to the named association */
discreteattrvar attrvar=stockattrs var=stock attrmap="stocks" ;
/* Add a legend */
discretelegend "linechart";
542 Chapter 6 • Plot Statements
endlayout;
endgraph;
end;
run;
LINEPARM Statement
Creates a straight line specified by a point and a slope.
Requirement: A LINEPARM statement can be used only within a 2-D layout (OVERLAY,
OVERLAYEQUATED, DATALATTICE, or DATAPANEL). Another plot statement that
is derived from data values that provide boundaries for the axis area must be
included.
Syntax
LINEPARM X=number | numeric-column | expression
Y=number | numeric-column | expression
SLOPE=number | numeric-column | expression </option(s)>;
Appearance options
CLIP=TRUE | FALSE
specifies whether the data for the line is considered when the data ranges are
determined for the axes.
DATATRANSPARENCY=number
specifies the degree of the transparency of the line.
EXTEND=TRUE | FALSE
specifies whether the line is to be drawn to the area bounded by the axes.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of
the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the line.
Axes options
XAXIS=X | X2
LINEPARM Statement 543
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABEL="string" | column | expression
specifies a label for the line.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the line label.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the line label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN
specifies the position of the line label relative to the line end points.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the line label at the specified split characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the line label can be split if
needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the line label text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the line label block.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a separate parameterized line plot for each unique group value of the
specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
X=number | numeric-column | expression
specifies the X coordinate of a point.
By default, if the specified value is outside of the data range, then the data range is
extended to include the specified intercept. This behavior can be changed with the
CLIP= option. If a numeric-column is specified and the column contains missing
values, then no line is drawn for the missing values.
Values are displayed in the units of the data.
Y=number | numeric-column | expression
specifies the Y coordinate of a point.
544 Chapter 6 • Plot Statements
By default, if the specified value is outside of the data range, then the data range is
extended to include the specified intercept. This behavior can be changed with the
CLIP= option. If a numeric-column is specified and the column contains missing
values, then no line is drawn for the missing values.
Values are displayed in the units of the data.
SLOPE=number | numeric-column | expression
specifies the slope of the line. Slope can be positive or negative.
SLOPE=0 creates a line parallel to the X-axis. SLOPE=. (a missing value) creates a
line parallel to the Y-axis.
Optional Arguments
CLIP=TRUE | FALSE
specifies whether the data for the line is considered when the data ranges are
determined for the axes.
FALSE
specifies that the data for the line contributes to the data range for each axis.
Each axis might be extended in order to force the display of the line. When
CLIP=FALSE, the SLOPE= option determines how the X= and Y= values
contribute to the axis data range in the following ways:
• If SLOPE=0, then only the Y= values contribute to the axis data range.
• If SLOPE=. (missing), then only the X= values contribute to the axis data
range.
• If SLOPE= is neither 0 nor missing, then the X= and Y= values contribute to
the axis data range.
TRUE
specifies that the data for the line is ignored when axis scales are being
established. Each axis scale is determined by the other plots in the layout. In this
case, the line might not be displayed if its data range is not within the data ranges
of the other plots.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Restrictions When the GROUP= option is specified, "string" and expression are
not valid. Use column in that case.
When the GROUP= option is not specified, column is not valid. Use
"string" or expression in that case.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interactions For this option to take effect, the CURVELABEL= option must also
be used.
Tip When the GROUP= option is used, each distinct group value might be
represented by a different color. The line label that is associated with
the group is assigned the group color. This option can be used to
specify a single color for all line labels in a plot, without affecting the
line colors.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the line label relative to the plot area.
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
AUTO
automatically positions the line label near the line boundary along unused axes
whenever possible (typically Y2 and X2) in order to avoid collision with tick
values.
MAX
forces the line label to appear near maximum line values (typically, upper right).
MIN
forces the line label to appear near minimum line values (typically, lower left).
Interaction For this option to take effect, the CURVELABEL= option must also be
specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the line label at the specified split characters. When a line
label is split, the label is split on each occurrence of the specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the line label can be split if needed. When
multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
line label. In that case, all of the specified split characters together are treated as a
single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the line
label is split unconditionally at each occurrence of any of the specified split
characters. If the line label does not contain any of the specified characters, then the
label is not split.
LINEPARM Statement 547
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the line label text.
TRUE
drops the split characters from the line label text.
FALSE
includes the split characters in the line label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a line label with the following
specifications:
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
line for reference.
548 Chapter 6 • Plot Statements
Default TRUE. The split characters are dropped from the line label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
DATATRANSPARENCY=number
specifies the degree of the transparency of the line.
Default 0
EXTEND=TRUE | FALSE
specifies whether the line is to be drawn to the area bounded by the axes.
Default FALSE
Note If this option is not specified, then there can be a small gap between the
line and the axis. The gap is controlled by the axis offset. If the offset is set
to 0, then there is no gap.
See “boolean ” on page 1339 for other Boolean values that you can use.
Restriction When this option is used, the X, Y, and SLOPE arguments must
specify numeric columns.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of line colors and
line patterns
assign the same color to all of the lines, letting the line pattern
distinguish group values.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Restriction Another plot that establishes a data range for the designed axis must be
included.
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Restriction Another plot that establishes a data range for the designed axis must be
included.
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
552 Chapter 6 • Plot Statements
Details
The LINEPARM statement creates a straight line. You can generate a single line by
specifying a constant for each required argument. You can generate multiple lines by
specifying a numeric column for any or all required arguments. If any of the X= or Y=
columns contains a missing value, then no line is drawn. To request a vertical line,
specify SLOPE=. (specify a missing value as a constant or column value).
A LINEPARM statement can be used in any layout except GRIDDED or OVERLAY3D
layouts. The parent layout must include another plot statement that is derived from data
values that establish a data range for the axes. For example, it can be used with a scatter
plot or a histogram.
To draw vertical or horizontal reference lines, consider using the simpler
REFERENCELINE statement.
The following graph was generated by the “Example Program” on page 552:
Example Program
The LINEPARM statement draws a line based on a point and the slope of the line that
passes through that point. You can use this statement to create a reference line with any
slope or, in this example, to draw a fit from a linear regression. Many SAS/STAT
procedures create output data sets containing a Y-intercept and slope and coefficient for
the linear regression equation.
proc template;
define statgraph lineparm;
begingraph;
LOESSPLOT Statement 553
data all;
merge heart stats(keep=intercept slope sex);
run;
LOESSPLOT Statement
Creates a fitted loess curve computed from input data.
Restriction: The LOESSPLOT statement supports only models of one independent and one
dependent variable.
Note: If the input data contains a large number of observations, then it might take several
minutes to generate the plot.
Tips: By default, the LOESSPLOT statement will process up to 5000 observations. If the
input data exceeds 5000 observations, then the plot is not generated. In that case,
you can use the ODS GRAPHICS statement LOESSMAXOBS= option to extend the
limit. See “Details” on page 564.
Starting with the third maintenance release of SAS 9.4, subpixel rendering is enabled
by default. To disable subpixel rendering, specify SUBPIXEL=OFF in the
BEGINGRAPH statement or in an ODS GRAPHICS statement. For information
about the BEGINGRAPH statement SUBPIXEL= option, see SUBPIXEL= on page
554 Chapter 6 • Plot Statements
33.For information about the ODS GRAPHICS statement SUBPIXEL= option, see
“ODS GRAPHICS Statement” in SAS ODS Graphics: Procedures Guide.
Syntax
LOESSPLOT X=numeric-column | expression
Y=numeric-column | expression </<regression-options> <option(s)>>;
Appearance options
DATATRANSPARENCY=number
specifies the degree of the transparency of the loess curve.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of
the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the loess curve.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABEL="string"
specifies a label for the loess curve.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the curve labels.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the curve label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the curve label relative to the curve line.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the curve label at the specified split characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the curve label can be split if
needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
LOESSPLOT Statement 555
specifies whether the split characters are included in the curve label text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the curve label block.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a distinct set of curves from just the observations that correspond to
each unique group value of the specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
X=numeric-column | expression
specifies the column for the X values.
Y=numeric-column | expression
specifies the column for the Y values.
Optional Arguments
CURVELABEL="string"
specifies a label for the loess curve.
Interaction This option is not valid when the GROUP= option is specified.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the curve label relative to the plot area.
556 Chapter 6 • Plot Statements
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
MAX
forces the curve label to appear near maximum curve values (typically, upper
right).
MIN
forces the curve label to appear near minimum curve values (typically, lower
left).
START
forces the curve label to appear near the beginning of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
END
forces the curve label to appear near the end of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
LOESSPLOT Statement 557
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the curve label at the specified split characters. When a
curve label is split, the label is split on each occurrence of the specified split
characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the curve label can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
curve label. In that case, all of the specified split characters together are treated as a
single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the curve
label is split unconditionally at each occurrence of any of the specified split
characters. If the curve label does not contain any of the specified characters, then
the label is not split.
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
curvelabelsplitchar="abc"
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the curve label text.
TRUE
drops the split characters from the curve label text.
FALSE
includes the split characters in the curve label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a curve label with the following
specifications:
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
curve for reference.
Default TRUE. The split characters are dropped from the curve label.
LOESSPLOT Statement 559
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
DATATRANSPARENCY=number
specifies the degree of the transparency of the loess curve.
Default 0
discrete-attr-var
specifies a discrete attribute map variable that is defined in a
DISCRETEATTRVAR statement.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of line colors and
line patterns.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of the
GraphData1–GraphDataN style elements.
LOESSPLOT Statement 561
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
562 Chapter 6 • Plot Statements
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIPFORMAT=(Y=6.2)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Note The columns assigned to the X, Y, and GROUP (if assigned) roles are
automatically included in the data tip information.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIPLABEL=(Y="Curve")
Default The column label or column name of the column assigned to the role.
Note The columns assigned to the X, Y, and GROUP (if assigned) roles are
automatically included in the data tip information.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
LOESSPLOT Statement 563
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Default 0.05
CLM="name"
produces confidence limits for a mean predicted value for each observation. The
confidence level is set by the ALPHA= option.
Interaction "name" is a unique name within the template that is case sensitive and
cannot contain spaces. It must be assigned in order for the confidence
limits to be computed. To display confidence limits, you must use this
name as the required argument of a MODELBAND statement.
DEGREE=1 | 2
specifies the degree of the local polynomials to use for each local regression. The
valid values are 1 for local linear fitting or 2 for local quadratic fitting.
Default 1
INTERPOLATION=LINEAR | CUBIC
specifies the degree of the interpolating polynomials used for blending local
polynomial fits at the kd tree vertices.
Default LINEAR
MAXPOINTS=positive-integer
specifies the maximum number of predicted points generated for the loess curve as
well as confidence limits.
Default 201
564 Chapter 6 • Plot Statements
SMOOTH=AUTO | positive-number
specifies a regression parameter value.
Default AUTO
REWEIGHT=NONE | positive-integer
specifies the number of iterative re-weighting steps to be done. Such iterations are
appropriate when there are outliers in the data or when the error distribution is a
symmetric long-tailed distribution.
Default NONE
WEIGHT=numeric-column
specifies a column in the input data set that contains values to be used as a priori
weights for a loess fit. The values of the weight column must be nonnegative. If an
observation’s weight is zero, negative, or missing, then the observation is deleted
from the analysis.
Details
The LOESSPLOT statement only supports statistical models of one independent and one
dependent variable. For more information about the fitting methodology, see the LOESS
procedure in the SAS/STAT user’s guide.
In addition to the loess curve, the LOESSPLOT statement can compute confidence
levels for the fitted line. To display the confidence levels:
1. Use the CLM= option to declare a name for the confidence level of the mean .
2. Use a MODELBAND statement to refer this name. This statement draws a
confidence band from this information. See “MODELBAND Statement” on page
565 for information about how to control the appearance of the confidence band.
By default, the LOESSPLOT statement will process up to 5000 observations. If the input
data contains more than 5000 observations, then the plot is not drawn and the following
note is written to the SAS log:
NOTE: The number of observations of the LOESS plot (nnnn) exceeds the
limit of 5000. Specify the LOESSMAXOBS option of the ODS GRAPHICS statement to
override the limit.
In that case, you can use the following statement to extend the limit:
ods graphics / loessmaxobs=nnnn
The following graph was generated by the “Example Program” on page 565:
MODELBAND Statement 565
Example Program
proc template;
define statgraph loessplot;
begingraph;
entrytitle "Loess Fit Plot";
layout overlay;
scatterplot x=weight y=mpg_highway /
datatransparency=0.7;
loessplot x=weight y=mpg_highway / name="fitline"
alpha=0.05 legendlabel="Loess Fit";
discretelegend "fitline";
endlayout;
endgraph;
end;
run;
MODELBAND Statement
Creates a band showing confidence limits for an associated smoother plot.
Requirement: A MODELBAND statement must be associated with a smoother statement
(LOESSPLOT, REGRESSIONPLOT, or PBSPLINEPLOT) that specifies a fitted
model and a type of confidence level to compute.
Interaction: Starting with the second maintenance release of SAS 9.4, a confidence band that
depicts confidence limits for individual predicted values (CLI) for a weighted spline
plot or regression plot is displayed as a high-low chart instead of a band.
566 Chapter 6 • Plot Statements
Syntax
MODELBAND "confidence-name" </option(s)>;
Appearance options
ANTIALIAS=AUTO | OFF
specifies whether anti-aliasing is turned off for this plot.
DATATRANSPARENCY=number
specifies the degree of the transparency of the band fill and the band outline.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display an outlined area, a filled area, or an outlined and
filled modelband area.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled modelband area.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the modelband outlines.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the upper and lower band labels.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the band labels relative to the plot area.
CURVELABELLOWER="string"
specifies a label for the lower band limit.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the band label relative to the band line.
CURVELABELUPPER="string"
specifies a label for the upper band limit.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Required Argument
"confidence-name"
specifies the case-sensitive name assigned to a confidence option in a smoother plot
statement.
Optional Arguments
ANTIALIAS=AUTO | OFF
specifies whether anti-aliasing is turned off for this plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
AUTO
specifies that anti-aliasing is controlled by the ANTIALIAS= option in the ODS
GRAPHICS statement.
OFF
specifies that anti-aliasing is always disabled for this plot.
Default AUTO
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOWER="string"
specifies a label for the lower band limit.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
CURVELABELUPPER="string"
specifies a label for the upper band limit.
568 Chapter 6 • Plot Statements
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the band labels relative to the plot area.
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
MAX
forces the band label to appear near maximum band values (typically, upper
right)
MIN
forces the band label to appear near minimum band values (typically, lower left)
START
forces the band label to appear near the beginning of the band.
Tip This option is particularly useful when the curve line has a spiral
shape.
END
forces the band label to appear near the end of the band.
MODELBAND Statement 569
Tip This option is particularly useful when the curve line has a spiral
shape.
DATATRANSPARENCY=number
specifies the degree of the transparency of the band fill and the band outline.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the filled
band area. You can combine this option with FILLATTRS= to set one
transparency for the band outline but a different transparency for the band
fill. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
(display-options)
a space-separated list of one or more of the following options enclosed in
parentheses:
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs. The role-names X,
LIMITLOWER, LIMITUPPER, GROUP, and INDEX are available to indicate
which data tip values to format.
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs. The role-names X,
LIMITLOWER, LIMITUPPER, GROUP, and INDEX are available to indicate
which data tip values to label.
Example TIP=(X)
TIPLABEL=(X="Type")
Default The column label or column name of the column assigned to the role.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Requirement The setting for this option should be the same as for the smoother
statement referenced by the confidence-name .
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
572 Chapter 6 • Plot Statements
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Requirement The setting for this option should be the same as for the smoother
statement referenced by the confidence-name .
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
The following graph was generated by the “Example Program” on page 572:
Example Program
proc template;
define statgraph modelband;
begingraph;
entrytitle "Spline Fit with Confidence Bands";
layout overlay;
modelband "cliband" / name="confband1" display=all
legendlabel="90% CLI" fillattrs=GraphConfidence;
modelband "clmband" / name="confband2" display=all
legendlabel="90% CLM" fillattrs=GraphConfidence2;
scatterplot x=weight y=mpg_highway /
MOSAICPLOTPARM Statement 573
datatransparency=0.7;
pbsplineplot x=weight y=mpg_highway / name="fitline"
clm="clmband" cli="cliband"
alpha=0.1 legendlabel="Spline Fit";
discretelegend "fitline" "confband1" "confband2";
endlayout;
endgraph;
end;
run;
MOSAICPLOTPARM Statement
Creates a mosaic plot from pre-summarized categorical data.
Restriction: You can use the MOSAICPLOTPARM statement in GRIDDED, LATTICE, and
REGION layouts only.
Note: On z/OS hosts, the mosaic plot categories might appear in an order other than data
order.
Syntax
MOSAICPLOTPARM CATEGORY=(column-list)
COUNT=non-negative-numeric-column | expression </option(s)>;
Appearance options
COLORGROUP=column | discrete-attr-var
specifies the category column to use for discrete fill colors for the tiles.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies a numeric columnto use to map tile fill colors to a continuous
gradient.
DATATRANSPARENCY=number
specifies the degree of the transparency of the tile fill, outlines, and the values
that are located inside the tiles if those values are displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies which graphical features to display in the plot.
FILLATTRS=style-element | (fill-options)
specifies the appearance of the tile fill areas.
GUTTER=dimension | (dimension-list)
specifies the gutter (gap) between the splits.
OUTLINEATTRS=style-element | (line-options)
specifies the appearance of the tile outlines.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
574 Chapter 6 • Plot Statements
SQUARED=TRUE | FALSE
specifies that a square aspect ratio be used for the plot area.
Label options
INSIDEVALUEATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the category values when they are
located inside a tile.
LABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the category labels.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
VALUEATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the category values that are located
outside of the tiles.
VALUELOCATION=AUTO | INSIDE | OUTSIDE
specifies the location of the category column values in a two-way plot.
XVALUEFITPOLICY=ROTATE | NONE
specifies a policy for avoiding collisions along the width of the plot among
category values that are outside of the tiles.
YVALUEFITPOLICY=NONE | ROTATEALWAYS
specifies a policy for avoiding collisions along the height of the plot among
category values that are outside of the tiles.
ODS options
URL=string-column
specifies the URL of an HTML page to display when a tile is selected.
Required Arguments
CATEGORY=(column-list)
specifies a list of columns of category (classification) values.
COUNT=non-negative-numeric-column | expression
specifies the column of counts (pre-summarized) for each of the category value
combinations.
Tip You need to provide only the category crossings with nonzero counts.
Optional Arguments
COLORGROUP=column | discrete-attr-var
specifies the category column to use for discrete fill colors for the tiles.
discrete-attr-var
specifies a discrete attribute map variable that is defined in a
DISCRETEATTRVAR statement.
Each unique value of this column is mapped to the COLOR attribute of the
GraphData1–GraphDataN style elements that are in effect. If a discrete attribute map
variable is specified, the color mapping from its associated DISCRETEATTRMAP
statement is used.
Restriction This column or the associated column in the discrete attribute map
variable must be one of the columns in the category column list.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To reverse the start and end colors of the ramp that is assigned to the
color model, use the REVERSECOLORMODEL= option.
When only the outlines are displayed, this option overrides suboption
COLOR= in the OUTLINEATTRS= option and varies the outline
color according to the color gradient or the attribute map.
DATATRANSPARENCY=number
specifies the degree of the transparency of the tile fill, outlines, and the values that
are located inside the tiles if those values are displayed.
Default 0
Default STANDARD
Interactions If neither FILL nor OUTLINE are present in the display-options list,
then filled and outlined tiles are displayed.
If YVALUELOCATION=INSIDE or if YVALUELOCATION=AUTO
and is effectively set to INSIDE, then the axis ticks are not displayed
even if the display of the ticks is specified for the axis.
FILLATTRS=style-element | (fill-options)
specifies the appearance of the tile fill areas. See “General Syntax for Attribute
Options” on page 1347 for the syntax on using a style element. See “Fill Options”
on page 1348 for the available fill options.
GUTTER=dimension | (dimension-list)
specifies the gutter (gap) between the splits. The splits occur in the following way:
• When a single dimension is specified, the dimension applies to the gap for the
last split, which has the smallest gap. From the next-to-last last split to the first
split, the gutter is doubled on each split. A single dimension has the effect of
setting a minimum gap for the plot. The following figure shows an example in
which GUTTER=10.
Note: The plot contains equally sized tiles for demonstration purposes.
In this case, the gaps are 30 pixels for the first split, 20 pixels for the second split,
and 10 pixels for the third split (minimum gap).
578 Chapter 6 • Plot Statements
• When a list of dimension values is used, the values apply to each split in the
order in which they are specified. The following figure shows an example in
which GUTTER=(10 20 30).
In this case, the gaps are 10 pixels for the first split, 20 pixels for the second split,
and 30 pixels for the third split.
Interaction If one or more text options are specified and they do not include all the
font properties such as color, family, size, weight, and style, then the
non-specified properties are derived from the GraphValueText style
element.
Tip You can use the VALUEATTRS= option to change the text attributes
for the values that are located outside the plot area.
Interaction If one or more text options are specified and they do not include all the
font properties such as color, family, size, weight, and style, then the
non-specified properties are derived from the GraphLabelText style
element.
MOSAICPLOTPARM Statement 579
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
OUTLINEATTRS=style-element | (line-options)
specifies the appearance of the tile outlines. See “General Syntax for Attribute
Options” on page 1347for the syntax on using a style element. See “Line Options”
on page 1349 for the available line options.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
580 Chapter 6 • Plot Statements
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles. The predefined roles are CATEGORY1–
CATEGORYn (in the order in which they are specified in the
CATEGORY=option), COUNT, COLORGROUP, and
COLORRESPONSE.
SQUARED=TRUE | FALSE
specifies that a square aspect ratio be used for the plot area.
Default FALSE
Tip Setting this option to TRUE makes the height of the plot the same as its
width, which can make it easier to compare the proportions.
See “boolean ” on page 1339 for other Boolean values that you can use.
TIP=(role-list) | NONE
specifies the information that is displayed when the cursor is positioned over a tile. If
this option is used, then all of the information that is displayed by default is replaced.
Roles for columns that do not contribute to the bar chart can be specified along with
roles that do.
(role-list)
an ordered, space-separated list of unique MOSAICPLOTPARM roles and user-
defined roles. The MOSAICPLOTPARM roles include COUNT,
COLORGROUP, and COLORRESPONSE. User-defined roles are defined with
the ROLENAME= option.
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns that are assigned to the category columns and COUNT
roles are automatically included in the data tip information.
Interaction The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
Example To display data tips for the columns that are assigned to the roles X
and Y as well as the user-defined role TIP1:
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
MOSAICPLOTPARM Statement 581
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies the URL of an HTML page to display when a tile is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
tile that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Tip The URL value can be blank for some tiles, which means that no
action is taken when those tiles are selected. The URL value can be
the same for different tiles, which means that the same action is taken
when those tiles are selected.
Interaction If one or more text options are specified and they do not include all the
font properties such as color, family, size, weight, and style, then the
non-specified properties are derived from the GraphValueText style
element.
Default AUTO
XVALUEFITPOLICY=ROTATE | NONE
specifies a policy for avoiding collisions along the width of the plot among category
values that are outside of the tiles.
ROTATE
rotates the values if any of the values collide.
NONE
does not attempt to fit values that collide.
Default ROTATE
YVALUEFITPOLICY=NONE | ROTATEALWAYS
specifies a policy for avoiding collisions along the height of the plot among category
values that are outside of the tiles.
NONE
does not attempt to fit values that collide.
ROTATEALWAYS
rotates the values regardless of whether any of the values collide.
Default NONE
Details
A mosaic plot displays relative frequencies for categorical variables. Each crossing of
the categorical values is represented by a tile. The area of each tile is proportional to the
frequency of that crossing. The plot is the result of an iterative process. The first iteration
splits the plot area into tiles along the width according to the relative frequency of the
first category column values. Subsequent iterations split the tiles from the previous
iteration in the direction orthogonal to the previous split by using the relative frequencies
of each category column's values. By default, the gap (or gutter) for each split gets
progressively smaller, with a minimum gap of 3 pixels. You can use the GUTTER=
option to specify a different gap for each split.
The following figure provides an example of a three-way mosaic plot, which has three
categories.
Note: The plot contains equally sized tiles for demonstration purposes.
In the example plot, the first split is along the width for CATEGORY 1. The second split
is along the height for CATEGORY 2. Finally, the third split is along the width for
CATEGORY 3. Notice how the gaps between the tiles get progressively smaller from the
first split to the last split.
The following graph was generated by the “Example Program” on page 584:
584 Chapter 6 • Plot Statements
Example Program
/* Summarize the SASHELP.CARS data for ORIGIN and TYPE */
proc summary data=sashelp.cars nway;
class origin type;
var mpg_highway;
output out=mileage mean=avgMpg N=count / noinherit;
run;
NEEDLEPLOT Statement
Creates a plot of observations as points connected to a baseline by vertical line segments.
NEEDLEPLOT Statement 585
Syntax
NEEDLEPLOT X=column | expression
Y=numeric-column | expression </option(s)>;
Appearance options
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing
or bin width.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the needle plot lines.
DATATRANSPARENCY=number
specifies the degree of the transparency of the needle lines, markers, and data
labels, if displayed.
DISPLAY=STANDARD | ALL | display-options
specifies whether to display needle lines with or without markers.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line
pattern) to one of the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the needle lines for the data points.
MARKERATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the attributes of the data markers.
Axes options
BASELINEINTERCEPT=number | RELATIVE
specifies the Y-intercept for the baseline.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABEL=column
specifies labels at the data points.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
DATALABELPOSITION=AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT |
CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the end of the needle lines
and markers, if displayed.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all needle lines and markers from discrete X
values when graphing multiple response variables side by side on a common
axis.
GROUP=column | discrete-attr-var | expression
creates a distinct set of needle lines, markers, and data labels for each unique
group value of the specified column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies whether grouped needle lines are overlaid or clustered around the
category midpoints on a discrete axis or around the intervals on an interval
axis.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page to display when a needle or marker is selected.
Required Arguments
X=column | expression
specifies a column or expression for the X values.
NEEDLEPLOT Statement 587
Y=numeric-column | expression
specifies a numeric column or numeric expression for the Y values.
Optional Arguments
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
BASELINEINTERCEPT=number | RELATIVE
specifies the Y-intercept for the baseline. The baseline is always displayed in the
chart, whether for a specified value or the default value. When this option is used,
the axis range is adjusted to include the baseline, and the baseline is placed at the
specified value on the response axis.
number
specifies the Y-intercept value to use for the baseline.
Tips The baseline does not add a tick or a tick value to the axis. To label
the baseline, you can overlay a REFERENCELINE statement with
the same Y value and use its CURVELABEL option.
RELATIVE
places the baseline at the Y-axis tick mark closest to the minimum of the range
for the needle data points.
Default 0
CLUSTERWIDTH=number
specifies the width of the group clusters as a fraction of the midpoint spacing or bin
width.
588 Chapter 6 • Plot Statements
Default 0.85
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Requirement For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
DATALABEL=column
specifies labels at the data points.
Note The position of the labels is adjusted to prevent the labels from
overlapping.
Interaction For this option to have any effect, the DATALABEL= option must also
be specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default AUTO
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters. When set to
TRUE, the data label is split unconditionally at each occurrence of any of the
specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
590 Chapter 6 • Plot Statements
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
DATATRANSPARENCY=number
specifies the degree of the transparency of the needle lines, markers, and data labels,
if displayed.
592 Chapter 6 • Plot Statements
Default 0
DISCRETEOFFSET=number
specifies an amount to offset all needle lines and markers from discrete X values
when graphing multiple response variables side by side on a common axis.
Default 0 (no offset, all needle lines and markers are centered on the discrete X
values)
Range -0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right. If the parent layout’s axis options
set REVERSE=TRUE, then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of marker
symbols, colors, and line patterns.
Note The representations that are used to identify the groups can be
overridden. For example, each distinct group value might be
represented by a different line pattern, but the
LINEATTRS=(PATTERN=pattern) option could be used to assign the
same line pattern to all of the plot’s line patterns, letting line color
indicate group values. Likewise, LINEATTRS=(COLOR=color) could
be used to assign the same color to all lines, letting line pattern
indicate group values.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies whether grouped needle lines are overlaid or clustered around the category
midpoints on a discrete axis or around the intervals on an interval axis.
OVERLAY
centers the needle lines for matching category values on the midpoints. The
needle lines in each set of group values are superimposed on each other.
CLUSTER
clusters the needle lines for matching category values around the midpoints. Each
cluster of group values is centered at the midpoint for the category.
Default OVERLAY
Interactions For this option to take effect, the GROUP= option must also be
specified.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line pattern)
to one of the GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The Y-column label. If a label is not defined, then the Y-column name
is used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Interactions This option’s COLOR= suboption overrides the default behavior for
grouped data. When the COLOR= suboption is specified in that case,
596 Chapter 6 • Plot Statements
all markers have the same color, and the marker symbol alone
distinguishes the markers.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
NEEDLEPLOT Statement 597
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X. Y, DATALABEL, INDEX, and GROUP.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a needle line
or marker. If this option is used, then it replaces all of the information that is
displayed by default. Roles for columns that do not contribute to the needle plot can
be specified along with roles that do.
(role-list)
an ordered, space-separated list of unique NEEDLEPLOT and user-defined roles.
NEEDLEPLOT roles include X, Y, DATALABEL, and GROUP.
User-defined roles are defined with the ROLENAME= option.
Example The following example displays data tips for the columns assigned to
the roles X and Y as well as the column Obs, which is not assigned to
any pre-defined NEEDLEPLOT role. The Obs column must first be
assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X, Y, DATALABEL, and GROUP.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
598 Chapter 6 • Plot Statements
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a needle or marker is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
needle that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Tips The URL value can be blank for some X and Y pairs, meaning that
no action is taken when the corresponding needle or marker is
selected.
The URL value can be the same for any X and Y pairs. In that case,
the same action is taken when the needle or marker is selected for
those X and Y pairs.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
In the NEEDLEPLOT statement, the X column can specify character or numeric values.
The Y column must specify numeric values. For character columns, the X-axis is always
of TYPE=DISCRETE. For numeric columns, the X-axis is of TYPE=LINEAR by
default.
The Y-axis is of TYPE=LINEAR by default.
The following graph was generated by the “Example Program” on page 600:
600 Chapter 6 • Plot Statements
Example Program
proc template;
define statgraph needleplot;
begingraph;
entrytitle "IBM Stock Trend";
layout overlay;
needleplot x=date y=close /
baselineintercept=80 lineattrs=(color=blue);
endlayout;
endgraph;
end;
run;
PBSPLINEPLOT Statement
Creates a fitted penalized B-spline curve computed from input data.
Restriction: The PBSPLINEPLOT statement supports only models of one independent and one
dependent variable.
Tip: Starting with the third maintenance release of SAS 9.4, subpixel rendering is enabled
by default. To disable subpixel rendering, specify SUBPIXEL=OFF in the
BEGINGRAPH statement or in an ODS GRAPHICS statement. For information
about the BEGINGRAPH statement SUBPIXEL= option, see SUBPIXEL= on page
33.For information about the ODS GRAPHICS statement SUBPIXEL= option, see
“ODS GRAPHICS Statement” in SAS ODS Graphics: Procedures Guide.
PBSPLINEPLOT Statement 601
Syntax
PBSPLINEPLOT X=numeric-column | expression
Y=numeric-column | expression </<regression-option(s)> <option(s)>>;
Appearance options
DATATRANSPARENCY=number
specifies the degree of the transparency of the curve and curve label.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of
the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the line attributes of the spline curve.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABEL="string"
specifies a label for the spline curve.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the spline curve labels.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the spline curve label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the spline curve label relative to the curve line.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the curve label at the specified split characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the curve label can be split if
needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the curve label text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the curve label block.
602 Chapter 6 • Plot Statements
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a distinct set of curves from just the observations that correspond to
each unique group value of the specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
X=numeric-column | expression
specifies the column for the X values.
Y=numeric-column | expression
specifies the column for the Y values.
Optional Arguments
CURVELABEL="string"
specifies a label for the spline curve.
Interaction This option is not valid when the GROUP= option is specified.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the spline curve label relative to the plot area.
INSIDE
locates the labels inside the plot area
PBSPLINEPLOT Statement 603
OUTSIDE
locates the labels outside the plot area
Default INSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
MAX
forces the spline curve label to appear near maximum curve values (typically,
upper right)
MIN
forces the spline curve label to appear near minimum curve values (typically,
lower left)
START
forces the spline curve label to appear near the beginning of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
END
forces the spline curve label to appear near the end of the curve.
Tip This option is particularly useful when the curve line has a spiral
shape.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the curve label at the specified split characters. When a
curve label is split, the label is split on each occurrence of the specified split
characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the curve label can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
curve label. In that case, all of the specified split characters together are treated as a
single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the curve
label is split unconditionally at each occurrence of any of the specified split
characters. If the curve label does not contain any of the specified characters, then
the label is not split.
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
curvelabelsplitchar="abc"
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the curve label text.
TRUE
drops the split characters from the curve label text.
FALSE
includes the split characters in the curve label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a curve label with the following
specifications:
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
curve for reference.
Default TRUE. The split characters are dropped from the curve label.
606 Chapter 6 • Plot Statements
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
DATATRANSPARENCY=number
specifies the degree of the transparency of the curve and curve label.
Default 0
discrete-attr-var
specifies a discrete attribute map variable that is defined in a
DISCRETEATTRVAR statement.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of line colors and
line patterns.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of the
GraphData1–GraphDataN style elements.
608 Chapter 6 • Plot Statements
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
PBSPLINEPLOT Statement 609
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIPFORMAT=(Y=6.2)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Note The columns assigned to the X, Y, and GROUP (if assigned) roles are
automatically included in the data tip information.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIPLABEL=(Y="Curve")
Default The column label or column name of the column assigned to the role.
Note The columns assigned to the X, Y, and GROUP (if assigned) roles are
automatically included in the data tip information.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
610 Chapter 6 • Plot Statements
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Default 0.05
CLI="name"
produces confidence limits for individual predicted values for each observation.
Interaction name is a unique name within the template that is case sensitive and
cannot contain spaces. It must be assigned in order for the confidence
limits to be computed. To display confidence limits, you must use this
name as the required argument of a MODELBAND statement. See the
example in the section “Example: PBSPLINEPLOT Statement” on
page 612 .
CLM="name"
produces confidence limits for a mean predicted value for each observation.
Interaction name is a unique name within the template that is case sensitive and
cannot contain spaces. It must be assigned in order for the confidence
limits to be computed. To display confidence limits, you must use this
name as the required argument of a MODELBAND statement. See the
example in the section “Example: PBSPLINEPLOT Statement” on
page 612 .
DEGREE=non-negative-integer
specifies the degree of B-spline.
Default 3
Ranges 0–174 in the first maintenance release of SAS 9.4 and earlier releases.
Restriction Starting with the second maintenance release of SAS 9.4, DEGREE=
and NKNOTS= cannot be set to 0 simultaneously. When both are set to
0, an error results.
FREQ=numeric-column
specifies a column in the input data set that represents the frequency of occurrence of
the current observation, essentially treating the data set as if each observation
appeared n times, where n is the value of the FREQ column for the observation.
Noninteger values of the FREQ column are truncated to the largest integer less than
the FREQ value. The observation is used in the analysis only if the value of the
FREQ column is greater than or equal to 1.
MAXPOINTS=positive-integer
specifies the maximum number of predicted points generated for the spline curve as
well as any confidence limits.
Default 201
NKNOTS=non-negative-integer
specifies the number of evenly spaced internal knots. By default, a large number of
knots (100) is specified, which allows for an extreme lack of smoothness in the
results. However, the final function is typically much smoother due to the penalty.
When SMOOTH=0 is specified, you should typically ask for many fewer knots than
the default, since there is no penalty for lack of smoothness. For example, ten or
fewer knots is usually enough to follow the functional form found in most data.
Default 100
Restriction Starting with the second maintenance release of SAS 9.4, MKNOTS=
and DEGREE= cannot be set to 0 simultaneously. When both are set to
0, an error results.
SMOOTH=AUTO | non-negative-number
specifies a regression parameter value.
Default AUTO
WEIGHT=numeric-column
specifies a column in the input data set that contains values to be used as a priori
weights for a penalized B-spline fit. If an observation’s weight is zero, negative, or
missing, then the observation is deleted from the analysis.
Interaction Starting with the second maintenance release of SAS 9.4, when the
CLI= option is used with this option, the confidence band for individual
predicted values is displayed as a high-low chart instead of a band.
612 Chapter 6 • Plot Statements
Details
The PBSPLINEPLOT statement only supports models of one independent and one
dependent variable. For more information about the fitting methodology, see the
TRANSREG procedure in the SAS/STAT user’s guide.
In addition to the penalized B-spline, the PBSPLINEPLOT statement can compute
confidence levels for the fitted line. To display the confidence levels,
1. use the CLI= or CLM= option to declare a name for the confidence level
2. use a MODELBAND statement to refer to this name. This statement draws a
confidence band from this information. See “MODELBAND Statement” on page
565 for information about how to control the appearance of the confidence band.
The following graph was generated by the “Example Program” on page 612:
Example Program
proc template;
define statgraph pbsplineplot;
begingraph;
entrytitle "Spline Fit";
layout overlay;
scatterplot x=weight y=mpg_highway /
datatransparency=0.7;
pbsplineplot x=weight y=mpg_highway / name="fitline"
alpha=0.05 legendlabel="Spline Fit";
PIECHART Statement 613
discretelegend "fitline";
endlayout;
endgraph;
end;
run;
PIECHART Statement
Creates a pie chart that is computed from input data.
Requirement: The PIECHART statement must be placed in a LAYOUT REGION, LAYOUT
GRIDDED, or LAYOUT LATTICE block. It cannot be placed in an overlay-type layout
such as LAYOUT OVERLAY or LAYOUT OVERLAYEQUATED because a pie chart
does not have axes.
Note: The PIECHART statement does not honor the ODS GRAPHICS options
DISCRETEMAX=, GROUPMAX=, and LABELMAX=.
Syntax
PIECHART CATEGORY=column | discrete-attr-var | expression </option(s)>;
PIECHART CATEGORY=column | discrete-attr-var | expression
RESPONSE=numeric-column | expression </option(s)>;
Appearance options
CATEGORYDIRECTION=COUNTERCLOCKWISE | CLOCKWISE
specifies whether to display the pie slices in counterclockwise or clockwise
sequence.
CENTERFIRSTSLICE=TRUE | FALSE
specifies whether the first pie slice is centered on the starting angle or starts
on the starting angle.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled pie slices.
DATATRANSPARENCY=number
specifies the degree of the transparency of all pie slices, outlines, and text.
DISPLAY=STANDARD | (display-options)
specifies whether to display outlined pie slices, filled pie slices, or outlined
and filled pie slices.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled pie slices.
OTHERSLICEOPTS=(other-slice-options)
specifies the properties of the Other slice.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the properties of the pie and slice outlines.
START=degrees
614 Chapter 6 • Plot Statements
specifies which degree between 0 and 360 serves as the starting position for
the first pie slice.
Grouping options
GROUP=column | expression
creates a separate concentric annulus (or stacked cylinders) for each unique
group value of the specified column.
GROUPGAP=dimension
specifies a dimension for the optional gap that can be displayed between each
annulus of a grouped pie.
GROUPLABELOPTS=(grouplabel-options)
specifies text attributes, location, and other options for displaying group
labels.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the Group column are included in the pie.
OTHERSLICE=TRUE | FALSE
specifies whether to consolidate smaller pie slices into a single slice that
represents “other” values that are in the data, or whether to display those
smaller slices as separate pie slices.
Label options
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the slice labels.
DATALABELCONTENT=ALL | STANDARD | NONE | (content-options)
specifies the information to display in the slice labels.
DATALABELLOCATION=AUTO | INSIDE | OUTSIDE | CALLOUT
specifies whether to display the slice labels within the pie slices or outside of
the pie circumference.
LABELFITPOLICY=NONE | DROP
specifies the label fitting policy to be used if a particular label does not fit
within the pie slice.
ODS options
URL=string-column
specifies an HTML page to display when a pie slice is selected.
Statistics options
STAT=FREQ | PCT | SUM | MEAN
PIECHART Statement 615
Required Argument
CATEGORY=column | discrete-attr-var | expression
specifies the column for the category values. Duplicated values of CATEGORY are
summarized into a unique value. All values are treated as discrete.
discrete-attr-var
specifies a discrete attribute map variable that is defined in a
DISCRETEATTRVAR statement.
Optional Arguments
CATEGORYDIRECTION=COUNTERCLOCKWISE | CLOCKWISE
specifies whether to display the pie slices in counterclockwise or clockwise
sequence.
Default COUNTERCLOCKWISE
Tip The START= option controls the starting angle for the first pie slice.
CENTERFIRSTSLICE=TRUE | FALSE
specifies whether the first pie slice is centered on the starting angle or starts on the
starting angle.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
The following figure shows the effect of this option on a pie chart in which Asia is
the first category slice, the starting angle is 0 degrees, and the category direction is
counterclockwise.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Note The position of the labels is adjusted to prevent the labels from
overlapping.
AUTO
automatically selects either INSIDE, OUTSIDE, or CALLOUT to optimize the
label position
INSIDE
locates the slice labels inside the pie slices.
Note: If a particular label does not fit within the pie slice, then the fit policy
takes effect (set by the LABELFITPOLICY= option).
OUTSIDE
locates the slice labels outside of the pie circumference.
CALLOUT
locates the slice labels outside of the pie circumference and draws a line from the
label to its slice.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, DISPLAY= FILL must be in effect.
Otherwise, this option is ignored.
When a data skin is applied, all slice outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of all pie slices, outlines, and text.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the pie
slices. The OTHERSLICEOPTS= option can be used to specify
transparency for the “other” slice. You can combine this option with
FILLATTRS= and with OTHERSLICEOPTS= to set one transparency for
the outlines and text but a different transparency for the pie slices.
Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
PIECHART Statement 619
DISPLAY=STANDARD | (display-options)
specifies whether to display outlined pie slices, filled pie slices, or outlined and filled
pie slices.
STANDARD
displays outlined, filled pie slices
(display-options)
a space-separated list of one or more of the following options enclosed in
parentheses:
OUTLINE
displays outlined pie slices. The default outline properties are set by the
GraphOutline style element.
FILL
displays filled pie slices with each slice a different color. The default colors
are set by the Color attribute of the GraphData1–GraphDataN style elements.
The fill color of the “other” slice (if shown) is from the color attribute of the
GraphOther style element. If FILL is not specified, then an opaque pie is
drawn using the background color of the containing layout.
Default STANDARD
Interaction For this option to have any effect, the fill must be enabled by the ODS
style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element value.
GROUP=column | expression
creates a separate concentric annulus (or stacked cylinders) for each unique group
value of the specified column. The grouped rings are displayed in data order.
620 Chapter 6 • Plot Statements
Interactions When this option is used, the unique column values are found and then
the slice colors are taken from the GraphData1–GraphDataN style
elements.
Missing values in the data can affect the group order. You can use the
INCLUDEMISSINGGROUP= option to manage missing group
values. In addition, you can use
INCLUDEMISSINGDISCRETE=TRUE in the BEGINGRAPH
statement to create pie slices for missing CATEGORY values.
Tip This option creates only rings of pies. To create a grid of pies, specify
the PIECHART statement within a LAYOUT LATTICE, LAYOUT
DATALATTICE, or LAYOUT DATAPANEL statements.
See FILLATTRS=
GROUPGAP=
GROUPLABELOPTS=
GROUPGAP=dimension
specifies a dimension for the optional gap that can be displayed between each
annulus of a grouped pie.
Default 0
Restriction For this option to take effect, the GROUP= option must also be
specified.
Interaction If the specified dimension is too large for the area that is available to
the pie chart, then the results might be unexpected.
Note The size of the inner pie remains the same regardless of the
GROUPGAP= value.
PIECHART Statement 621
GROUPLABELOPTS=(grouplabel-options)
specifies text attributes, location, and other options for displaying group labels. The
following grouplabel-options are available. One or more options can be specified as
space-separated name = value pairs.
LABEL=AUTO | NONE | "string"
specifies a descriptive label for the Group column
AUTO specifies the column label of the GROUP= column or the column
name of the GROUP= column, if no column label exists.
NONE specifies that no label is displayed
"string" specifies a string to use as the label
Default AUTO
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LOCATION=RIGHT | LEFT
specifies whether the block of text for group labeling appears to the right or left
of the pie.
Default RIGHT
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default The group label and values are shown as a block of text to the right or
left of the pie. Slice labels are moved to the inside of the pie slices. A
line is drawn from each group value to its annulus (or cylinder).
Restriction For this option to take effect, the GROUP= option must also be
specified.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the Group column are included in the pie.
Default TRUE
622 Chapter 6 • Plot Statements
Restriction For this option to take effect, the GROUP= option must also be
specified.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABELFITPOLICY=NONE | DROP
specifies the label fitting policy to be used if a particular label does not fit within the
pie slice.
NONE
draws each label regardless of whether it fits within the slice region.
DROP
drops labels that do not fit within the slice region, but draws labels that do fit.
Default NONE
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
OTHERSLICE=TRUE | FALSE
specifies whether to consolidate smaller pie slices into a single slice that represents
“other” values that are in the data, or whether to display those smaller slices as
separate pie slices. If this option is set to FALSE, then all unique category values
appear as slices. If this option is set to TRUE, then some of the smaller slices might
be combined into a single slice, referred to as the Other slice.
Default TRUE
Tip To set the properties of the “other” slice, use the OTHERSLICEOPTS=
option.
See “boolean ” on page 1339 for other Boolean values that you can use.
OTHERSLICEOPTS=(other-slice-options)
specifies the properties of the Other slice. Example:
piechart category=region / name="p"
datalabelcontent=(percent) datalabellocation=inside
otherslice=true
othersliceopts=(type=percent percent=11 label="Other Regions") ;
PIECHART Statement 623
The following other-slice-options values are available. You can specify one or more
options as space-separated name = value pairs.
TYPE=PERCENT | MAXSLICES
specifies which method to use to determine the size of the Other slice.
Default PERCENT
MAXSLICES=positive-integer
specifies the maximum number of category values to represent with pie slices.
Any remaining values are consolidated into the Other slice.
Default 10
Interactions For this option to have any effect, TYPE=MAXSLICES must also
be specified among the suboptions for OTHERSLICEOPTS=.
The slices are counted in the order in which they are displayed.
This order is affected by the CATEGORYDIRECTION= option.
PERCENT=percent-of-total
collects all category values with response values less than or equal to the
specified percent-of-total value into the Other slice.
Default 4. Any original slice that represents 4% or less of the total is put in
the Other category.
Range 0–100
Interaction For this option to have any effect, TYPE=PERCENT must also be
specified among the suboptions for OTHERSLICEOPTS=.
624 Chapter 6 • Plot Statements
LABEL="string"
specifies a label for the Other slice.
Default "OTHER"
See “General Syntax for Attribute Options” on page 1347 for the
syntax for using a style-element value.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
START=degrees
specifies which degree between 0 and 360 serves as the starting position for the first
pie slice. A value of 0 degrees corresponds to the three o'clock position. Degrees can
be either positive or negative. Positive values move the starting position
counterclockwise, and negative values move the starting position clockwise. From
the starting point specified by this option, the slices are drawn in the direction
specified by the CATEGORYDIRECTION= option.
Default 0
Range 0 to 360
SUM
MEAN
Defaults SUM for pie charts that specify the RESPONSE= argument
FREQ for pie charts that do not specify the RESPONSE= argument
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a pie slice. If
this option is used, then it replaces all of the information that is displayed by default.
(role-list)
an ordered, space-separated list of unique PIECHART roles. PIECHART roles
include CATEGORY, RESPONSE, and GROUP. The RESPONSE role
represents the computed statistic for the CATEGORY value, based on the statistic
that is set by the STAT= option.
Example The following example displays data tips for the columns assigned to
the roles CATEGORY and RESPONSE.
TIP=(CATEGORY RESPONSE)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: CATEGORY and RESPONSE .
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIP=(RESPONSE)
TIPFORMAT=(RESPONSE=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIP=(RESPONSE)
TIPLABEL=(RESPONSE="Average Sales")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
URL=string-column
specifies an HTML page to display when a pie slice is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
pie slice that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Restriction A generated Other slice does not have a URL. See OTHERSLICE=.
Requirement To generate a plot with selectable pie slices, you must include an
ODS GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tips The URL value can be blank for some pie slices, meaning that no
action is taken when the corresponding slice is selected.
The URL value can be the same for any CATEGORY and
RESPONSE pairs. In that case, the same action is taken when the pie
slices for those pairs are selected.
Details
The input data for the PIECHART statement is raw, unsummarized input data. The
PIECHART performs discrete binning for the Category column and calculates
appropriate summarization statistics (sum, mean, and so on) based on the setting for the
STAT= option.
The fill color of each pie slice is derived from the Color attribute of the GraphData1–
GraphDataN style elements as described in “Attribute Rotation Patterns” in SAS Graph
Example: PIECHART Statement 627
Template Language: User's Guide. The default order of the pie slices depends on the
data type of the CATEGORY values:
• For numeric data, the slices appear in the ascending order of the unformatted data
values.
• For discrete data, the slices appear in data order.
You can use the START= and CATEGORYDIRECTION= options to control the pie slice
positions and display order.
By default, the pie slices are labeled with the CATEGORY and RESPONSE values,
which are displayed inside the slices. You can use the DATALABELLOCATION= and
DATALABELCONTENT= options to control where the pie slices are labeled and the
label content.
By default, if two or more slices take up less than 4% of a pie, then an “other” slice is
created by consolidating those small slices. To change the default criteria, use the
OTHERSLICE= and OTHERSLICEOPTS= options. The calculated “other” slice is
displayed as the last slice in the pie, and as the last legend entry for the pie. If a category
value is the same as the “other” slice label, then two slices might be displayed with the
same label ("Other" by default) and different fill attributes. In that case, both slices are
represented in the pie legend.
To create a pie slice for missing CATEGORY values, specify
INCLUDEMISSINGDISCRETE=TRUE in the BEGINGRAPH statement. The fill color
of the missing category slice is assigned the fill color from the GraphMissing style
element except when a user-defined format is applied to the category value. In that case,
the missing category slice is assigned the fill color from a GraphData1–GraphdDataN
style element in data order instead.
Note: The PIECHART statement does not honor the MISSING= system option.
Regardless of the MISSING= system option value, unless a user-defined format is
applied to the value, the default missing-numeric-value character (.) is used to depict
missing numeric values.
The following graph was generated by the “Example Program” on page 628 :
628 Chapter 6 • Plot Statements
Example Program
proc template;
define statgraph simplepie;
begingraph;
entrytitle "Car Models by Origin";
layout region;
piechart category=origin / datalabellocation=outside;
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.cars
template=simplepie;
run;
POLYGONPLOT Statement
Draws a polygon from data that is stored in a data set.
Note: This statement is valid in the first maintenance release of SAS 9.4 and later
releases.
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
POLYGONPLOT Statement 629
Syntax
POLYGONPLOT X=column | expression Y=column | expression
ID=column | expression< /options(s)>
Appearance options
ANTIALIAS=AUTO | OFF
specifies whether anti-aliasing is turned off for this plot.
BACKLIGHT=number | AUTO
specifies a back-light effect for the polygon label text.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the numeric column or range attribute map variable to use to
determine the polygon colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of filled polygons.
DATATRANSPARENCY=number
specifies the degree of the transparency of the polygon fill, outline, and label,
when these attributes are displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies whether to display the polygon outline, fill, or both.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled polygon areas.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the polygon outline.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
ROTATE=numeric-column | numeric-constant | expression
specifies the angle of rotation for the polygon, measured in degrees.
ROTATELABEL=AUTO | NONE | VERTICAL
specifies the rotation of the polygon label with respect to the rotation of the
polygon.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the
polygon.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns.
TIPLABEL=(role-label-list)
specifies display labels for tip columns.
Label options
LABEL=column | expression
specifies the label for the polygon.
LABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the polygon label.
LABELLOCATION=INSIDEBBOX | OUTSIDEBBOX | OUTSIDE
specifies the location of the polygon label.
LABELPOSITION=CENTER | XMIN | XMAX | YMIN | YMAX
specifies the position of the polygon label with respect to the label location.
LABELSPLIT=TRUE | FALSE
specifies whether to split the polygon label at the specified split characters.
LABELSPLITCHAR="character-list"
specifies one or more characters on which the polygon label can be split if
needed.
LABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the polygon label.
LABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the polygon label
blocks.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies the amount by which to offset all polygon vertices from discrete X
values, from discrete Y values, or from both.
GROUP=column | discrete-attr-var | expression
creates a separate and visually distinctive polygon for each unique grouping
value.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
XOFFSET=numeric-column | expression
specifies an individual offset from the discrete X value on each vertex of the
polygon.
YOFFSET=numeric-column | expression
specifies an individual offset from the discrete Y value on each vertex of the
polygon.
ODS options
URL=string-column
specifies an HTML page that is displayed when the polygon is selected.
NAME="string"
assigns a name to this plot statement for reference in other template
statements.
Required Arguments
X=column | expression
specifies the column for the X values.
Note A missing value in the X column signals the start of the data for a hole in the
polygon. See “Drawing Holes in a Polygon” on page 650.
Y=column | expression
specifies the column for the Y values.
Note A missing value in the Y column signals the start of the data for a hole in the
polygon. See “Drawing Holes in a Polygon” on page 650.
ID=column | expression
specifies the column that contains the ID value that is associated with each polygon.
Requirements All of the observations for a single polygon must have the same ID
value.
When multiple polygons are defined in the same data set, all of the
observations for a given ID must be defined contiguously.
Interspersing the ID observations in the data set can produce
unexpected results.
Note Observations that have a missing value in the ID column are ignored
by the POLYGONPLOT statement.
Optional Arguments
ANTIALIAS=AUTO | OFF
specifies whether anti-aliasing is turned off for this plot.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
AUTO
specifies that anti-aliasing is controlled by the ANTIALIAS= option in the ODS
GRAPHICS statement.
OFF
specifies that anti-aliasing is always disabled for this plot.
Default AUTO
BACKLIGHT=number | AUTO
specifies a back-light effect for the polygon label text.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
632 Chapter 6 • Plot Statements
AUTO
the system selects an appropriate level for the back-light effect. If the GROUP=
or COLORRESPONSE= option is in effect, BACKLIGHT=0.75. Otherwise,
BACKLIGHT=0.5.
The following figure shows the effect on a polygon label located inside the polygon
bounding box.
The back light is based on text color. For dark colors, a contrasting white back-light
effect is used. For lighter colors, a contrasting black back-light effect is used. The
following figure shows the two back-light types when BACKLIGHT=1.
Restriction Vector graphics output cannot be generated when the back-light effect
is applied. If you request vector graphics output and enable the back-
light effect, an image is generated instead.
Interaction The LABEL= option must be specified for this option to have any
effect.
Tip The BACKLIGHT= option is most effective when the text color has a
low level of contrast with the background or when the background is
cluttered.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
POLYGONPLOT Statement 633
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To reverse the start and end colors of the ramp that is assigned to the
color model, use the REVERSECOLORMODEL= option.
Requirement The COLORRESPONSE= value should remain constant for the same
ID value. Otherwise, unexpected results might occur.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
Requirement For this option to have any effect, the DISPLAY= option must
include FILL.
When a data skin is applied, all polygon outlines are set by the skin
and the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the polygon fill, outline, and label, when
these attributes are displayed.
Default 0
Tip You can use the FILLATTRS= option to set transparency for just the filled
polygon areas. You can combine this option with FILLATTRS= to set one
transparency for the polygon outline and label and a different transparency
for the polygon fill. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
POLYGONPLOT Statement 635
DISCRETEOFFSET=number
specifies the amount by which to offset all polygon vertices from discrete X values,
from discrete Y values, or from both.
Default 0 (all polygon vertices are centered on the discrete X values, on the
discrete Y values, or on both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right on discrete X values and up on
discrete Y values. If option REVERSE=TRUE is specified in the
layouts axis options, then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets in order to accommodate the discrete
offset.
Default STANDARD
Interactions For this option to have any effect, the fill must be enabled by the ODS
style or by the DISPLAY= option.
636 Chapter 6 • Plot Statements
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Default The polygon attributes for each unique group value are derived from
the GraphData1–GraphDataN and GraphMissing style elements. If
the polygon is filled, then the COLOR attribute is used for the
polygon fill and the CONTRASTCOLOR attribute is used for the
polygon outline. If the polygon is not filled, then the
CONTRASTCOLOR and PATTERN attributes are used for the
polygon outline.
Requirement The group value must remain constant for the same ID value.
Otherwise, the results are unpredictable.
Interactions If a discrete attribute map variable is specified, then the colors and
outline patterns are mapped according to the associated
DISCRETEATTRMAP statement. See “DISCRETEATTRMAP
Statement” on page 1287. Otherwise, the colors and outline patterns
are mapped according to data order.
Note The group values should remain constant for the same ID value.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Restriction This option is ignored and missing group values are not displayed when
ID= and GROUP= specify the same values.
POLYGONPLOT Statement 637
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABEL=column | expression
specifies the label for the polygon.
Note The label text should be the same for all of the observations for a polygon
ID. When different labels are specified for the same ID, the label that is
specified in the first observation for that ID is used.
Tips The default label text color is based on the use of polygon fill and outline
colors, and on whether the GROUP= or COLORRESPONSE= option is
specified. To change the label text color and font, use the LABELATTRS=
option.
Interaction If one or more text options are specified and they do not include all of
the font properties (such as color, family, size, weight, and style), then
the non-specified properties are derived from the GraphLabelText style
element or from a GraphData1–GraphDataN style element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
INSIDEBBOX locates the label inside the bounding box of the polygon.
OUTSIDEBBOX locates the label outside the bounding box of the polygon
but inside the plot area.
OUTSIDE locates the label outside the plot area.
Default INSIDEBBOX
Interaction The LABEL= option must be specified for this option to have any
effect.
Tip The label's exact position is relative to the polygon's X and Y data
ranges and is determined by the combination of this option and the
LABELPOSITION= option.
LABELSPLIT=TRUE | FALSE
specifies whether to split the polygon label at the specified split characters. When
this option is set to TRUE, the polygon label is split unconditionally at each
occurrence of any of the specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
640 Chapter 6 • Plot Statements
LABELSPLITCHAR="character-list"
specifies one or more characters on which the polygon label can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
polygon label. In that case, all of the specified split characters together are treated as
a single split character.
When LABEL= is specified and LABELSPLIT=TRUE, the polygon label is split
unconditionally at each occurrence of any of the specified split characters. If the
polygon label does not contain any of the specified characters, then the label is not
split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
LABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the polygon label.
TRUE
drops the split characters from the polygon label.
FALSE
includes the split characters in the polygon label. When LABELSPLIT=TRUE
and LABELSPLITCHARDROP=FALSE, each split character remains as the last
character in the current line. The characters that follow the split character, up to
and including the next split character, are then wrapped to the next line.
The following figure shows an example of polygon label Product*Group*A split on
* when LABELSPLITCHARDROP=TRUE and
LABELSPLITCHARDROP=FALSE.
POLYGONPLOT Statement 641
Default TRUE. The split characters are dropped from the polygon label.
Requirement The LABEL= option and the LABELSPLIT=TRUE option must also
be specified.
See “boolean ” on page 1339 for other Boolean values that you can use.
XMIN RIGHT
XMAX LEFT
Default AUTO
Requirement The LABEL= option and the LABELSPLIT=TRUE option must also
be specified.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
642 Chapter 6 • Plot Statements
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or by the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
POLYGONPLOT Statement 643
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles ID, COLORRESPONSE, GROUP, LABEL, and
URL.
Rotating a polygon does not change data ranges that are reported to the
axes. As a result, clipping might occur in some cases.
NONE
does not rotate the label with the rotation of the polygon. The label position
remains fixed regardless of the polygon rotation.
VERTICAL
rotates the label to a vertical position.
Default AUTO
Interaction The LABEL= option must be specified for this option to have any
effect.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the polygon.
If you use this option, it replaces all of the information that is displayed by default.
You can specify roles for columns that do not contribute to the polygon plot along
with roles that do.
(role-list)
an ordered, space-separated list of unique POLYGONPLOT and user-defined
roles. POLYGONPLOT roles include ID, COLORRESPONSE, GROUP,
LABEL, and URL.
Example The following example displays the columns that are assigned to the
roles ID and URL, and the columns XOffset and YOffset in the data
tips. The XOffset and YOffset columns are not assigned to any
predefined POLYGONPLOT role, so they must first be assigned a
role:
ROLENAME=(TIP1=XOFFSET TIP2=YOFFSET)
TIP=(ID TIP1 TIP2 URL)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns that are assigned to the following roles are
automatically included in the data tip information: ID,
COLORRESPONSE or GROUP, LABEL, and URL.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that specifies the IMAGEMAP option,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
POLYGONPLOT Statement 645
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
URL=string-column
specifies an HTML page that is displayed when the polygon is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
polygon that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Note The URL values should remain constant for the same ID value.
646 Chapter 6 • Plot Statements
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
XOFFSET=numeric-column | expression
specifies an individual offset from the discrete X value on each vertex of the
polygon.
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right on discrete X values. If option
REVERSE=TRUE is specified in the layout's X-axis options, then the
offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum offset and maximum offset. In some cases, setting a discrete
offset can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets in order to accommodate the discrete
offset.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YOFFSET=numeric-column | expression
specifies an individual offset from the discrete Y value on each vertex of the
polygon.
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is up on discrete Y values. If option
REVERSE=TRUE is specified in the layout's Y-axis options, then the
offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum offset and maximum offset. In some cases, setting a discrete
offset can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets in order to accommodate the discrete
offset.
Details
Overview
The POLYGONPLOT statement draws a polygon from a series of X-Y value pairs that
are stored in a SAS data set. The first X-Y value pair defines the starting point of the
polygon. The next X-Y pair in the data specifies the coordinates of the first vertex. A
line segment is drawn from the starting point to the first vertex. For subsequent X-Y
pairs, a line segment is drawn from the previous vertex to the current vertex. This pattern
repeats until all of the segments have been drawn. If the last segment does not close the
polygon, then the POLYGONPLOT statement automatically draws a segment from the
last vertex back to the starting point in order to close the polygon.
Using the POLYGONPLOT statement, you can draw any data-driven shape on your
graph, which enables you to highlight data features, outline data boundaries, and so on.
Unlike DRAW statements in a BEGINPLOYGON block, the following conditions apply
to the POLYGONPLOT statement:
• you need to modify only the polygon data in the graph data set to modify the
polygon. You do not need to modify the template code. (See “BEGINPOLYGON
Statement” on page 1199.)
• you can draw polygons between plots. The BEGINPOLYGON block and DRAW
statements can draw polygons only on top of or behind the graph.
GROUP (p. 636) Numeric or character Creates a separate polygon color, outline
pattern, or both for each unique grouping that
is specified.
LABEL (p. 637) Numeric or character Specifies the label for the polygon.
XOFFSET (p. 646) Numeric Specifies an individual offset from the discrete
X value on each vertex of the polygon.
YOFFSET (p. 646) Numeric Specifies an individual offset from the discrete
Y value on each vertex of the polygon.
* You can specify any valid column name for these columns in your data set.
Obs id x y
1 P1 40 100
2 P1 20 220
3 P1 160 200
4 P1 180 80
5 P1 40 100
POLYGONPLOT Statement 649
The following figure shows how the polygon is drawn. Grid lines are provided to help
you locate the polygon vertices in the output.
The polygon starting point is X=40, Y=100 (shown in red). From the starting point, the
segments are drawn in data order. Data order is in a clockwise direction, as indicated by
the gray arrow. Although the last observation (X=40, Y=100) is provided in this
example, it is not required. If the last observation is not provided in the data, then the
POLYGONPLOT statement draws the last segment automatically in order to close the
polygon.
For an example, see “Example: Drawing a Simple Polygon That Highlights Data” on
page 652.
Obs id x y label
1 1 0 0 ID=1
2 1 20 0
3 1 20 30
4 1 0 30
5 1 0 0
6 2 30 0 ID=2
7 2 50 0
8 2 40 30
9 2 30 0
650 Chapter 6 • Plot Statements
10 3 60 0 ID=3
11 3 80 5
12 3 80 15
13 3 70 30
14 3 60 30
15 3 60 0
In addition to the ID column, X column, and Y column, the Label column is added to
label the polygons in the output. Notice that the observations for each ID value are
grouped together in the data set. The observations for each ID must occur contiguously
in the data. Otherwise, unexpected results might occur.
The following figure shows how the polygons are drawn from this data. Grid lines are
provided to help you locate the polygon vertices in the output.
The polygons are drawn in the order in which they appear in the data: rectangle (ID=1),
triangle (ID=2), and polygon (ID=3). The red dot on each shape indicates the starting
point for that shape. The gray arrow indicates the direction in which the segments are
drawn for each shape.
Here is example data for a simple polygon that has two holes.
Polygon Data
Obs id x y
POLYGONPLOT Statement 651
1 1 1 1
2 1 9 1
3 1 7 5
4 1 9 9
5 1 1 9
6 1 3 5
7 1 1 1
8 1 . .
9 1 3 8
10 1 7 8
11 1 6 6
12 1 4 6
13 1 3 8
14 1 . .
15 1 3 2
16 1 7 2
17 1 6 4
18 1 4 4
19 1 3 2
Observations 1–7 specify the data for the outer polygon. In observation 8, the X and Y
values are missing, which indicates the start of the data for the first hole. Observations
9–13 define the data for the first hole polygon. Observation 14 indicates the start of the
data for the second hole, which is defined by observations 15–19.
The following figure shows how the polygon is drawn from this data. Grid lines are
provided to help you locate the polygon vertices in the output.
The outer polygon is drawn first, starting at point X=1, Y=1. The segments are drawn in
data order, which is in a counterclockwise direction as indicated by the gray arrow. The
first hole is drawn next, starting at point X=3, Y=8. Its segments are drawn in a
clockwise direction. The second hole is drawn last, starting at point X=3, Y=2. Its
segments are drawn in a counterclockwise direction.
652 Chapter 6 • Plot Statements
This example shows you how to use the POLYGONPLOT statement to draw a filled
polygon that highlights data in an iris petal dimension scatter plot. The polygon
surrounds the markers for the Setosa species in order to highlight the data for that
species. This example is a modified version of the example in “Example:
BEGINPOLYGON Statement” on page 1205. This version uses the POLYGONPLOT
statement instead of a BEGINPOLYGON block so that you can compare the two
methods. The following figure shows the output for this example.
Details
To draw a single polygon, the data set must provide an X column, a Y column, and an ID
column. The data specifies the polygon vertices around the Setosa data in a clockwise
direction. A Label column is added to provide a label for the polygon in the plot output.
Concatenation of the Polydata and Sashelp.Iris data sets results in missing values for the
SCATTERPLOT statement grouping variable in the Iris data set. By default, the
SCATTERPLOT statement includes missing group values. To exclude the missing group
values, the INCLUDEMISSINGGROUP=FALSE option is added to the
SCATTERPLOT statement.
In the POLYGONPLOT statement, the DISPLAY= option specifies the polygon fill only.
The FILLATTRS= option specifies the fill color as yellow and a fill transparency of
0.75. Rather than using draw statements to draw an annotation for the polygon, this
example uses the POLYGONPLOT statement label feature to label the polygon. The
LABEL= option specifies the column in the data set that contains the polygon label text.
The LABELLOCATION= and LABELPOSITION= options place the polygon label
outside of and above the polygon’s bounding box.
To draw the polygon, the POLYGONPLOT statements starts at X=9, Y=2, and draws a
segment between each vertex in data order. The last vertex, X=11, Y=0, does not close
654 Chapter 6 • Plot Statements
the polygon. To close the polygon, the POLYGONPLOT statement draws a segment
between X=11, Y=0 and X=9, Y=2 automatically.
If you want to highlight the Versicolor data instead of the Setosa data, then you need
only modify the data in the Polydata data set to draw a polygon around the Versicolor
data instead. You do not have to make any changes to the template code.
REFERENCELINE Statement
Creates a horizontal or vertical reference line.
Requirement: A REFERENCELINE statement can be used within a 2-D layout (OVERLAY,
OVERLAYEQUATED, DATALATTICE, or DATAPANEL) only.
Note: Specifying the X= option creates a line perpendicular to the X-axis at an X-intercept.
Specifying the Y= option creates a line perpendicular to the Y-axis at a Y-intercept.
Syntax
REFERENCELINE X=x-axis-value | column | expression </option(s)>;
REFERENCELINE Y=y-axis-value | column | expression </option(s)>;
Appearance options
CLIP=TRUE | FALSE
specifies whether the reference line data is to be considered when
determining the data range for the axis.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the reference lines.
DATATRANSPARENCY=number
specifies the degree of the transparency of the reference line.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the reference line.
Axes options
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABEL="string" | column | expression
specifies a label for the reference line or lines.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the reference line label(s).
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the reference line label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN
specifies the position of the reference line label relative to the reference line.
REFERENCELINE Statement 655
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the reference line label at the specified split
characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the reference line label can be split
if needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the reference line label
text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the reference line label
block.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all reference lines from the specified values
when the X or Y axis is discrete.
Required Arguments
You must use either the X= or the Y= argument in the REFERENCELINE statement.
X=x-axis-value | column | expression
specifies the X intercept of the reference line or lines.
Values must be the same type as the data type of the X axis. For
example, you should use numeric SAS date or time values (or SAS
date/time constants) for a time axis.
Note When a character value is specified, leading blanks are honored and
trailing blanks are ignored when the specified value is compared
with the data values.
Values must be the same type as the data type of the Y axis.
Note When a character value is specified, leading blanks are honored and
trailing blanks are ignored when the specified value is compared
with the data values.
Optional Arguments
CLIP=TRUE | FALSE
specifies whether the reference line data is to be considered when determining the
data range for the axis.
FALSE
specifies that the reference line values are to be considered when the axis range is
determined. The reference lines are drawn as follows based on the axis type:
• For a discrete axis, the reference line values that are not already on the axis
are added to the end of the axis data list. When applicable, the axis values are
then sorted:
• If the axis values are numeric values, then they are sorted ordinally.
• If the axis values are character values and a sorting option is applied to the
axis, then they are sorted as specified by the sorting option.
Reference lines are then drawn at the specified locations.
• For a linear, log, or time axis, a new axis data list is created by performing a
mathematical union of the data values and the reference line values. The
reference lines are then drawn at the locations specified.
TRUE
specifies that the reference line values are not to be considered when the axis
range is determined. The reference lines are drawn as follows based on the axis
type:
• For a discrete axis, if the reference line value exactly matches a value on the
axis, a reference line is drawn at that location. Otherwise, the reference line is
not drawn.
REFERENCELINE Statement 657
Note: If the axis values are formatted, then the reference line value must
exactly match the formatted axis value in order for the line to be drawn.
• For a linear, log, or time axis, if the reference line value is within the axis
data range, then the reference line is drawn at the specified location.
Otherwise, the reference line is not drawn.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interaction For this option to take effect, the CURVELABEL= option must also be
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the reference line label relative to the plot area.
Default OUTSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
658 Chapter 6 • Plot Statements
MAX
forces the line label to appear near maximum line values (typically, the top or
right).
MIN
forces the line label to appear near minimum line values (typically, the bottom or
left).
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the reference line label at the specified split characters.
When a reference line label is split, the label is split on each occurrence of the
specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the reference line label can be split if
needed. When multiple split characters are specified, each character in the list is
treated as a separate split character unless the specified characters appear
consecutively in the reference line label. In that case, all of the specified split
characters together are treated as a single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the
reference line label is split unconditionally at each occurrence of any of the specified
split characters. If the reference line label does not contain any of the specified
characters, then the label is not split.
"character-list"
a list of one or more characters with no spaces between them enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters in
the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the reference line label text.
TRUE
drops the split characters from the reference line label text.
FALSE
includes the split characters in the reference line label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a Y-axis reference line label with the
following specifications:
• CURVELABELPOSITION=MAX
660 Chapter 6 • Plot Statements
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
reference line for reference.
Default TRUE. The split characters are dropped from the reference line label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
DATATRANSPARENCY=number
specifies the degree of the transparency of the reference line.
Default 0
662 Chapter 6 • Plot Statements
Note This option does not affect the reference line label.
DISCRETEOFFSET=number
specifies an amount to offset all reference lines from the specified values when the X
or Y axis is discrete.
Default 0 (no offset, all reference lines are centered on discrete X or Y values)
Range -0.5 to +0.5 where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right for a vertical reference line and up
for a horizontal reference line. If the layout's axis options set
REVERSE=TRUE, then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Example 1: Specifying a Single Reference Line 663
Default X
Restriction Another plot that establishes a data range for the designed axis must
be included.
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Restriction Another plot that establishes a data range for the designed axis must
be included.
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
Reference lines are always drawn perpendicular to the axes. They are drawn from one
axis boundary to the companion boundary (X to X2 or Y to Y2). Axis offsets do not
apply to reference lines.
A REFERENCELINE statement can be used only within 2-D overlay-type layouts
(OVERLAY, OVERLAYEQUATED, or PROTOTYPE). A stand-alone plot statement
that provides a sufficient data range for determining axis extents must be included in the
layout. For example, a REFERENCELINE statement can be used with a scatter plot or a
histogram.
If a column is used to generate multiple reference lines, then the column type (numeric
or string) must agree with the type of data presented on the axis.
Examples
Example Program
Here is the SAS code for this example.
/* Create the template for the graph */
proc template;
define statgraph referenceline;
begingraph;
entrytitle "Line of Symmetry";
layout overlay / yaxisopts=(linearopts=(viewmin=0));
seriesplot x=x y=y;
referenceline x=3 /
lineattrs=(color=blue) curvelabel="X=3";
endlayout;
endgraph;
end;
run;
Example Program
Here is the SAS code for this example.
/* Define the template for the graph */
proc template;
define statgraph referenceline;
begingraph;
entrytitle "Line of Symmetry";
layout overlay / yaxisopts=(linearopts=(viewmin=0));
seriesplot x=x y=y;
referenceline y=yR / curvelabel=label
lineattrs=(color=gray pattern=dot);
endlayout;
endgraph;
end;
run;
Example Program
Here is the SAS code for this example.
/* Create the template for the graph */
proc template;
define statgraph referencelines;
begingraph;
entrytitle "Line of Symmetry";
layout overlay / yaxisopts=(linearopts=(viewmin=0));
seriesplot x=x y=y;
/* Use COLN() to specify the intercept values */
referenceline y=eval(coln(14, 5)) /
/* Use COLC() to specify a label for each reference line */
curvelabel=eval(colc("Y=14", "Y=5"))
lineattrs=(color=gray pattern=dot);
endlayout;
endgraph;
end;
run;
REGRESSIONPLOT Statement
Creates a fitted regression line or curve computed from input data.
Restriction: The REGRESSIONPLOT statement supports only models of one independent and
one dependent variable.
REGRESSIONPLOT Statement 667
Tip: Starting with the third maintenance release of SAS 9.4, subpixel rendering is enabled
by default. To disable subpixel rendering, specify SUBPIXEL=OFF in the
BEGINGRAPH statement or in an ODS GRAPHICS statement. For information
about the BEGINGRAPH statement SUBPIXEL= option, see SUBPIXEL= on page
33.For information about the ODS GRAPHICS statement SUBPIXEL= option, see
“ODS GRAPHICS Statement” in SAS ODS Graphics: Procedures Guide.
Syntax
REGRESSIONPLOT X=numeric-column | expression
Y=numeric-column | expression </<regression-options> <option(s)>>;
Appearance options
DATATRANSPARENCY=number
specifies the degree of the transparency of the regression line and line label.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of
the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the regression line.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
CURVELABEL="string"
specifies a label for the regression line.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the regression line labels.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the regression line label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the regression line label relative to the regression
line.
CURVELABELSPLIT=TRUE | FALSE
668 Chapter 6 • Plot Statements
specifies whether to split the regression line label at the specified split
characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the regression line label can be
split if needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the regression line label
text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the regression line label
block.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a distinct set of regression lines from just the observations that
correspond to each unique group value of the specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Required Arguments
X=numeric-column | expression
specifies the column for the X values.
Y=numeric-column | expression
specifies the column for the Y values.
Optional Arguments
CURVELABEL="string"
specifies a label for the regression line.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interactions For this option to take effect, the CURVELABEL= option must also
be used.
REGRESSIONPLOT Statement 669
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the regression line label relative to the plot area.
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
MAX
forces the line label to appear near maximum line values (typically, upper right).
MIN
forces the line label to appear near minimum line values (typically, lower left).
START
forces the line label to appear near the beginning of the regression line.
Tip This option is particularly useful when the regression line has a
spiral shape.
END
forces the line label to appear near the end of the regression line.
670 Chapter 6 • Plot Statements
Tip This option is particularly useful when the regression line has a
spiral shape.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the regression line label at the specified split characters.
When a regression line label is split, the label is split on each occurrence of the
specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the regression line label can be split if
needed. When multiple split characters are specified, each character in the list is
treated as a separate split character unless the specified characters appear
consecutively in the regression line label. In that case, all of the specified split
characters together are treated as a single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the
regression line label is split unconditionally at each occurrence of any of the
specified split characters. If the regression line label does not contain any of the
specified characters, then the label is not split.
REGRESSIONPLOT Statement 671
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the regression line label text.
TRUE
drops the split characters from the regression line label text.
FALSE
includes the split characters in the regression line label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a regression line label with the following
specifications:
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
regression line for reference.
672 Chapter 6 • Plot Statements
Default TRUE. The split characters are dropped from the regression line
label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
REGRESSIONPLOT Statement 673
DATATRANSPARENCY=number
specifies the degree of the transparency of the regression line and line label.
Default 0
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of line colors and
line patterns.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
674 Chapter 6 • Plot Statements
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
REGRESSIONPLOT Statement 675
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIPFORMAT=(Y=6.2)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Note The columns assigned to the X, Y, and GROUP (if assigned) roles are
automatically included in the data tip information.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
676 Chapter 6 • Plot Statements
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIPLABEL=(Y="Curve")
Default The column label or column name of the column assigned to the role.
Note The columns assigned to the X, Y, and GROUP (if assigned) roles are
automatically included in the data tip information.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Regression Options
ALPHA=positive-number
specifies the confidence level to compute.
Default 0.05
CLI="name"
produces confidence limits for individual predicted values for each observation. The
confidence level is set by the ALPHA= option.
Interaction name is a unique name within the template that is case sensitive and
cannot contain spaces. It must be assigned in order for the confidence
limits to be computed. To display confidence limits, you must use this
name as the required argument of a MODELBAND statement. See the
example in “Example: REGRESSIONPLOT Statement” on page
678 .
CLM="name"
produces confidence limits for a mean predicted value for each observation. The
confidence level is set by the ALPHA= option.
REGRESSIONPLOT Statement 677
Interaction name is a unique name within the template that is case sensitive and
cannot contain spaces. It must be assigned in order for the confidence
limits to be computed. To display confidence limits, you must use this
name as the required argument of a MODELBAND statement. See the
example in “Example: REGRESSIONPLOT Statement” on page
678 .
DEGREE=non-negative-integer
specifies the degree of the polynomial.
The default value, DEGREE=1, produces a linear fit, DEGREE=2 produces a
quadratic fit, DEGREE=3 produces a cubic fit, and so on.
The value of the DEGREE=d option corresponds to one of the following
TRANSREG procedure specifications for the independent variable: SPLINE(X /
DEGREE=d) or PBSPLINE(X / DEGREE=d LAMBDA=0).
Default 1
Ranges 0–174 in the first maintenance release of SAS 9.4 and earlier releases.
FREQ=numeric-column
specifies a column in the input data set that represents the frequency of occurrence of
the current observation, essentially treating the data set as if each observation
appeared n times, where n is the value of the FREQ column for the observation.
Noninteger values of the FREQ column are truncated to the largest integer less than
the FREQ value. The observation is used in the analysis only if the value of the
FREQ column is greater than or equal to 1.
MAXPOINTS=positive-integer
specifies the maximum number of predicted points generated for the regression curve
as well as any confidence limits.
Default 201
WEIGHT=numeric-column
specifies a column in the input data set that contains values to be used as a priori
weights for a regression fit. If an observation’s weight is zero, negative, or missing,
then the observation is deleted from the analysis.
Interaction Starting with the second maintenance release of SAS 9.4, when the
CLI= option is used with this option, the confidence band for individual
predicted values is displayed as a high-low chart instead of a band.
Details
The REGRESSIONPLOT statement only supports models of one independent and one
dependent variable. For more information about the fitting methodology, see the
TRANSREG procedure in the SAS/STAT user’s guide.
In addition to the regression line, the REGRESSIONPLOT statement can compute
confidence levels for the fitted line. To display the confidence levels:
1. Use the CLI= or CLM= regression option(s) to declare a name for each confidence
level.
678 Chapter 6 • Plot Statements
The following graph was generated by the “Example Program” on page 678:
Example Program
proc template;
define statgraph regressionplot;
begingraph;
entrytitle "Regression Fit Plot";
layout overlay;
scatterplot x=weight y=mpg_highway /
datatransparency=0.7;
regressionplot x=weight y=mpg_highway /
name="fitline"
alpha=0.05 legendlabel="Regression Fit";
discretelegend "fitline";
endlayout;
endgraph;
end;
run;
SCATTERPLOT Statement
Creates a scatter plot of input data.
Syntax
SCATTERPLOT X=column | expression
Y=column | expression </option(s)>;
Appearance options
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group
clusters as a fraction of the minimum interval between adjacent data values.
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used with the COLORRESPONSE= or
MARKERCOLORGRADIENT= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
starting with the second maintenance release of SAS 9.4, specifies the
column or range attribute map variable to use to determine the marker colors.
CONTRIBUTEOFFSETS=ALL | NONE | (axis-offset-list)
specifies whether space requirements for this plot contribute to the
calculation of the axis offsets.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the plot markers.
DATATRANSPARENCY=number
specifies the degree of the transparency of the markers, data labels, and error
bars, when displayed.
DISCRETEMARKERSIZE=number
specifies the size of a marker as a fraction of the tick spacing.
ERRORBARATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the error bars that are associated with the data
points.
ERRORBARCAPSHAPE=SERIF | NONE
specifies whether the error bars have a serif cap.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
INDEX=positive-integer-column | expression
specifies indices for mapping marker attributes (color and symbol) to one of
the GraphData1–GraphDataN style elements.
LABELSTRIP=TRUE | FALSE
specifies whether leading and trailing blanks are stripped from marker
characters or data labels that have a fixed position before they are displayed
in the plot.
MARKERATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the attributes of the data markers.
MARKERCHARACTER=column | expression
680 Chapter 6 • Plot Statements
specifies a column that defines strings that are to be used instead of marker
symbols.
MARKERCHARACTERATTRS=style-element | style-element (text-options) | (text-
options)
specifies the color and font attributes of the marker character specified on the
MARKERCHARACTER= option.
MARKERCHARACTERPOSITION=CENTER | TOP | BOTTOM | LEFT | RIGHT |
TOPLEFT | TOPRIGHT | BOTTOMLEFT | BOTTOMRIGHT
specifies the justification of the marker characters.
MARKERCOLORGRADIENT=numeric-column | range-attr-var | expression
in the first maintenance release of SAS 9.4 and earlier releases, specifies the
column or range attribute map variable that is used to determine the marker
colors.
MARKERFILLATTRS=style-element | (fill-options)
specifies the appearance of the filled markers.
MARKEROUTLINEATTRS=style-element | (line-options)
specifies the appearance of the marker outlines.
MARKERSIZEMAX=dimension
for the first maintenance release of SAS 9.4 and for earlier releases, specifies
a drawing size for the largest marker when the marker size represents
response values.
MARKERSIZEMIN=dimension
for the first maintenance release of SAS 9.4 and for earlier releases, specifies
a drawing size for the smallest marker when the marker size represents
response values.
MARKERSIZERESPONSE=numeric-column | expression
for the first maintenance release of SAS 9.4 and for earlier releases, specifies
a column that is used to map the drawing size of the markers.
OUTLINEDMARKERCHARACTERS=TRUE | FALSE
specifies whether the characters that are used as marker symbols are outlined
in order to enhance their appearance in the graph.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
SIZEMAX=dimension
starting with the second maintenance release of SAS 9.4, specifies a drawing
size for the largest marker when the marker size represents response values.
SIZEMIN=dimension
starting with the second maintenance release of SAS 9.4, specifies a drawing
size for the smallest marker when the marker size represents response values.
SIZERESPONSE=numeric-column | expression
starting with the second maintenance release of SAS 9.4, specifies a column
that is used to map the drawing size of the markers.
SUBPIXEL=AUTO | OFF
specifies whether subpixel rendering is used for image output when the
scatter plot is rendered.
USEDISCRETESIZE=TRUE | FALSE
specifies that the marker size should be based on fraction of the midpoint
spacing that is set by the DISCRETEMARKERSIZE= option.
XERRORLOWER=numeric-column | expression
specifies values for the lower endpoints on the X error bars. The error bars
are drawn from the markers to the endpoints.
SCATTERPLOT Statement 681
XERRORUPPER=numeric-column | expression
specifies values for the upper endpoints on the X error bars.
YERRORLOWER=numeric-column | expression
specifies values for the lower endpoints on the Y error bars.
YERRORUPPER=numeric-column | expression
specifies values for the upper endpoints on the Y error bars.
Axes options
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when
GROUPDISPLAY=CLUSTER.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
DATALABEL=column | expression
specifies a column for marker labels. The label positions are adjusted to
prevent them from overlapping.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
DATALABELPOSITION=AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT |
CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the markers.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
682 Chapter 6 • Plot Statements
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all markers from discrete X values, or discrete Y
values, or both.
GROUP=column | discrete-attr-var | expression
creates a separate marker type for each unique group value of the specified
column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how marker groups are positioned for the coordinate pairs.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
JITTER=NONE | AUTO
specifies whether to jitter data markers.
JITTEROPTS=(jitter-options)
specifies options for managing jittering.
ODS options
URL=string-column
specifies an HTML page to display when a point is selected.
Statistics options
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation
that is read.
Required Arguments
X=column | expression
specifies the column for the X values.
Y=column | expression
specifies the column for the Y values.
Optional Arguments
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used with the COLORRESPONSE= or
MARKERCOLORGRADIENT= option.
style-element
specifies the name of a style element. The style element should contain these
style attributes:
SCATTERPLOT Statement 683
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= or
MARKERCOLORGRADIENT= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= or
MARKERCOLORGRADIENT= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= or
MARKERCOLORGRADIENT= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Starting with the second maintenance release of SAS 9.4, when this
option is in effect and error bars are displayed, the error bars derive
their color from the markers. To set a fixed color for the error bars,
use the ERRORBARATTRS= option.
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when GROUPDISPLAY=CLUSTER.
SCATTERPLOT Statement 685
AUTO uses the discrete axis for clustering groups when only one axis is
discrete. Uses the X axis for clustering if both axes are discrete or
interval.
X|Y uses the X or Y axis for clustering groups.
Default AUTO
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group clusters as a
fraction of the minimum interval between adjacent data values.
Default 0.85
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Interactions For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
strings that appear at the ends of the axes. The requested offset is based on the
longest string. If the label or marker character lengths vary significantly, the result is
wasted space when the shorter strings appear near the ends of the axes. In that case,
you can use the CONTRIBUTEOFFSETS= option to modify or eliminate this plot’s
contribution to the offset calculations in order to reclaim that space.
ALL
the space requirements for this plot are contributed to the axis offset calculations.
NONE
the space requirements for this plot are not contributed to the axis offset
calculations.
(axis-offset-list)
a space-delimited list of specific contributions that this plot makes to the axis
offset calculations. The list is one or more of the following values, enclosed in
parentheses:
XMAX the space requirements for this plot are contributed to the X-axis
offset calculation for the maximum end.
XMIN the space requirements for this plot are contributed to the X-axis
offset calculation for the minimum end.
YMAX the space requirements for this plot are contributed to the Y-axis
offset calculation for the maximum end.
YMIN the space requirements for this plot are contributed to the Y-axis
offset calculation for the minimum end.
Default ALL
Interaction Offsets that are set in the layout axis options are always honored,
regardless of the setting on this option.
Note This option does not affect offset requests from other plots.
DATALABEL=column | expression
specifies a column for marker labels. The label positions are adjusted to prevent
them from overlapping.
Interactions If a numeric column is specified and the column has no format, then a
BEST6 format is applied.
Tip Use this option to display labels for the markers. The position of the
labels are adjusted to prevent the labels from overlapping. If you want
labels displayed instead of markers, then use the
MARKERCHARACTER= option.
Interactions For this option to take effect, the DATALABEL= option must also be
specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element
Default AUTO
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
688 Chapter 6 • Plot Statements
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels. The split
characters are specified by the DATALABELSPLITCHAR= option.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
SCATTERPLOT Statement 689
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
690 Chapter 6 • Plot Statements
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
When a data skin is applied, all marker outlines are set by the skin,
and the outline settings are ignored from the ODS style or from
MARKERATTRS= option.
DATATRANSPARENCY=number
specifies the degree of the transparency of the markers, data labels, and error bars,
when displayed.
Default 0
DISCRETEMARKERSIZE=number
specifies the size of a marker as a fraction of the tick spacing.
Default 0.5
Range 0 to 1
SCATTERPLOT Statement 691
Requirement For this option to take effect, at least one of the axes must be discrete.
Interactions If both of the axes are discrete, then the marker size is a fraction of
the smaller tick spacing.
DISCRETEOFFSET=number
specifies an amount to offset all markers from discrete X values, or discrete Y
values, or both. This feature is useful for graphing multiple response variables side
by side on a common axis. By default within an overlay-type layout, if a
SCATTERPLOT is used with other plots with a discrete axis, then the markers are
centered on the discrete X values, or discrete Y values, or both. Depending on the
data, the markers might be superimposed over other graph data. The following code
fragment shows the default positioning when a SCATTERPLOT is used with a
BOXPLOT:
layout overlay / cycleattrs=true
xaxisopts=(type=discrete);
endlayout;
To avoid superimposed plots, you can assign a different offset to each plot statement:
layout overlay / cycleattrs=true
xaxisopts=(type=discrete);
scatterplot x=age y=weight /
discreteoffset=0.2;
boxplot x=age y=weight /
discreteoffset=-0.2;
endlayout;
692 Chapter 6 • Plot Statements
Default 0 (no offset, all markers are centered on the discrete X values, or
discrete Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right on discrete X values and up on
discrete Y values. If the layout’s axis options set REVERSE=TRUE,
then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Interaction For this option to take effect, error bars must be displayed by the
XERRORLOWER= , XERRORUPPER= , YERRORLOWER= , or
YERRORUPPER= options.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
ERRORBARCAPSHAPE=SERIF | NONE
specifies whether the error bars have a serif cap.
SCATTERPLOT Statement 693
Defaults SERIF in the first maintenance release of SAS 9.4 and earlier releases.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
TRUE
draws filled markers (marker symbols with the suffix FILLED) using both fill
and an outline. When this option is TRUE, the fill color and outline color for
filled markers are determined in the following ways:
• If the GROUP= option is specified, then by default, the fill color is derived
from the GraphData1–GraphDataN style elements Color attribute, and the
marker outlined color is derived from the GraphData1–GraphDataN style
elements ContrastColor attribute.
• If the GROUP= option is not specified, then by default, the fill color is
derived from the GraphDataDefault style elements Color attribute, and the
marker outlined color is derived from the GraphOutline style elements
ContrastColor attribute.
• If the COLORRESPONSE= MARKERCOLORGRADIENT= option is
specified, then the marker fill is drawn by using the mapped color that is
computed from the value of the COLORRESPONSE= or
MARKERCOLORGRADIENT= option for that observation. The marker
outline is drawn by using the MARKEROUTLINEATTRS= specification.
FALSE
draws the markers using fill or an outline, but not both.
Default FALSE
Tip To specify the marker fill and outline colors for a non-grouped plot, set this
option to TRUE, and then use the MARKERFILLATTRS= and
MARKEROUTLINEATTRS= options to specify the colors.
“boolean ” on page 1339 for other Boolean values that you can use.
694 Chapter 6 • Plot Statements
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation that is
read.
Restriction If the value of the numeric-column is missing or is less than 1, then the
observation is not used in the analysis. If the value is not an integer,
then only the integer portion is used.
Note If n is the value of the numeric column for a given observation, then
that observation is used n times for the purposes of any statistical
computation.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of markers and
colors.
Tip The representations that are used to identify the groups can be
overridden. For example, each distinct group value is represented by a
different marker symbol, but the
MARKERATTRS=(SYMBOL=marker) option could be used to
assign the same symbol to all of the plot’s marker symbols, letting
marker color indicate group values. Likewise,
MARKERATTRS=(COLOR=color) could be used to assign the same
color to all markers, letting marker symbol indicate group values.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how marker groups are positioned for the coordinate pairs.
OVERLAY
draws markers for a given group value at the exact coordinate. Depending on the
data, markers at a given coordinate might overlap.
CLUSTER
draws markers for a given group value adjacent to each other.
Default OVERLAY
Tip Use the CLUSTERWIDTH= option to control the width of the clusters
when CLUSTER is in effect.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping marker attributes (color and symbol) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interactions For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
SCATTERPLOT Statement 697
JITTER=NONE | AUTO
specifies whether to jitter data markers.
NONE
does not offset the data markers.
AUTO
the system determines the best way to display the data markers, based on the
settings specified by the JITTEROPTS= option.
The following figures show a side-by-side comparison of a BOXPLOT and
SCATTERPLOT in which the JITTER=NONE and JITTER=AUTO options are
specified in the SCATTERPLOT statements. The first figure shows the case in which
the Y axis is linear and the X axis is discrete.
In this case, when jittering is disabled (JITTER=NONE), markers that represent the
same Y value are overlaid, which results in some markers being obscured. When
jittering is enabled (JITTER=AUTO), one-dimensional systematic jittering occurs
along the X axis. The markers that represent approximately the same Y value are
offset along the X axis from the midpoint of that value in order to make all of the
markers visible.
The next figure shows the case in which both axes are linear.
698 Chapter 6 • Plot Statements
In this case, when jittering is disabled (JITTER=NONE), markers that represent the
same X and Y bin value are overlaid as in the previous case, which results in some
markers being obscured. However, unlike the previous case, when jittering is enabled
(JITTER=AUTO), two-dimensional random jittering occurs along the X and the Y
axes. The markers are offset randomly along both the X and Y axes in order to make
all of the markers visible.
Default NONE
If this option is set to AUTO and both axes are discrete, then one-
dimensional systematic jittering occurs along the X axis.
Notes Jittering changes the default axis offsets, but it does not change the
axis data range.
JITTEROPTS=(jitter-options)
specifies options for managing jittering. The jitter options can be one or more of the
following values, separated by a space:
AXIS=AUTO | X | Y | BOTH
specifies the axis to use for jittering the data markers.
AUTO
the system determines the axis, based on the following criteria:
• If the X axis is discrete, then one-dimensional systematic jittering is
applied along the X axis.
• If the Y axis is discrete and the X axis is interval, then one-dimensional
systematic jittering is applied along the Y axis.
• If the X and Y axes are interval, then random jittering is applied along
both the X and Y axes.
X
jittering is on the X axis. If the X axis is discrete, then 1-dimensional
systematic jittering is applied. Otherwise, 1-dimensional random jittering is
applied.
Note If both the X and Y axes are discrete, then specifying BOTH is
equivalent to specifying X.
SCATTERPLOT Statement 699
Y
jittering is applied on the Y axis. If the Y axis is discrete, then 1-dimensional
systematic jittering is applied. Otherwise, 1-dimensional random jittering is
applied.
BOTH
specifies that random jittering is applied on both the X and Y axes. This
option applies only when both the X and Y axes are interval.
Default AUTO
WIDTH=positive-number
specifies the width of the jittering space as a fraction of either the midpoint
spacing or of the minimal interval width.
Note For a discrete axis, this option has effect only when the markers
cannot be clustered side-by-side without overlapping. When WIDTH=
is set to a value that is sufficient to eliminate marker overlap in that
case, increasing the value further has no effect.
LABELSTRIP=TRUE | FALSE
specifies whether leading and trailing blanks are stripped from marker characters or
data labels that have a fixed position before they are displayed in the plot. The
MARKERCHARACTER= option specifies the column that provides the marker
strings that are to be used in place of marker symbols.
Default FALSE
Tip Stripping the blanks from the numeric value strings helps center each
string relative to its data point. Stripping is useful when you want to
overlay the data values near or inside the markers for a plot.
See “boolean ” on page 1339 for other Boolean values that you can use.
700 Chapter 6 • Plot Statements
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The Y-column label. If a label is not defined, then the Y-column name
is used.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
MARKERCHARACTER=column | expression
specifies a column that defines strings that are to be used instead of marker symbols.
SCATTERPLOT Statement 701
Each string is centered horizontally and vertically at the data point. The data point
positions are not adjusted to prevent text overlap.
Note If a numeric column is used, then its values are converted to strings
using the format associated with the column or BEST6 if no format is
defined.
You can use the LABELSTRIP= option to strip the leading and
trailing blanks from numeric value strings in order to center each
string on its data point.
When the GROUP= option is also specified, each distinct group value
might be represented by a different color (depending on the ODS style
setting or the setting on the INDEX= option). The marker character
that is associated with the group is assigned the group color.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Note: The red dots represent the center in each case for reference.
Default CENTER
Tip You can use the LABELSTRIP= option to strip the leading and trailing
blanks from value strings in order to properly justify each string on its
data point.
Note Starting with the second maintenance release of SAS 9.4, if you use the
MARKERCOLORGRADIENT= option, then be aware that the TIP=,
TIPFORMAT=, and TIPLABEL= options recognize the
MARKERCOLORGRADIENT role and not the COLORRESPONSE role.
MARKERFILLATTRS=style-element | (fill-options)
specifies the appearance of the filled markers.
MARKEROUTLINEATTRS=style-element | (line-options)
specifies the appearance of the marker outlines.
Interaction This option is ignored when a data skin is applied by the current style
or by the DATASKIN= option. In the latter case, the outline is set by
the data skin.
MARKERSIZEMAX=dimension
for the first maintenance release of SAS 9.4 and for earlier releases, specifies a
drawing size for the largest marker when the marker size represents response values.
704 Chapter 6 • Plot Statements
Note: Starting with the second maintenance release of SAS 9.4, the SIZEMAX=
option replaces the MARKERSIZEMAX= option. The syntax and functionality
are the same. The MARKERSIZEMAX= option is still honored, but the
SIZEMAX= option is preferred.
MARKERSIZEMIN=dimension
for the first maintenance release of SAS 9.4 and for earlier releases, specifies a
drawing size for the smallest marker when the marker size represents response
values.
Note: Starting with the second maintenance release of SAS 9.4, the SIZEMIN=
option replaces the MARKERSIZEMIN= option. The syntax and functionality
are the same. The MARKERSIZEMIN= option is still honored, but the
SIZEMIN= option is preferred.
MARKERSIZERESPONSE=numeric-column | expression
for the first maintenance release of SAS 9.4 and for earlier releases, specifies a
column that is used to map the drawing size of the markers.
Note: Starting with the second maintenance release of SAS 9.4, the
SIZERESPONSE= option replaces the MARKERSIZERESPONSE= option. The
syntax and functionality are the same. The MARKERSIZERESPONSE= option
is still honored, but the SIZERESPONSE= option is preferred.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
OUTLINEDMARKERCHARACTERS=TRUE | FALSE
specifies whether the characters that are used as marker symbols are outlined in order
to enhance their appearance in the graph.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
Note: This feature is deprecated starting with the second maintenance release of
SAS 9.4. The OUTLINEDMARKERCHARACTERS= option is still honored,
but the TEXTPLOT statement is now the preferred method of creating a scatter
plot using text markers.
SCATTERPLOT Statement 705
The following figure shows the marker characters M and F displayed when
OUTLINEDMARKERCHARACTERS=FALSE (default) and when
OUTLINEDMARKERCHARACTERS=TRUE.
Default FALSE
Restriction Outline marker characters are not supported in vector graphics output.
When this option is set and vector graphics output is requested, the
graph is converted into an image instead. A note indicating the
conversion is written to the SAS log. To restore the vector graphics
output in that case, remove the
OUTLINEDMARKERCHARACTERS= option from the
SCATTERPLOT statement.
See “boolean ” on page 1339 for other Boolean values that you can use.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
706 Chapter 6 • Plot Statements
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, DATALABEL, MARKERCHARACTER,
COLORRESPONSE or MARKERCOLORGRADIENT,
XERRORLOWER, XERRORUPPER, YERRORLOWER,
YERRORUPPER, GROUP, and INDEX.
SIZEMAX=dimension
starting with the second maintenance release of SAS 9.4, specifies a drawing size for
the largest marker when the marker size represents response values.
Note: Starting with the second maintenance release of SAS 9.4, the SIZEMAX=
option replaces the MARKERSIZEMAX= option. The syntax and functionality
are the same. The MARKERSIZEMAX= option is still honored, but the
SIZEMAX= option is preferred.
Tip If you specify this size as a percent, then the specified value is
interpreted as a percent of the graph’s height. You can control the
height by using the DESIGNHEIGHT= option of the BEGINGRAPH
statement, or by using the HEIGHT= option of the ODS GRAPHICS
statement. For a standard 640px by 480px output size, a percentage
value of 4.5% sets a maximum size of about 21px, which is
approximately the same marker size that would result from this
option’s typical default setting.
SIZEMIN=dimension
starting with the second maintenance release of SAS 9.4, specifies a drawing size for
the smallest marker when the marker size represents response values.
SCATTERPLOT Statement 707
Note: Starting with the second maintenance release of SAS 9.4, the SIZEMIN=
option replaces the MARKERSIZEMIN= option. The syntax and functionality
are the same. The MARKERSIZEMIN= option is still honored, but the
SIZEMIN= option is preferred.
Interactions For this option to take effect, you must also specify the
SIZERESPONSE= or MARKERSIZERESPONSE= option.
Tip If you specify this size as a percent, then the specified value is
interpreted as a percent of the graph’s height. You can control the
height by using the DESIGNHEIGHT= option of the BEGINGRAPH
statement, or by using the HEIGHT= option of the ODS GRAPHICS
statement. For a standard 640px by 480px output size, a percentage
value of 1.5% sets a minimum size of about 7px, which is
approximately the same marker size that would result from this
option’s typical default setting.
SIZERESPONSE=numeric-column | expression
starting with the second maintenance release of SAS 9.4, specifies a column that is
used to map the drawing size of the markers.
Note: Starting with the second maintenance release of SAS 9.4, the
SIZERESPONSE= option replaces the MARKERSIZERESPONSE= option. The
syntax and functionality are the same. The MARKERSIZERESPONSE= option
is still honored, but the SIZERESPONSE= option is preferred.
By default, the minimum and maximum values of this column establish a range over
which the marker sizes vary in linear proportion. The actual drawing size of the
smallest marker and the largest marker is set automatically.
Tip You can adjust the smallest and largest marker size with the
SIZEMIN= and SIZEMAX= options, or with the
MARKERSIZEMIN= and MARKERSIZEMAX= options.
SUBPIXEL=AUTO | OFF
specifies whether subpixel rendering is used for image output when the scatter plot is
rendered.
708 Chapter 6 • Plot Statements
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
AUTO
The system sets subpixel rendering OFF for this scatter plot, unless
SUBPIXEL=ON is specified in the BEGINGRAPH statement or in an ODS
GRAPHICS statement. In that case, subpixel rendering is ON for this scatter plot.
OFF
disables subpixel rendering for image output only for this scatter plot.
Default AUTO
Requirement Anti-aliasing must be enabled for this option to have any effect.
Notes This option affects subpixel rendering only for this plot. Subpixel
rendering for other plots in the graph is not affected.
When subpixel rendering is used for the graph but is turned OFF for
this scatter plot, some elements in the scatter plot such as the plot
markers might be offset a half pixel, which can make them appear
blurry in the image output.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the scatter
points. If this option is used, then it replaces all of the information that is displayed
by default. Roles for columns that do not contribute to the scatter plot can be
specified along with roles that do.
(role-list)
an ordered, space-separated list of unique SCATTERPLOT and user-defined
roles. SCATTERPLOT roles include X , Y , DATALABEL ,
MARKERCHARACTER , COLORRESPONSE or
MARKERCOLORGRADIENT , XERRORLOWER , XERRORUPPER ,
YERRORLOWER , YERRORUPPER , GROUP , and INDEX .
User-defined roles are defined with the ROLENAME= option.
SCATTERPLOT Statement 709
Requirement If you use the COLORRESPONSE= option, you must specify the
COLORRESPONSE role for the color values. Likewise, if you
use the MARKERCOLORGRADIENT= option, you must
specify the MARKERCOLORGRADIENT role for the color
values. Although they are functionally the same, you cannot mix
the COLORRESPONSE= and MARKERCOLORGRADIENT=
options, and their corresponding roles.
Example The following example displays data tips for the columns
assigned to the roles X, XERRORUPPER, and
XERRORLOWER, as well as the column Obs, which is not
assigned to any pre-defined SCATTERPLOT role. The Obs
column must first be assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X XERRORUPPER XERRORLOWER)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X , Y , DATALABEL ,
MARKERCHARACTER , COLORRESPONSE or
MARKERCOLORGRADIENT on page 702 , XERRORLOWER ,
XERRORUPPER , YERRORLOWER , YERRORUPPER , FREQ ,
and GROUP .
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
710 Chapter 6 • Plot Statements
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a point is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
marker that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Tips The URL value can be blank for some X and Y pairs, meaning that
no action is taken when the corresponding point is selected.
The URL value can be the same for any X and Y pairs. In that case,
the same action is taken when the points for those X and Y pairs are
selected.
USEDISCRETESIZE=TRUE | FALSE
specifies that the marker size should be based on fraction of the midpoint spacing
that is set by the DISCRETEMARKERSIZE= option.
Default FALSE
See DISCRETEMARKERSIZE=
SCATTERPLOT Statement 711
“boolean ” on page 1339 for other Boolean values that you can use.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
XERRORLOWER=numeric-column | expression
specifies values for the lower endpoints on the X error bars. The error bars are drawn
from the markers to the endpoints.
If markers are displayed in the plot, then the markers overlay the error bars.
Large filled markers can obscure short error bars. To enable the error bars
to show through the markers in that case, you can use the
MARKERATTRS= option to specify a degree of transparency for the filled
markers.
XERRORUPPER=numeric-column | expression
specifies values for the upper endpoints on the X error bars. The error bars are drawn
from the markers to the endpoints.
If markers are displayed in the plot, then the markers overlay the error bars.
Large filled markers can obscure short error bars. To enable the error bars
to show through the markers in that case, you can use the
MARKERATTRS= option to specify a degree of transparency for the filled
markers.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YERRORLOWER=numeric-column | expression
specifies values for the lower endpoints on the Y error bars. The error bars are drawn
from the markers to the endpoints.
If markers are displayed in the plot, then the markers overlay the error bars.
Large filled markers can obscure short error bars. To enable the error bars
to show through the markers in that case, you can use the
MARKERATTRS= option to specify a degree of transparency for the filled
markers.
YERRORUPPER=numeric-column | expression
specifies values for the upper endpoints on the Y error bars. The error bars are drawn
from the markers to the endpoints.
If markers are displayed in the plot, then the markers overlay the error bars.
Large filled markers can obscure short error bars. To enable the error bars
to show through the markers in that case, you can use the
MARKERATTRS= option to specify a degree of transparency for the filled
markers.
Examples
Example Program
proc template;
define statgraph scatterplot;
begingraph;
entrytitle "Height and Weight by Sex";
layout overlay;
scatterplot x=height y=weight /
group=sex name="scatter" datalabel=name;
discretelegend "scatter";
endlayout;
endgraph;
end;
run;
Example Program
/* Summarize SASHELP.CARS for mean MPG_HIGHWAY */
proc summary data=sashelp.cars nway;
class type;
var mpg_highway;
output out=mileage mean=mean;
run;
/* Sort by mileage */
proc sort data=mileage;
by mean;
run;
Details
This example creates a scatter plot of average highway mileage by vehicle type. The
SUMMARY procedure is used to compute the mean highway mileage for each vehicle
type. The SORT procedure is then used to sort the data by mileage in ascending order.
Normally, when you plot discrete values using the SCATTERPLOT statement, the
values at each end of the category axis are offset to accommodate the width of the largest
marker. When a small symbol is used, this can result in the minimum and maximum
symbols being placed very close to the edge of the axis. You can use the OFFSETMAX=
and OFFSETMIN= axis options to specify offsets for each end of the category axis.
However, you have to determine an appropriate offset value.
In this example, the GROUP= and GROUPDISPLAY= options are used to create offsets
automatically. The GROUP= option creates a group for each category value. The
GROUPDISPLAY=CLUSTER option displays the group values in a cluster and
automatically offsets the end values by one-half of the available midpoint spacing, which
is similar to the offsets that are used in bar charts. To restore the default colors and
symbols that are used for ungrouped data, the MARKERATTRS= option is used to set
the marker attributes to the graphDataDefault style element.
SCATTERPLOTMATRIX Statement
Creates a matrix of all pairwise scatter plots of the specified columns.
Restriction: The SCATTERPLOTMATRIX statement cannot appear within a LAYOUT OVERLAY,
LAYOUT OVERLAY3D, or LAYOUT OVERLAYEQUATED block. It is typically placed
in a LAYOUT GRIDDED block.
Syntax
SCATTERPLOTMATRIX numeric-column-list </option(s)>;
Appearance options
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used with the COLORRESPONSE= or
MARKERCOLORGRADIENT= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
starting with the second maintenance release of SAS 9.4, specifies the
column or range attribute map variable to use to determine the marker colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the plot markers.
DATATRANSPARENCY=number
specifies the degree of the transparency of the markers and data labels.
DIAGONAL=LABEL | (graph-list)
specifies whether the diagonal cells of the matrix are labeled with the labels
(names) of the required arguments, or with a plot.
INDEX=positive-integer-column | expression
716 Chapter 6 • Plot Statements
specifies indices for mapping marker attributes (color and symbol) to one of
the GraphData1–GraphDataN style elements.
LABELSTRIP=TRUE | FALSE
specifies whether leading and trailing blanks are stripped from marker
characters or data labels that have a fixed position before they are displayed
in the plot.
MARKERATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the attributes of the data markers.
MARKERCHARACTER=column | expression
specifies a column that defines strings that are to be used instead of marker
symbols.
MARKERCHARACTERATTRS=style-element | style-element (text-options) | (text-
options)
specifies the color and font attributes of the marker character specified on the
MARKERCHARACTER= option.
MARKERCHARACTERPOSITION=CENTER | TOP | BOTTOM | LEFT | RIGHT |
TOPLEFT | TOPRIGHT | BOTTOMLEFT | BOTTOMRIGHT
specifies the justification of the marker characters.
MARKERCOLORGRADIENT=numeric-column | range-attr-var | expression
in the first maintenance release of SAS 9.4 and earlier releases, specifies the
column or range attribute map variable that is used to determine the marker
colors.
MATRIXTYPE=FULL | UPPERTRIANGLE | LOWERTRIANGLE
specifies whether to display the full matrix, or just the upper or lower triangle
of the matrix.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
START=TOPLEFT | BOTTOMLEFT
specifies whether to start populating the matrix from the top left or bottom
left corner.
SUBPIXEL=AUTO | OFF
specifies whether subpixel rendering is used for image output when the
scatter plots are rendered.
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
WALLDISPLAY=STANDARD | ALL | NONE | (display-options)
specifies whether the plot’s wall and wall outline are displayed.
Confidence options
ELLIPSE=(<ellipse-suboptions>)
specifies that a confidence ellipse be included in each cell containing a scatter
plot.
Inset options
INSET=(info-options)
specifies what information is displayed in an inset.
INSETOPTS=(appearance-options)
specifies location and appearance options for the inset information.
Label options
DATALABEL=column
specifies a column for marker labels.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
DATALABELPOSITION=AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT |
CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the markers.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a distinct set of scatter markers, error bars, and data labels for each
unique group value of the specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Statistics options
CORROPTS=(correlation-options)
specifies options for computing measures of association between pairs of
columns.
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation
that is read.
ROWVARS=(numeric-column-list)
specifies a secondary list of numeric columns to be paired with the required
column list that is specified by the SCATTERPLOTMATRIX statement.
718 Chapter 6 • Plot Statements
Required Argument
numeric-column-list
specifies a list of numeric columns to plot.
Note The default width is 640px, and the default height is 480px. The
graph size is not automatically adjusted to accommodate a large
number of columns.
Tips To change the graph size for the current template, use the
DESIGNHEIGHT= and DESIGNWIDTH= options in the
BEGINGRAPH statement.
To change the graph size for all templates in the current SAS
session, use the HEIGHT= and WIDTH= options in the ODS
GRAPHICS statement. Size settings in the ODS GRAPHICS
statement override size settings in the BEGINGRAPH statement.
You can also limit the number of columns in the matrix (perhaps to
seven in each dimension, for example) so that the resulting graphs
are not too small to be useful.
Optional Arguments
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used with the COLORRESPONSE= or
MARKERCOLORGRADIENT= option.
style-element
specifies the name of a style element. The style element should contain these
style attributes:
CORROPTS=(correlation-options)
specifies options for computing measures of association between pairs of columns.
The following correlation-options are available:
EXCLNPWGT=TRUE | FALSE
specifies whether observations with non-positive weight values are excluded
(TRUE) from the analysis.
Default FALSE (observations with negative weights are treated like those with
zero weights and counted in the total number of observations).
See “boolean ” on page 1339 for other Boolean values that you can use.
NOMISS=TRUE | FALSE
specifies whether observations with missing values are excluded (TRUE) from
the analysis.
Default FALSE (correlation statistics are computed using all of the nonmissing
pairs of columns).
See “boolean ” on page 1339 for other Boolean values that you can use.
WEIGHT=numeric-column
specifies a weighting column to use in the calculation of Pearson weighted
product-moment correlation.
The observations with missing weights are excluded from the analysis. If you use
this WEIGHT correlation option, then consider which value of the
VARDEF=correlation option is appropriate.
SCATTERPLOTMATRIX Statement 721
Default For observations with non-positive weights, the weights are set to zero
and the observations are included in the analysis.
DF Degrees of Freedom (N – 1)
N number of observations
WDF sum of weights minus 1 (WEIGHT – 1)
WEIGHT sum of weights
Default DF
Interaction This option has effect only when the INSET= option is also used.
DATALABEL=column
specifies a column for marker labels. The label positions are adjusted to prevent the
labels from overlapping.
Interactions If a numeric column is specified and the column has no format, then a
BEST6 format is applied.
Note The position of the labels are adjusted to prevent the labels from
overlapping.
Interactions For this option to take effect, the DATALABEL= option must also be
specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Default AUTO
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
When a data skin is applied, all marker outlines are set by the skin,
and the outline settings from the ODS style or from the
MARKERATTRS= option are ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the markers and data labels.
Default 0
DIAGONAL=LABEL | (graph-list)
specifies whether the diagonal cells of the matrix are labeled with the labels (names)
of the required arguments, or with a plot. The plot for each diagonal cell consists of
an overlay combination of a histogram, normal, or kernel curves.
The graph-list is a space-separated list of one or more of the following:
Default LABEL. Column labels (or names) are displayed in the diagonal
cells.
Requirement When specifying multiple graphs in the graph-list, you must separate
the values with a space. For example, the following specification
requests both a histogram and a normal density curve in each
diagonal cell:
DIAGONAL=(HISTOGRAM NORMAL)
Note When this option is specified, the labels are drawn around the outside
of the matrix, and the matrix axes are dropped.
726 Chapter 6 • Plot Statements
ELLIPSE=(<ellipse-suboptions>)
specifies that a confidence ellipse be included in each cell containing a scatter plot.
The ellipse is always drawn behind the scatter points. The ellipse-suboptions include
the following:
ALPHA=positive-number
specifies the confidence level to compute for each ellipse.
Default 0.05
CLIP=TRUE | FALSE
specifies whether the X and Y values for the ellipse are considered when
determining the data ranges for the axes.
TRUE
the X and Y values for the ellipses are ignored when the axis ranges are
determined. Clipping occurs if the X and Y values for an ellipse exceed the
axis range.
FALSE
the X and Y values for the ellipses contribute to the data range for each axis.
If necessary, each axis is extended in order to display the entire ellipse.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
TYPE=MEAN | PREDICTED
specifies the type of ellipse.
Default MEAN
See “ELLIPSE Statement” on page 422 for statistical details about how the
ellipse is calculated.
Interactions The ellipse might be clipped by the data range for the scatter points.
The ellipse is always computed on all the data for the current pair of X
and Y columns (including the FREQ= column, if used). The GROUP=
option is not considered when computed the ellipse.
Tip The display properties of each ellipse are controlled by the style
elements. The GraphDataDefault element controls the outline and fill
properties, and the GraphEllipse element controls whether the outline,
fill, or both are shown.
SCATTERPLOTMATRIX Statement 727
FREQ=numeric-column | expression
specifies a numeric column that provides frequencies for each observation that is
read.
Restriction If the value of the numeric-column is missing or is less than 1, then the
observation is not used in the analysis. If the value is not an integer,
then only the integer portion is used.
Note If n is the value of the numeric column for a given observation, then
that observation is used n times for the purposes of any statistical
computation.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of markers and
colors.
Tip The representations that are used to identify the groups can be
overridden. For example, each distinct group value is represented by a
different marker symbol, but the
MARKERATTRS=(SYMBOL=marker) option could be used to
assign the same symbol to all of the plot’s marker symbols, letting
marker color indicate group values. Likewise,
MARKERATTRS=(COLOR=color) could be used to assign the same
color to all markers, letting marker symbol indicate group values.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
728 Chapter 6 • Plot Statements
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping marker attributes (color and symbol) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interactions For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
INSET=(info-options)
specifies what information is displayed in an inset. Insets appear in all cells of the
matrix except the diagonal and are displayed as a small table of name-value pairs.
The following info-options are available:
NOBS
displays the total number of observations where both the X and Y columns have
nonmissing values. If the FREQ= option is used, then this number is adjusted
accordingly. The value of NOBS can be further adjusted by the use of the
SCATTERPLOTMATRIX Statement 729
See PROC CORR in the documentation for Base SAS for statistical and
computational details of these options.
N 150
r 0.96287
p(r) <.0001
In this example, NOBS is represented by N, PEARSON is represented by
r, and PEARSONPVAL is represented by p(r).
INSETOPTS=(appearance-options)
specifies location and appearance options for the inset information. The appearance
options can be any one or more of the settings that follow. The options must be
enclosed in parentheses, and each option is specified as a name=value pair.
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the inset is automatically aligned within the layout.
NONE
does not automatically align the inset. The inset’s position is therefore set by
the HALIGN= and VALIGN=appearance-options.
AUTO
attempts to center the inset in the area that is farthest from any surrounding
markers. Data cells might have different inset placements.
(location-list)
restricts the inset’s possible locations to those locations in the specified
location-list, and uses the location-list position that least collides with the
data cell’s other graphics features. The location-list is space-separated and
can contain any of these locations: TOPLEFT TOP TOPRIGHT LEFT
CENTER RIGHT BOTTOMLEFT BOTTOM BOTTOMRIGHT. Example:
AUTOALIGN=(TOPRIGHT TOPLEFT)
Default NONE
BACKGROUNDCOLOR=style-reference | color
specifies the color of the inset background
730 Chapter 6 • Plot Statements
style-reference
specifies a style reference in the form style-element : style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the inset.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Default LEFT
Interaction This option is ignored when AUTOALIGN= is not NONE and the
parent layout is an overlay-type layout.
OPAQUE=TRUE | FALSE
specifies whether the inset background is opaque (TRUE) or transparent
(FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TITLE="string"
specifies a title for the inset. The title is added at the top of the inset and spans
the full inset width.
Note Space is not reserved for the title when this option is not set
Tip Text properties for the title string can be set with TITLEATTRS=.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default TOP
Interaction This option is ignored when AUTOALIGN= is not NONE and the
parent layout is an overlay-type layout.
LABELSTRIP=TRUE | FALSE
specifies whether leading and trailing blanks are stripped from marker characters or
data labels that have a fixed position before they are displayed in the plot. The
MARKERCHARACTER= option specifies the column that provides the marker
strings that are to be used in place of marker symbols.
Default FALSE
Tip Stripping the blanks from the numeric value strings helps center each
string relative to its data point. Stripping is useful when you want to
overlay the data values near or inside the markers for a plot.
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
MARKERCHARACTER=column | expression
specifies a column that defines strings that are to be used instead of marker symbols.
Each string is centered horizontally and vertically at the data point. The data point
positions are not adjusted to prevent text overlap.
Note If a numeric column is used, then its values are converted to strings
using the format associated with the column or BEST6 if no format is
defined.
You can use the LABELSTRIP= option to strip the leading and
trailing blanks from numeric value strings in order to center each
string on its data point.
When the GROUP= option is also specified, each distinct group value
might be represented by a different color (depending on the ODS style
setting or the setting on the INDEX= option). The marker character
that is associated with the group is assigned the group color.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Note: The red dots represent the center in each case for reference.
Default CENTER
Tip You can use the LABELSTRIP= option to strip the leading and trailing
blanks from value strings in order to properly justify each string on its
data point.
Note Starting with the second maintenance release of SAS 9.4, if you use the
MARKERCOLORGRADIENT= option, then be aware that the TIP=,
TIPFORMAT=, and TIPLABEL= options recognize the
MARKERCOLORGRADIENT role and not the COLORRESPONSE role.
The next figure shows the effect of the START=BOTTOMLEFT option on the
previous graph.
Default FULL
The START= option specifies the corner where the matrix fill begins.
SCATTERPLOTMATRIX Statement 735
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, DATALABEL, MARKERCHARACTER,
COLORRESPONSE or MARKERCOLORGRADIENT, GROUP,
and INDEX.
ROWVARS=(numeric-column-list)
specifies a secondary list of numeric columns to be paired with the required column
list that is specified by the SCATTERPLOTMATRIX statement. The labels for the
columns appear vertically on the left side of the matrix.
START=TOPLEFT | BOTTOMLEFT
specifies whether to start populating the matrix from the top left or bottom left
corner.
Default TOPLEFT
736 Chapter 6 • Plot Statements
SUBPIXEL=AUTO | OFF
specifies whether subpixel rendering is used for image output when the scatter plots
are rendered.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
AUTO
The system sets subpixel rendering OFF for this scatter-plot matrix, unless
SUBPIXEL=ON is specified in the BEGINGRAPH statement or in an ODS
GRAPHICS statement. In that case, subpixel rendering is ON for this scatter-plot
matrix.
OFF
disables subpixel rendering for image output only for the scatter plots in this
scatter-plot matrix.
Default AUTO
Restriction This option applies only to the scatter plots in the matrix. It does not
affect the confidence ellipses.
Requirement Anti-aliasing must be enabled for this option to have any effect.
Notes This option affects subpixel rendering for the scatter plots only in this
scatter-plot matrix. Subpixel rendering for other plots in the graph is
not affected.
When subpixel rendering is used for the graph but is turned OFF for
this scatter-plot matrix, some elements in the scatter plots such as the
plot markers might be offset a half pixel, which can make them
appear blurry in the image output.
To disable subpixel rendering for the scatter plots and the ellipses,
specify SUBPIXEL=OFF in the template’s BEGINGRAPH statement
or in an ODS GRAPHICS statement.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the scatter
points. If this option is used, then it replaces all of the information that is displayed
by default. Roles for columns that do not contribute to the scatter plot can be
specified along with roles that do.
(role-list)
an ordered, space-separated list of unique SCATTERPLOTMATRIX and user-
defined roles. SCATTERPLOT roles include: X, Y, GROUP, DATALABEL,
MARKERCHARACTER, and COLORRESPONSE or
MARKERCOLORGRADIENT.
User-defined roles are defined with the ROLENAME= option.
Requirement If you use the COLORRESPONSE= option, you must specify the
COLORRESPONSE role for the color values. Likewise, if you
use the MARKERCOLORGRADIENT= option, you must
specify the MARKERCOLORGRADIENT role for the color
values. Although they are functionally the same, you cannot mix
the COLORRESPONSE= and MARKERCOLORGRADIENT=
options, and their corresponding roles.
Example The following example displays data tips for the columns
assigned to the roles TIP1, TIP2, TIP3, and TIP4:
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: current X, current Y, DATALABEL,
MARKERCHARACTER, COLORGROUP or
MARKERCOLORGRADIENT, and GROUP.
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
738 Chapter 6 • Plot Statements
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
WALLCOLOR=style-reference | color
specifies the fill color of the plot wall area.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style- attribute named COLOR or CONTRASTCOLOR is used.
Default STANDARD
Tips Use the WALLCOLOR= option to control the fill color of the wall.
The appearance attributes of the wall outline are set by the GraphAxisLine
style element.
Details
By default, the SCATTERPLOTMATRIX statement produces a symmetric scatter plot
matrix. For n columns, it produces an n columns by n rows matrix of scatter plots. By
default, the columns of the matrix are in the same left-to-right order as the order of the
numeric-column-list. The rows of the matrix are in the same bottom-to-top order as the
numeric-column-list. You can reverse the direction of the diagonal by setting
START=TOPLEFT.
To produce a rectangular matrix of scatter plots, use the ROWVARS= option. Specifying
n columns in the SCATTERPLOTMATRIX statement and m columns on the
ROWVARS= option produces an n-columns by m-rows matrix of scatter plots. For
example, the following statement specifies 2 columns on SCATTERPLOTMATRIX and
3 columns on the ROWVARS= option to produce the 2-columns by 3-rows matrix:
The following graph was generated by the “Example Program” on page 740:
740 Chapter 6 • Plot Statements
Example Program
proc template;
define statgraph scatterplotmatrix;
begingraph;
entrytitle "Scatter Plot Matrix";
layout gridded;
scatterplotmatrix
sepallength sepalwidth petallength petalwidth /
group=species name="matrix";
discretelegend "matrix";
endlayout;
endgraph;
end;
run;
SERIESPLOT Statement
Displays a series of line segments that connect observations of input data.
Tip: Starting with the third maintenance release of SAS 9.4, subpixel rendering is enabled
by default. To disable subpixel rendering, specify SUBPIXEL=OFF in the
BEGINGRAPH statement or in an ODS GRAPHICS statement. For information
about the BEGINGRAPH statement SUBPIXEL= option, see SUBPIXEL= on page
33.For information about the ODS GRAPHICS statement SUBPIXEL= option, see
“ODS GRAPHICS Statement” in SAS ODS Graphics: Procedures Guide.
SERIESPLOT Statement 741
Syntax
SERIESPLOT X=column | expression
Y=column | expression </option(s)>;
Appearance options
ARROWHEADPOSITION= NONE | START | END | BOTH | column
specifies a position for arrowheads.
ARROWHEADSCALE=positive-number | numeric-column | expression
specifies an arrowhead scale factor based on the thickness of the arrow line.
ARROWHEADSHAPE= OPEN | FILLED | BARBED | column
specifies a shape for arrowheads.
BREAK=TRUE | FALSE
breaks the plot line at missing values of the X or Y column.
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group
clusters as a fraction of the minimum interval between adjacent data values.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute variable to use to map the line and
marker colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the series lines.
DATATRANSPARENCY=number
specifies the degree of the transparency of the line, markers, line label, and
data labels, when displayed.
DISPLAY=STANDARD | ALL | display-options
specifies additional feature to display with the series line.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line
pattern) to one of the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the series line.
LINECOLORGROUP=column | discrete-attr-var | expression
specifies a column that determines the line colors for a grouped plot
independently of the GROUP= column.
LINEPATTERNGROUP=column | discrete-attr-var | expression
specifies a column that determines the line patterns for a grouped plot
independently of the GROUP= column.
LINETHICKNESSMAX=dimension
specifies the maximum line thickness when a response variable is used to
determine the line thickness.
LINETHICKNESSMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum line thickness.
LINETHICKNESSMIN=dimension
742 Chapter 6 • Plot Statements
Axes options
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when
GROUPDISPLAY=CLUSTER.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Connect options
CONNECTORDER=XVALUES | XAXIS
specifies how to connect the data points to form the series line.
TIPLABEL=(role-label-list)
specifies display labels for tip columns.
Label options
CURVELABEL="string" | column | expression
specifies a label for the series line.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the series-line labels.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the series-line label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the series-line label relative to the series line.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the series-line label at the specified split characters.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the series-line label can be split if
needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the series-line label text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the series-line label
block.
DATALABEL=column | expression
specifies a column that supplies values for the data point labels.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
DATALABELPOSITION=AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT |
CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the vertices of the series
line and the markers, when displayed.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all series lines and markers from discrete X
values, or discrete Y values, or both.
GROUP=column | discrete-attr-var | expression
creates a separate series plot for each unique group value in the specified
column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how marker groups are positioned for the coordinate pairs.
744 Chapter 6 • Plot Statements
ODS options
URL=string-column
specifies an HTML page to display when a point or a segment of the curve is
selected.
Required Arguments
X=column | expression
specifies the column for the X values.
Y=column | expression
specifies the column for the Y values.
Optional Arguments
ARROWHEADPOSITION= NONE | START | END | BOTH | column
specifies a position for arrowheads.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default NONE
Restriction When you specify a columnand the GROUP= option is in effect, the
arrowhead position values are assumed to be constant for each group
value. If the column has multiple values for a single group value, then
only one of the arrowhead position values is used for that group.
Default 1.0
Restriction The arrowhead scale values are assumed to be constant for each line. If
a column or expression provides multiple values for a line, only one of
the values is used.
Default OPEN
Restriction When you specify a column and the GROUP= option is in effect, the
arrowhead shape values are assumed to be constant for each group
value. If the column has multiple values for a single group value, only
one of the arrowhead shape values is used for that group.
BREAK=TRUE | FALSE
breaks the plot line at missing values of the X or Y column.
Default FALSE
Note When this option is set to FALSE, missing values are skipped and a
continuous line is drawn.
See “boolean ” on page 1339 for other Boolean values that you can use.
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when GROUPDISPLAY=CLUSTER.
AUTO uses the discrete axis for clustering groups when only one axis is
discrete. Uses the X axis for clustering if both axes are discrete or
interval.
X|Y uses the X or Y axis for clustering groups.
746 Chapter 6 • Plot Statements
Default AUTO
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group clusters as a
fraction of the minimum interval between adjacent data values.
Default 0.85
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Interactions For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
SERIESPLOT Statement 747
Interactions When this option is specified without the GROUP= option, only a
single line is generated for the plot, and the line color is derived from
the COLORRESPONSE= value.
CONNECTORDER=XVALUES | XAXIS
specifies how to connect the data points to form the series line.
XVALUES
connects data points in the order read from the X column.
748 Chapter 6 • Plot Statements
XAXIS
connects data points as they occur min-to-max along the X axis.
Default XVALUES
Tip For certain types of series lines (for example, time series) when the input
data might not be sorted by the X column, set this option to XAXIS to
assure the expected connect order.
Restrictions When the GROUP= option is specified, "string" and expression are
not valid. Use column in that case.
When the GROUP= option is not specified, column is not valid. Use
"string" or expression in that case.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interactions For this option to take effect, the CURVELABEL= option must also
be used.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the series-line label relative to the plot area.
INSIDE
locates the labels inside the plot area
SERIESPLOT Statement 749
OUTSIDE
locates the labels outside the plot area
Default INSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
MAX
forces the series-line label to appear near maximum series values (typically, to
the right)
MIN
forces the series-line label to appear near minimum series values (typically, to the
left)
START
forces the series-line label to appear near the beginning of the series line.
Tip This option is particularly useful when the series line has a spiral
shape.
END
forces the series-line label to appear near the end of the series line.
Tip This option is particularly useful when the series line has a spiral
shape.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the series-line label at the specified split characters. When a
series-line label is split, the label is split on each occurrence of the specified split
characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the series-line label can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
series-line label. In that case, all of the specified split characters together are treated
as a single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the series-
line label is split unconditionally at each occurrence of any of the specified split
characters. If the series-line label does not contain any of the specified characters,
then the label is not split.
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
curvelabelsplitchar="abc"
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the series-line label text.
TRUE
drops the split characters from the series-line label text.
FALSE
includes the split characters in the series-line label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a series-line label with the following
specifications:
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
series line for reference.
Default TRUE. The split characters are dropped from the series-line label.
752 Chapter 6 • Plot Statements
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
DATALABEL=column | expression
specifies a column that supplies values for the data point labels.
Note The label positions are adjusted to prevent the labels from overlapping.
Interactions For this option to take effect, the DATALABEL= option must also be
specified.
Tip When the GROUP= option is used, each distinct group value might be
represented by a different color. The data label that is associated with
the group is assigned the group color. This option can be used to
specify a single color for all data labels in a plot, without affecting
items that have the group color, such as error bars and marker
symbols.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Default AUTO
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
754 Chapter 6 • Plot Statements
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
SERIESPLOT Statement 755
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
DATATRANSPARENCY=number
specifies the degree of the transparency of the line, markers, line label, and data
labels, when displayed.
Default 0
DISCRETEOFFSET=number
specifies an amount to offset all series lines and markers from discrete X values, or
discrete Y values, or both. This option is useful when graphing multiple response
variables side by side on a common axis
Default 0 (no offset, all series lines and markers are centered on the discrete X
values, or discrete Y values, or both)
Range -0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right on discrete X values and up on
discrete Y values. If the layout’s axis options set REVERSE=TRUE,
then the offset direction is also reversed.
SERIESPLOT Statement 757
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
TRUE
draws filled markers (marker symbols with the suffix FILLED) using both fill
and an outline. When this option is TRUE, the fill color and outline color for
filled markers are determined in the following ways:
• If the GROUP= option is specified, then by default, the fill color is derived
from the GraphData1–GraphDataN style elements Color attribute, and the
marker outlined color is derived from the GraphData1–GraphDataN style
elements ContrastColor attribute.
• If the GROUP= option is not specified, then the marker fill is drawn by using
the MARKERFILLATTRS= specification, and the outline is drawn by using
the MARKEROUTLINEATTRS= specification.
FALSE
draws the markers using fill or an outline, but not both.
Default FALSE
Tip To specify the marker fill and outline colors for a non-grouped plot, set this
option to TRUE, and then use the MARKERFILLATTRS= and
MARKEROUTLINEATTRS= options to specify the colors.
“boolean ” on page 1339 for other Boolean values that you can use.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of marker
symbols, colors, and line patterns.
Tips The representations that are used to identify the groups can be
overridden. For example, each distinct group value is often
represented by a different line pattern, but you can use the
LINEATTRS=(PATTERN=pattern) option to assign the same line
pattern to all of the plot’s line patterns, letting line color indicate group
values. Likewise, you could use LINEATTRS=(COLOR= color) to
assign the same color to all lines, letting line pattern indicate group
values.
Starting with the second maintenance release of SAS 9.4, you can use
the LINECOLORGROUP=, LINEPATTERNGROUP=,
MARKERCOLORGROUP=, and MARKERSYMBOL= options to
assign line colors, line patterns, marker colors, and marker symbols
based on a different group column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how marker groups are positioned for the coordinate pairs.
OVERLAY
draws markers for a given group value at the exact coordinate. Depending on the
data, markers at a given coordinate might overlap.
SERIESPLOT Statement 759
CLUSTER
draws markers for a given group value adjacent to each other.
Default OVERLAY
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line pattern)
to one of the GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The Y-column label. If a label is not defined, then the Y-column name
is used.
SERIESPLOT Statement 761
Interactions This option’s COLOR= suboption overrides the default behavior for
grouped data when the LINECOLORGROUP= option and the
COLORRESPONSE= option are not specified. When the COLOR=
suboption is specified without the LINECOLORGROUP= and
COLORRESPONSE= options, all lines have the same color.
See “General Syntax for Attribute Options” on page 1347 for the syntax
for using a style-element.
Note A discrete attribute map variable is valid for this option starting
with the third maintenance release of SAS 9.4.
When this option is specified with the GROUP= option, the series line colors are
selected from the GraphData1–GraphDataN style elements based on the
LINECOLORGROUP= column instead of on the GROUP= column.
762 Chapter 6 • Plot Statements
Default The line colors are selected based on the GROUP= column.
Requirement The column value must be the same for all of the points that define a
series line.
Interactions The GROUP= option must be specified for this option to have any
effect.
LINEATTRS=
Note A discrete attribute map variable is valid for this option starting
with the third maintenance release of SAS 9.4.
When this option is specified with the GROUP= option, the series line patterns are
selected from the GraphData1–GraphDataN style elements based on the
LINECOLORGROUP= column instead of on the GROUP= column.
Default The line patterns are selected based on the GROUP= column.
Requirement The column value must be the same for all of the points that define a
series line.
Interactions The GROUP= option must be specified for this option to have any
effect.
LINEATTRS=
SERIESPLOT Statement 763
LINETHICKNESSMAX=dimension
specifies the maximum line thickness when a response variable is used to determine
the line thickness. By default, this option determines the thickness of the line that
represents the maximum response column value.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default Ten times the thickness that is specified by the GraphDataDefault style
element LineThickness attribute.
LINETHICKNESSMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum line thickness.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default The maximum value in the response column that is specified in the
LINETHICKNESSRESPONSE= option.
The thickness for all lines that exceed the maximum response value is
set to the value specified in the LINETHICKNESSMAX= option.
LINETHICKNESSMIN=dimension
specifies the minimum line thickness when a response variable is used to determine
the line thickness.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
764 Chapter 6 • Plot Statements
Interactions When the column values are all zero, all negative, or all missing, this
option is ignored. In these cases, the default line thickness is used for
all of the lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Note A discrete attribute map variable is valid for this option starting
with the third maintenance release of SAS 9.4.
When this option is specified with the GROUP= option, the series line markers are
selected from the GraphData1–GraphDataN style elements based on the
MARKERCOLORGROUP= column instead of on the GROUP= column.
Default The line marker colors are selected based on the GROUP= column.
Requirement The column value must be the same for all of the points that define a
series line.
Interactions The DISPLAY= option must enable the display of the series line
markers for this option to have any effect.
The GROUP= option must be specified for this option to have any
effect.
Tip Use the MARKERATTRS= option to set the marker symbol size.
MARKERFILLATTRS=style-element | (fill-options)
specifies the appearance of the filled markers.
MARKEROUTLINEATTRS=style-element | (line-options)
specifies the appearance of the marker outlines.
SERIESPLOT Statement 767
Interaction This option is ignored when a data skin is applied by the current style
or by the DATASKIN= option. In the latter case, the outline is set by
the data skin.
Note A discrete attribute map variable is valid for this option starting
with the third maintenance release of SAS 9.4.
When this option is specified with the GROUP= option, the series line marker
symbols are selected from the GraphData1–GraphDataN style elements based on the
MARKERSYMBOLGROUP= column instead of on the GROUP= column.
Default The line marker symbols are selected based on the GROUP= column.
Requirement The column value must be the same for all of the points that define a
series line.
Interactions The GROUP= option must be specified for this option to have any
effect.
The DISPLAY= option must enable the display of the series line
markers for this option to have any effect.
Tip Use the MARKERATTRS= option to set the marker symbol size.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, CURVELABEL, DATALABEL, GROUP,
and INDEX.
SMOOTHCONNECT=TRUE | FALSE
specifies that a smoothed line passes through all vertices.
Default FALSE
SERIESPLOT Statement 769
Interaction Starting with the third maintenance release of SAS 9.4, this option is
ignored when SPLINETYPE=QUADRATICBEZIER is in effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
SPLINEPOINTS=positive-integer
specifies a multiplier to apply to the time interval that is in effect for the
INTERVAL= axis option.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default 20
Interaction When this option is set to a non-default value, markers and data labels,
when displayed, are positioned at their original data points.
SPLINETYPE=NONE | QUADRATICBEZIER
specifies the type of spline interpolation that is used to draw the series line.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
The following figure shows an example of SPLINETYPE= values
QUADRATICBEZIER and NONE.
Figure 6.2 Spline Types QUADRATICBEZIER and NONE
Default NONE
Note Markers and data labels, when displayed, are positioned at their original
data points as shown in Figure 6.2 on page 769.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the series line.
If this option is used, then the information specified replaces all the information that
is displayed by default. You can specify roles for columns that do not contribute to
the series plot along with roles that do.
(role-list)
an ordered, space-separated list of unique SERIESPLOT roles and user-defined
roles. SERIESPLOT roles include X, Y, CURVELABEL, DATALABEL,
GROUP, and COLORRESPONSE.
770 Chapter 6 • Plot Statements
Example The following example displays data tips for the columns assigned to
the roles X and Y as well as the column Obs, which is not assigned to
any pre-defined SERIESPLOT role. The Obs column must first be
assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X, Y, DATALABEL, COLORRESPONSE, and
GROUP.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that specifies the IMAGEMAP option,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
SERIESPLOT Statement 771
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a point or a segment of the curve is
selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
series line segment that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Note When you select a portion of a segment that is not an endpoint, the
nearest segment endpoint is used.
Tips The URL value can be blank for some X and Y pairs, meaning that
no action is taken when the corresponding segment is selected.
The URL value can be the same for any X and Y pair, meaning that
the same action is taken when the segment for those X and Y pairs is
selected.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
772 Chapter 6 • Plot Statements
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
The SERIESPLOT statement is typically used to show time-dependent data.
Examples
Example Program
proc template;
define statgraph seriesplot;
begingraph;
entrytitle "Tech Stock Trends";
layout overlay;
seriesplot x=date y=close / group=stock name="stocks";
discretelegend "stocks";
endlayout;
endgraph;
end;
Example 2: Series Plot with Line-Thickness Response and Arrowheads 773
Example Program
/* Extract the 2001 data from Sashelp.Stocks
and convert Volume to millions. */
data stocks;
set sashelp.stocks(where=
(date between "1jan02"d and "31dec02"d));
volume = volume / 1000000;
format date MONNAME3. volume 6.2;
;
STEPPLOT Statement
Displays a series of horizontal and vertical line segments that connect observations of input data.
Syntax
STEPPLOT X=column | expression
Y=numeric-column | expression </option(s)>;
Appearance options
STEPPLOT Statement 775
Axes options
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when
GROUPDISPLAY=CLUSTER.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Connect options
CONNECTORDER=XVALUES | XAXIS
specifies how to connect the data points to form the step line.
JOIN=TRUE | FALSE
specifies whether the steps are connected.
Label options
CURVELABEL="string" | column | expression
specifies a label for the step line.
CURVELABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the step-line labels.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the step-line label relative to the plot area.
CURVELABELPOSITION=AUTO | MAX | MIN | START | END
specifies the position of the step-line labels relative to the step line.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the step-line label at the specified split characters.
CURVELABELSPLITCHAR="character-list"
STEPPLOT Statement 777
specifies one or more characters on which the step-line label can be split if
needed.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the step-line label text.
CURVELABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the step-line label
block.
DATALABEL=column | expression
specifies a column that supplies values for the data point labels.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
DATALABELPOSITION=AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT |
CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the data points and
markers, when displayed.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
specifies an amount to offset all step lines and markers from discrete X
values when graphing multiple response variables side by side on a common
axis.
GROUP=column | discrete-attr-var | expression
creates a distinct set of lines, markers, and data labels for each unique group
value of the specified column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies whether grouped step lines and markers are overlaid or clustered
around the category midpoints.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page to display when a step line segment is selected.
Required Arguments
X=column | expression
specifies the column of the X values.
Y=numeric-column | expression
specifies the numeric column of the Y values.
Optional Arguments
ARROWHEADPOSITION= NONE | START | END | BOTH | column
specifies a position for arrowheads.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default NONE
Restriction When you specify a columnand the GROUP= option is in effect, the
arrowhead position values are assumed to be constant for each group
value. If the column has multiple values for a single group value, then
only one of the arrowhead position values is used for that group.
Default 1.0
Restriction The arrowhead scale values are assumed to be constant for each line. If
a column or expression provides multiple values for a line, only one of
the values is used.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
The following figure shows each of the arrowhead shapes.
Default OPEN
Restriction When you specify a column and the GROUP= option is in effect, the
arrowhead shape values are assumed to be constant for each group
value. If the column has multiple values for a single group value, only
one of the arrowhead shape values is used for that group.
BREAK=TRUE | FALSE
determines whether the plot line should show breaks at occurrences of missing
values of the Y column.
Default FALSE
Note When this option is set to FALSE, missing values are skipped and the line
continues through the missing value and to the next point.
See “boolean ” on page 1339 for other Boolean values that you can use.
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when GROUPDISPLAY=CLUSTER.
AUTO uses the discrete axis for clustering groups when only one axis is
discrete. Uses the X axis for clustering if both axes are discrete or
interval.
X|Y uses the X or Y axis for clustering groups.
Default AUTO
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group clusters as a
fraction of the minimum interval between adjacent data values.
Default 0.85
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
780 Chapter 6 • Plot Statements
Interactions For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
CONNECTORDER=XVALUES | XAXIS
specifies how to connect the data points to form the step line.
XVALUES
connects data points in the data order of the X column.
XAXIS
connects data points sorted by their X values.
Tip When the input data for the step lines is not sorted by the X column, you
can use XAXIS to assure the expected connect order.
Default XVALUES
Restrictions When the GROUP= option is specified, "string" and expression are
not valid. Use column in that case.
When the GROUP= option is not specified, column is not valid. Use
"string" or expression in that case.
Tip The font and color attributes for the label are specified by the
CURVELABELATTRS= option.
Interactions For this option to take effect, the CURVELABEL= option must also
be used.
STEPPLOT Statement 781
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
CURVELABELLOCATION=INSIDE | OUTSIDE
specifies the location of the step-line label relative to the plot area.
INSIDE
locates the labels inside the plot area
OUTSIDE
locates the labels outside the plot area
Default INSIDE
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
MAX
forces the step-line label to appear near maximum step values (typically, upper
right)
MIN
forces the step-line label to appear near minimum step values (typically, lower
left)
START
forces the step-line label to appear near the beginning of the steps.
Tip This option is particularly useful when the step line spirals around.
782 Chapter 6 • Plot Statements
END
forces the step-line label to appear near the end of the steps.
Tip This option is particularly useful when the step line spirals around.
Interactions For this option to take effect, the CURVELABEL= option must also
be specified.
CURVELABELSPLIT=TRUE | FALSE
specifies whether to split the step-line label at the specified split characters. When a
step-line label is split, the label is split on each occurrence of the specified split
characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
CURVELABELSPLITCHAR="character-list"
specifies one or more characters on which the step-line label can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
step-line label. In that case, all of the specified split characters together are treated as
a single split character.
When CURVELABEL= is specified and CURVELABELSPLIT=TRUE, the step-
line label is split unconditionally at each occurrence of any of the specified split
characters. If the step-line label does not contain any of the specified characters, then
the label is not split.
STEPPLOT Statement 783
"character-list"
one or more characters with no delimiter between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
CURVELABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the step-line label text.
TRUE
drops the split characters from the step-line label text.
FALSE
includes the split characters in the step-line label text. When
CURVELABELSPLIT=TRUE and
CURVELABELSPLITCHARDROP=FALSE, each split character remains as the
last character in the current line. The characters that follow the split character, up
to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a step-line label with the following
specifications:
• CURVELABELPOSITION=MAX
• CURVELABEL="Product*Group*A"
• CURVELABELSPLIT=TRUE
• CURVELABELSPLITCHARDROP=TRUE | FALSE
• CURVELABELSPLITCHAR="*"
Note: The horizontal line to the left of the label represents the maximum end of the
step line for reference.
784 Chapter 6 • Plot Statements
Default TRUE. The split characters are dropped from the step-line label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
DATALABEL=column | expression
specifies a column that supplies values for the data point labels.
Note The label positions are adjusted to prevent the labels from overlapping.
Interactions For this option to take effect, the DATALABEL= option must also be
specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Default AUTO
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at the specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
786 Chapter 6 • Plot Statements
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
STEPPLOT Statement 787
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
DATATRANSPARENCY=number
specifies the degree of the transparency of the step lines, markers, error bars, step-
line labels, and data labels, when displayed.
Default 0
DISCRETEOFFSET=number
specifies an amount to offset all step lines and markers from discrete X values when
graphing multiple response variables side by side on a common axis.
Default 0 (no offset, all step lines and markers are centered on the discrete X
values)
STEPPLOT Statement 789
Range -0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. A positive offset is to the right. If the layout’s axis options set
REVERSE=TRUE, then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
Interaction For this option to take effect, error bars must be displayed by the
ERRORLOWER= or ERRORUPPER= options.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
ERRORBARCAPSHAPE=SERIF | NONE
specifies whether the error bars have a serif cap.
790 Chapter 6 • Plot Statements
Defaults SERIF in the first maintenance release of SAS 9.4 and earlier releases.
ERRORLOWER=numeric-column | expression
specifies the values of the lower endpoints on the Y error bars.
Requirement The error bar values must be absolute data values, not data values
relative to the value of the bar.
ERRORUPPER=numeric-column | expression
specifies the values of the upper endpoints on the Y error bars.
Requirement The error bar values must be absolute data values, not data values
relative to the value of the bar.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
TRUE
draws filled markers (marker symbols with the suffix FILLED) using both fill
and an outline. When this option is TRUE, the fill color and outline color for
filled markers are determined in the following ways:
• If the GROUP= option is specified, then by default, the fill color is derived
from the GraphData1–GraphDataN style elements Color attribute, and the
marker outlined color is derived from the GraphData1–GraphDataN style
elements ContrastColor attribute.
• If the GROUP= option is not specified, then the marker fill is drawn by using
the MARKERFILLATTRS= specification, and the outline is drawn by using
the MARKEROUTLINEATTRS= specification.
FALSE
draws the markers using fill or an outline, but not both.
Default FALSE
STEPPLOT Statement 791
Tip To specify the marker fill and outline colors for a non-grouped plot, set this
option to TRUE, and then use the MARKERFILLATTRS= and
MARKEROUTLINEATTRS= options to specify the colors.
“boolean ” on page 1339 for other Boolean values that you can use.
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of marker
symbols, colors, and line patterns.
Tip The representations that are used to identify the groups can be
overridden. For example, each distinct group value is often
represented by a different line pattern, but the
LINEATTRS=(PATTERN=pattern) option could be used to assign the
same line pattern to all of the plot’s line patterns, letting line color
indicate group values. Likewise, LINEATTRS=(COLOR=color) could
be used to assign the same color to all lines, letting line pattern
indicate group values.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies whether grouped step lines and markers are overlaid or clustered around the
category midpoints.
OVERLAY
centers the step lines and markers for matching category values on the midpoints.
The step lines in each set of group values are superimposed on each other.
792 Chapter 6 • Plot Statements
CLUSTER
clusters the step lines and markers for matching category values around the
midpoints on a discrete axis or around the intervals on an interval axis. Each
cluster of group values is centered at the midpoint for the category.
Default OVERLAY
Restriction For this option to take effect, the GROUP= option must also be
specified.
Tip This option is useful when you want to reverse the category axis.
ASCENDING
orders the groups within a category in ascending order.
DESCENDING
orders the groups within a category in descending order.
Default DATA
Interactions This option is ignored if the GROUP= option is not also specified.
By default, the groups in the legend are shown in the order that is
specified in GROUPORDER.
Notes Attributes such as color, symbol, and pattern are assigned to each
group in the DATA order by default, regardless of the
GROUPORDER= option setting.
Tip Use the INDEX= option to alter the default sequence of visual
attributes that is assigned to the groups.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
STEPPLOT Statement 793
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color, marker symbol, and line pattern)
to one of the GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
JOIN=TRUE | FALSE
specifies whether the steps are connected.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
Default LEFT
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The Y-column label. If a label is not defined, then the Y-column name
is used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LINETHICKNESSMAX=dimension
specifies the maximum line thickness when a response variable is used to determine
the line thickness. By default, this option determines the thickness of the line that
represents the maximum response column value.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default Ten times the thickness that is specified by the GraphDataDefault style
element LineThickness attribute.
LINETHICKNESSMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum line thickness.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default The maximum value in the response column that is specified in the
LINETHICKNESSRESPONSE= option.
The thickness for all lines that exceed the maximum response value is
set to the value specified in the LINETHICKNESSMAX= option.
LINETHICKNESSMIN=dimension
specifies the minimum line thickness when a response variable is used to determine
the line thickness.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Interactions When the column values are all zero, all negative, or all missing, this
option is ignored. In these cases, the default line thickness is used for
all of the lines.
case, all markers have the same symbol, and the symbol color alone
distinguishes the markers.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
MARKERFILLATTRS=style-element | (fill-options)
specifies the appearance of the filled markers.
MARKEROUTLINEATTRS=style-element | (line-options)
specifies the appearance of the marker outlines.
Interaction This option is ignored when a data skin is applied by the current style
or by the DATASKIN= option. In the latter case, the outline is set by
the data skin.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, CURVELABEL, DATALABEL,
ERRORLOWER, ERRORUPPER, GROUP, and INDEX.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the step line.
If this option is used, then it replaces all of the information that is displayed by
default. Roles for columns that do not contribute to the step plot can be specified
along with roles that do.
(role-list)
an ordered, space-separated list of unique STEPPLOT and user-defined roles.
STEPPLOT roles include X , Y , CURVELABEL , DATALABEL ,
ERRORLOWER , ERRORUPPER , and GROUP .
User-defined roles are defined with the ROLENAME= option.
Example The following example displays data tips for the columns assigned to
the roles X and Y as well as the column Obs, which is not assigned to
any pre-defined STEPPLOT role. The Obs column must first be
assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X , Y , DATALABEL , ERRORLOWER ,
ERRORUPPER , and GROUP .
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
800 Chapter 6 • Plot Statements
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a step line segment is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
step line segment that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Tips The URL value can be blank for some X and Y pairs, meaning that
no action is taken when the corresponding segment is selected.
Example: STEPPLOT Statement 801
The URL value can be the same for any X and Y pairs, meaning that
the same action is taken when the segment for those X and Y pairs
are selected.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
For character columns, the X-axis is always of TYPE=DISCRETE. For numeric
columns, both the X- and the Y-axis are of TYPE=LINEAR by default. You can change
the axis type for numeric axes with the XAXISOPTS= and YAXISOPTS= options of the
containing overlay layout.
By default, the STEPPLOT statement uses the X values in data order. You can use the
CONNECTORDER= option to change the order.
The following graph was generated by the “Example Program” on page 802:
802 Chapter 6 • Plot Statements
Example Program
Here is the program code for this example.
proc template;
define statgraph stepplot;
begingraph;
entrytitle "Kaplan-Meier Survival Plot";
layout overlay /
yaxisopts=(linearopts=(viewmin=0 viewmax=1));
stepplot x=Time y=Survival /
group=Stratum name="step";
scatterplot x=Time y=Censored / name="scat"
legendlabel="Censored" markerattrs=(symbol=plus);
discretelegend "step" / location=inside
halign=right valign=top across=1;
discretelegend "scat" /
location=inside halign=center valign=top;
endlayout;
endgraph;
end;
run;
data Study;
input Group : $10. Time Status @@;
label Time="Time (Days)";
datalines;
run;
ods graphics;
SURFACEPLOTPARM Statement 803
SURFACEPLOTPARM Statement
Creates a three-dimensional surface representing a response variable evaluated over a grid of X and Y
values.
Restriction: The SURFACEPLOTPARM statement does not support data tips.
804 Chapter 6 • Plot Statements
Requirements: For surface plots, the input data should form an evenly spaced grid of horizontal
values (X and Y) and one or more vertical values (Z) for each combination.
The input data must be sorted by Y and X in order to obtain the correct lighting.
Syntax
SURFACEPLOTPARM X=numeric-column | expression
Y=numeric-column | expression
Z=numeric-column | expression </option(s)>;
Appearance options
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used with the COLORRESPONSE= or
SURFACECOLORGRADIENT= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
starting with the second maintenance release of SAS 9.4, specifies the
column or range attribute map variable to use to determine the surface colors.
DATATRANSPARENCY=number
specifies the degree of the transparency of the surface.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the color of the filled surface or the wire-frame mesh.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
SURFACECOLORGRADIENT=numeric-column | range-attr-var
specifies the column or range attribute map variable that is used to determine
the surface colors (in the first maintenance release of SAS 9.4 and earlier
releases).
SURFACETYPE=FILLGRID | FILL | WIREFRAME
specifies how the surface is displayed.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Required Arguments
X=numeric-column | expression
specifies the X coordinates of the grid.
SURFACEPLOTPARM Statement 805
Y=numeric-column | expression
specifies the Y coordinates of the grid.
Z=numeric-column | expression
specifies the height of response values.
Note The input data should be sorted by both 1) the Y column and 2) the X
column. The sort direction for Y should be ascending. The sort direction of X
be either ascending or descending.
Optional Arguments
COLORMODEL=style-element | (color-list)
specifies a color ramp that is to be used with the COLORRESPONSE= or
SURFACECOLORGRADIENT= option.
style-element
specifies the name of a style element. The style element should contain these
style attributes:
range-attr-var
specifies a range attribute map variable that is defined in a RANGEATTRVAR
statement.
DATATRANSPARENCY=number
specifies the degree of the transparency of the surface.
Default 0
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The Z-column label. If a label is not defined, then the Z-column name
is used.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
SURFACEPLOTPARM Statement 807
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
OVERLAY3D layout contribute to a common axis.
Default FALSE
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
SURFACECOLORGRADIENT=numeric-column | range-attr-var
specifies the column or range attribute map variable that is used to determine the
surface colors (in the first maintenance release of SAS 9.4 and earlier releases).
Note: Starting with the second maintenance release of SAS 9.4, the
SURFACECOLORGRADIENT= option is deprecated and replaced with the
COLORRESPONSE= option. The syntax and functionality are the same. The
SURFACECOLORGRADIENT= option is still honored, but the
COLORRESPONSE= option is preferred.
Default FILLGRID
Details
The SURFACEPLOTPARM statement assumes that the Z response values have been
provided for a uniform X-Y grid. Missing Z values leave a “hole” in the surface. The
observations in the input data set should form an evenly spaced grid of horizontal (X and
Y) values and one vertical (Z) value for each of these combinations. The observations
should be in sorted order of Y and X to obtain an accurate plot.
808 Chapter 6 • Plot Statements
The G3GRID procedure (requires a SAS/GRAPH license) can be used to interpolate the
necessary values to produce a data set with nonmissing Z values for every combination
of X and Y. The G3GRID procedure can also smooth data with spline interpolations. For
further details, see the documentation for PROC G3GRID in the SAS/GRAPH:
Reference.
Using PROC G3GRID, the following code performs a Spline interpolation and generates
this figure:
data nums;
do i=1 to 30;
X=10*ranuni(33)-5;
Y=10*ranuni(35)-5;
Z=sin(sqrt(x*x+y*y));
output;
end;
run;
proc g3grid data=nums out=gridded;
grid y*x=z / spline
axis1=-5 to 5 by 0.1
axis2=-5 to 5 by 0.1;
run;
proc sort data=gridded; by y x; run;
proc template;
define statgraph g3grid_surface;
begingraph;
entrytitle "Spline Interpolation";
layout overlay3d;
surfaceplotparm x=x y=y z=z /
surfacetype=fill;
endlayout;
endgraph;
SURFACEPLOTPARM Statement 809
end;
run;
The KDE procedure can produce an output data set of gridded X-Y values where the Z
value is computed to be a Kernel Density Estimate of the distribution of X and Y. For
further details, see the documentation for PROC KDE in the SAS/STAT user’s guide.
Using PROC KDE on the nums data generated in the previous example, the following
code computes a Kernel Density Estimate and generates this figure:
proc template;
define statgraph kde_surface;
begingraph;
entrytitle "Kernel Density Estimate";
layout overlay3d;
surfaceplotparm x=x y=y z=density /
surfacetype=fill;
endlayout;
endgraph;
end;
run;
810 Chapter 6 • Plot Statements
The SURFACEPLOTPARM does not support the data tips that are enabled by the
IMAGEMAP= option in the ODS GRAPHICS statement.
The following graph was generated by the “Example Program” on page 810:
Example Program
Here is the code for this example. The COLORRESPONSE= option is valid starting
with the second maintenance release of SAS 9.4. For prior releases, use the
SURFACECOLORGRADIENT= option instead.
proc template;
define statgraph surfaceplotparm;
begingraph;
entrytitle "Surface Plot of Lake Bed";
layout overlay3d / cube=false;
surfaceplotparm x=length y=width z=depth /
reversecolormodel=true
colorresponse=depth
colormodel=twocoloraltramp;
endlayout;
endgraph;
end;
TEXTPLOT Statement
Displays text values at specific X and Y locations in the graph.
Note: This feature applies to the second maintenance release of SAS 9.4 and to later
releases.
Tip: Use the TEXTPLOT statement, rather than the SCATTERPLOT statement with the
MARKERCHARACTER= option, when you want more control over the appearance
of the text. The TEXTPLOT statement enables you to rotate the text to any angle,
manage the text position, split the text into multiple lines, display a bounding box
around the text, add a back-light effect to the text, and so on.
Syntax
TEXTPLOT X=column | expression
Y=column | expression
TEXT=column | expression </option(s)>;
Appearance options
BACKLIGHT=number | AUTO
specifies a back-light effect for the marker text.
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group
clusters as a fraction of the minimum interval between adjacent data values.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute map variable to use to determine the
text-marker text colors.
CONTRIBUTEOFFSETS=ALL | NONE | (axis-offset-list)
specifies whether space requirements for this plot contribute to the
calculation of the axis offsets.
DATATRANSPARENCY=number
specifies the degree of the transparency of the text.
DISPLAY=STANDARD | ALL | (display-options)
specifies the features to display.
FILLATTRS=style-element | (fill-options)
specifies the appearance of the filled areas of the text.
INDEX=positive-integer-column | expression
812 Chapter 6 • Plot Statements
specifies indices for mapping marker text color to one of the GraphData1–
GraphDataN style elements.
OUTLINEATTRS=style-element | style-element(line-options) | (line-options)
specifies the appearance of the text-marker outlines.
PAD=dimension | (pad-options)
specifies the amount of extra space to add inside the text-marker border.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either
the ODS style that is in effect or by the COLORMODEL= option.
TEXTATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font properties of the text-marker text.
Axes options
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when
GROUPDISPLAY=CLUSTER.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Experimental options
OUTFILE=fileref | "filename"
specifies a file for storing information about the text bounding-box for each
text value in the column specified in the OUTID= option.
OUTID=column | expression
specifies a column that contains text values to write to the file specified in the
OUTFILE= option.
Label options
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
DISCRETEOFFSET=number
TEXTPLOT Statement 813
specifies the distance to offset all text values from discrete X values, discrete
Y values, or both.
GROUP=column | discrete-attr-var | expression
creates a separate text value for each unique group value in the specified
column.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how marker groups are positioned for the coordinate pairs.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
ODS options
URL=string-column
specifies an HTML page to display when a text value is selected.
Text options
FORMAT=format
specifies a SAS format or a user-defined format for the TEXT= column.
POSITION=position-option
specifies the position of the text value with respect to the location of the data
point.
ROTATE=number | numeric-column
specifies the angle of rotation, in degrees, for the text values.
SIZEMAX=dimension
specifies the maximum font size for a text marker when a response variable is
used to size the text-marker font.
SIZEMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum font size for
text markers.
SIZEMIN=dimension
specifies the minimum font size for text markers when a response variable is
used to size the font for text values.
SIZERESPONSE=numeric-column | numeric-expression
specifies a response column that is used to determine the font size for each
text value.
SPLITCHAR="character-list"
specifies one or more characters on which the text-marker text can be split.
SPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the text-marker text.
SPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the lines of text in the text-marker text blocks.
SPLITPOLICY=NONE | SPLIT | SPLITALWAYS
specifies a policy for avoiding collisions among the text values.
SPLITWIDTH=AUTO | width-in-characters
specifies the maximum width of each split line.
STRIP=TRUE | FALSE
814 Chapter 6 • Plot Statements
specifies whether leading and trailing blanks should be stripped from the text-
marker text before it is displayed.
VCENTER=BBOX | BASELINE
specifies whether the text is vertically centered with respect to the text
bounding box or to the text baseline.
Required Arguments
X=column
specifies the column for the X values.
Y=column
specifies the column for the Y values.
TEXT=column
specifies the column for the text values that are to be used for the markers.
Optional Arguments
BACKLIGHT=number | AUTO
specifies a back-light effect for the marker text. The effect is applied only to the
marker text.
number
specifies the degree of the back-light effect.
AUTO
the system selects an appropriate level for the back-light effect. If the GROUP=
or COLORRESPONSE= option is in effect, BACKLIGHT=0.75. Otherwise,
BACKLIGHT=0.5.
The following figure shows the effect on the text of an outlined, filled text marker.
The back light is based on text color. For dark colors, a contrasting white back-light
effect is used. For lighter colors, a contrasting black back-light effect is used. The
following figure shows the two back-light types when BACKLIGHT=1.
Restriction Vector graphics output cannot be generated when the back-light effect
is applied. If you request vector graphics output and enable the back-
light effect, an image is generated instead.
TEXTPLOT Statement 815
Tip The BACKLIGHT= option is most effective when the text color has a
low level of contrast with the background or when the background is
cluttered.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To reverse the start and end colors of the ramp that is assigned to the
color model, use the REVERSECOLORMODEL= option.
Note The gradient in a continuous legend for this plot reflects the text
colors.
Use the FILLATTRS= option to set the text bounding-box fill color to
a fixed color or to modify the fill transparency.
CLUSTERAXIS=AUTO | X | Y
specifies the axis to use for clustering groups when GROUPDISPLAY=CLUSTER.
AUTO uses the discrete axis for clustering groups when only one axis is
discrete. Uses the X axis for clustering if both axes are discrete or
interval.
X|Y uses the X or Y axis for clustering groups.
Default AUTO
CLUSTERWIDTH=number
on a discrete axis, specifies the width of the group clusters as a fraction of the
midpoint spacing. On an interval axis, specifies the width of the group clusters as a
fraction of the minimum interval between adjacent data values.
Default 0.85
TEXTPLOT Statement 817
Range 0.1–1, where 0.1 is the narrowest possible width and 1 is the widest
width.
Interaction For this option to take effect, the GROUP= option must also be
specified, and the GROUPDISPLAY= option must be set to
CLUSTER.
XMAX the space requirements for this plot are contributed to the X-axis
offset calculation for the maximum end.
XMIN the space requirements for this plot are contributed to the X-axis
offset calculation for the minimum end.
YMAX the space requirements for this plot are contributed to the Y-axis
offset calculation for the maximum end.
YMIN the space requirements for this plot are contributed to the Y-axis
offset calculation for the minimum end.
Default ALL
Interaction Offsets that are set in the layout axis options are always honored,
regardless of the setting on this option.
Note This option does not affect offset requests from other plots.
DATATRANSPARENCY=number
specifies the degree of the transparency of the text.
Default 0
DISCRETEOFFSET=number
specifies the distance to offset all text values from discrete X values, discrete Y
values, or both.
Default 0 (no offset, all text values are centered on the discrete X values, or
discrete Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
tick marks. A positive offset is to the right on discrete X values and is
up on discrete Y values. If the layout’s axis options set
REVERSE=TRUE, then the offset direction is also reversed.
Restriction This option applies to discrete axes only. For nondiscrete axes, this
option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
OUTLINE
displays outlined bounding boxes around the text.
Default STANDARD
FILLATTRS=style-element | (fill-options)
specifies the appearance of the filled areas of the text. When fill options are
specified, only the COLOR= and TRANSPARENCY= suboptions are honored.
Interactions For this option to have any effect, the fill must be enabled by the ODS
style or by the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax
for using a style-element.
FORMAT=format
specifies a SAS format or a user-defined format for the TEXT= column.
Default The format that is in effect for the column that is specified in the TEXT=
argument. If no format is in effect, BEST6 is used for numeric columns.
Note Not all of the SAS formats are supported. See Appendix 4, “SAS Formats
Not Supported,” on page 1353.
Tip For each value in the discrete attribute map, the VALUE statement
TEXTATTRS= option determines the text color, the LINEATTRS=
option determines the bounding-box outline color, and the
FILLATTRS= option determines the bounding-box fill color and
transparency.
Interactions The group values are mapped in the order in which they appear in the
data.
820 Chapter 6 • Plot Statements
Notes The legend entries for this plot reflect the text colors.
By default, for each text value, the bounding-box outline color is set to
the text color.
Tip Use the OUTLINEATTRS= option to set the text bounding-box color
to a fixed color.
GROUPDISPLAY=OVERLAY | CLUSTER
specifies how marker groups are positioned for the coordinate pairs.
OVERLAY
draws text values for a given group value at the exact coordinate. Depending on
the data, markers at a given coordinate might overlap.
CLUSTER
draws text values for a given group value adjacent to each other.
Default OVERLAY
Tip Use the CLUSTERWIDTH= option to control the width of the clusters
when CLUSTER is in effect.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping marker text color to one of the GraphData1–
GraphDataN style elements.
TEXTPLOT Statement 821
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
a modulo operation remaps that index value to a number less than N
to determine which style to use.
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The TEXT-column label. If a label is not defined, then the TEXT-
column name is used.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
OUTFILE=fileref | "filename"
specifies a file for storing information about the text bounding-box for each text
value in the column specified in the OUTID= option. The information is written in
the comma-separated value (CSV) format.
CAUTION:
OUTFILE= is an experimental option that is available in the third
maintenance release of SAS 9.4. Do not use this option in production jobs.
Interaction The OUTID= option must be specified for this option to have any
effect.
822 Chapter 6 • Plot Statements
Note This option is a specialized feature for users who want to customize the
placement of the text in a text plot.
Tip Use the IMPORT procedure to import the CSV values into a SAS data
set.
OUTID=column | expression
specifies a column that contains text values to write to the file specified in the
OUTFILE= option.
CAUTION:
OUTID= is an experimental option that is available in the third maintenance
release of SAS 9.4. Do not use this option in production jobs.
Interaction The OUTFILE= option must be specified for this option to have any
effect.
Note This option is a specialized feature for users who want to customize the
placement of the text in a text plot.
For grouped data, text values use the ContrastColor attribute of the
GraphData1–GraphDataN style elements. If the COLORRESPONSE=
option is specified, the outline colors vary according to the color
gradient.
Restriction This option uses only the color specification in the style element or
line options. The line pattern and line thickness specifications are
ignored.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or by the DISPLAY= option.
Note This plot’s legend entries reflect the marker text color.
See “General Syntax for Attribute Options” on page 1347 for the syntax
for using a style-element.
PAD=dimension | (pad-options)
specifies the amount of extra space to add inside the text-marker border.
TEXTPLOT Statement 823
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the text-marker border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options,
enclosed in parentheses:
LEFT=dimension TOP=dimension
RIGHT=dimension BOTTOM=dimension
Note Sides that are not assigned padding are padded with the default amount.
Tips This option is meaningful only when the DISPLAY= option displays
fills, outlines, or both.
POSITION=position-option
specifies the position of the text value with respect to the location of the data point.
Specify one of the following position options:
Default CENTER
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
REVERSECOLORMODEL=TRUE | FALSE
specifies whether to reverse the gradient (color ramp) that is defined by either the
ODS style that is in effect or by the COLORMODEL= option.
Default FALSE
See COLORMODEL=
“boolean ” on page 1339 for other Boolean values that you can use.
ROTATE=number | numeric-column
specifies the angle of rotation, in degrees, for the text values. Positive angles are
measured in a counter-clockwise direction, and negative angles are measured in a
clockwise direction. You can use an angle that exceeds 360 degrees in absolute
value.
Default 0
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
TEXTPLOT Statement 825
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, GROUP, and COLORRESPONSE.
SIZEMAX=dimension
specifies the maximum font size for a text marker when a response variable is used
to size the text-marker font. By default, the font size of the text values that are
associated with the maximum response column value is set to the value specified by
this option.
Default Three times the size specified in the GraphDataText style element for
the maximum response column value marker.
Use the SIZEMIN= option to specify the minimum font size for text
markers.
SIZEMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum font size for text
markers.
Interaction The SIZERESPONSE= option must be specified for this option to have
any effect.
Note The font size for all text values that exceed the maximum response
value is set to the value specified in the SIZEMAX= option.
SIZEMIN=dimension
specifies the minimum font size for text markers when a response variable is used to
size the font for text values.
Default The size specified in the GraphDataText style element for the minimum
response column value marker.
Interaction The SIZERESPONSE= option must be specified for this option to have
any effect.
Tip Use the SIZEMAX= option to specify the maximum text size.
SIZERESPONSE=numeric-column | numeric-expression
specifies a response column that is used to determine the font size for each text
value.
Default The size specified in the GraphDataText style element for all text values.
Notes When the column value for an observation is 0, the font size for the text
value for that observation is set to the SIZEMIN= option value.
When the column value for an observation is negative or missing, the text
value for that observation is not displayed in the text plot. However, that
observation still contributes to the axis ranges, legend, and so on.
When all the column values are 0 or missing, this option is ignored. In that
case, the default font size is used for all of the text values.
Tip Use the SIZEMIN= and SIZEMAX= options to limit the minimum and
maximum font size for the text values.
SPLITCHAR="character-list"
specifies one or more characters on which the text-marker text can be split.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When SPLITPOLICY=SPLIT and a text value collision is detected, the text-marker
text is split on a specified split character only if a split is needed at that point in order
to make the text fit. In that case, a split might not occur on every split character.
When SPLITPOLICY=SPLITALWAYS, the text-marker text is split unconditionally
on every occurrence of a split character. If the text-marker text does not contain any
of the specified split characters, then the text is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
SPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the text-marker text.
TRUE
drops a split character from the text-marker text when a split occurs at that
character. Split characters at which a split does not occur are left in place. The
SPLITPOLICY= option determines where the text is split. When
SPLITPOLICY=SPLIT, the text for each text value is split at a split character
only where a split is needed to fit the text in the available space. At each split
point, the split character is dropped, and the characters that follow the split
character, up to but not including the split character at the next split point, are
wrapped to the following line.
When SPLITPOLICY=SPLITALWAYS, the text-marker text is split at every
instance of a split character. All of the split characters are dropped. The
characters that follow each split character, up to but not including the next split
character, are wrapped to the next line.
FALSE
includes the split characters in the data label display. The SPLITPOLICY=
option determines how the split characters are displayed. When
SPLITPOLICY=SPLIT, each data label is split at a split character only where a
split is needed in order to make the label fit the available space. A split might not
occur at every split character in the label. At each split point, the split character
remains as the last character in the current line. The characters that follow the
split character, up to and including the split character at the next split point, are
then wrapped to the following line. This process repeats until all of the text is
displayed.
When SPLITPOLICY=SPLITALWAYS, the text for each marker is split at every
instance of a split character in the text regardless of whether a split is actually
needed. Each split character remains as the last character in the current line. The
characters that follow each split character, up to and including the next split
character, are then wrapped to the next line.
Default TRUE. A split character is dropped from the text-marker text when a
split occurs at that character.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
See the SPLITCHAR= option for information about specifying the split
characters
SPLITALWAYS
splits the text-marker text at every occurrence of a split character. If the text does
not contain any of the specified split characters, then a split does not occur.
See the SPLITCHAR= option for information about specifying the split
characters
Default NONE
SPLITWIDTH=AUTO | width-in-characters
specifies the maximum width of each split line.
AUTO
uses the width of the longest inter-split-character substring.
width-in-characters
specifies a fixed width, expressed as a character count.
Note When you specify a fixed width, the text-marker text is split
unconditionally every n characters, where n is the value of width-in-
characters.
STRIP=TRUE | FALSE
specifies whether leading and trailing blanks should be stripped from the text-marker
text before it is displayed.
Default FALSE
Tip Stripping the blanks from the numeric value strings helps center each string
relative to its data point.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interactions When this option’s COLOR= suboption is used with the GROUP=
option, the COLOR= suboption specifies the color for all of the text
values.
Note If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, and style), the properties
that are not specified are derived from the GraphDataText style
element.
See “General Syntax for Attribute Options” on page 1347 for the syntax
for using a style-element.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over the text
values. If you use this option, it replaces all of the information that is displayed by
default. Roles for columns that do not contribute to the scatter plot can be specified
along with roles that do.
(role-list)
an ordered, space-separated list of unique TEXTPLOT roles and user-defined
roles. TEXTPLOT roles include X, Y, GROUP, and COLORRESPONSE.
User-defined roles are defined with the ROLENAME= option.
Example The following example displays data tips for the columns assigned to
the roles X and Y, as well as the column Obs, which is not assigned to
any pre-defined TEXTPLOT role. The Obs column must first be
assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y)
NONE
suppresses data tips and URLs (if requested) from the plot.
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement with the IMAGEMAP option specified,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
URL=string-column
specifies an HTML page to display when a text value is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
text value that is an active link.
Example http://www.sas.com/technologies/analytics/
index.html
Tips The URL value can be blank for some X and Y pairs, meaning that
no action is taken when the corresponding point is selected.
The URL value can be the same for any X and Y pair. In that case,
the same action is taken when the points for that X and Y pair are
selected.
VCENTER=BBOX | BASELINE
specifies whether the text is vertically centered with respect to the text bounding box
or to the text baseline.
BBOX
vertically centers the text with respect to its bounding box.
BASELINE
vertically centers the text with respect to the text baseline. If the text is split into
multiple lines, the text is centered on the baseline of the last line of text.
Default BBOX
Tip Use the POSITION= option to specify the text position with respect to the
text bounding box or to the text baseline.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
832 Chapter 6 • Plot Statements
Details
Using additional options in the TEXTPLOT statement, you can rotate the text around its
anchor point to any angle, manage the text position, split the text into multiple lines, add
a back-light effect to the text, and so on. If you currently use the SCATTERPLOT
statement and the MARKERCHARACTER= option to generate text plots, SAS
recommends that you use the TEXTPLOT statement instead.
When a response variable is used, in some cases, an attribute option is overridden by the
response color. See “Response Colors in a Text Plot” on page 833.
COLOR= Specified
in Attribute
Option: Result
TEXTATTRS=, When the bounding-box fill and outline are displayed, suboption
FILLATTRS=, and COLOR= in TEXTATTRS= is ignored, and the text is assigned a color
OUTLINEATTRS= from the color ramp. The fill and outline colors are set to their
COLOR= specification.
These options are for users who want to customize the placement of the text in a text
plot. After you write the attributes to a CSV file, you can import the data into a SAS data
set, and then use the data to customize the placement of the text markers.
The following table lists the information that is written to the CSV file.
TEXTPLOT Statement 835
Height Numeric The height, in pixels, of the bounding box for this
observation's text string.
Name Character The name that is specified in the NAME= option in this
TEXTPLOT statement. The name associates this CSV
file with a specific TEXTPLOT statement. This column
is useful when multiple CSV files from different
TEXTPLOT statements are merged into a single SAS
data set.
OutID Character The value for this observation from the column specified
in the OUTID= option in this TEXTPLOT statement.
The ID is used as a unique identifier for this
observation's text string.
Width Numeric The width, in pixels, of the bounding box for this
observation's text string.
outfile=csvout outid=name;
endlayout;
endgraph;
end;
After you import the CSV file into a SAS data set, you can then use the data to position
the text values as needed.
VECTORPLOT Statement 837
This example creates a text plot of weight by age and sex. Column Name provides the
text for filled, outlined markers. The following figure shows the output.
VECTORPLOT Statement
Creates a plot of vectors (directed line segments).
838 Chapter 6 • Plot Statements
Syntax
VECTORPLOT X=numeric-column | expression
Y=numeric-column | expression
XORIGIN=numeric-constant | numeric-column | expression
YORIGIN=numeric-constant | numeric-column | expression </option(s)>;
Appearance options
CLIP=TRUE | FALSE
specifies whether the origin is considered when determining the data ranges
for the axes.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the column or range attribute variable to use to map the line colors
to a continuous color gradient.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the vector plot lines.
DATATRANSPARENCY=number
specifies the degree of the transparency of the vector line and arrowhead, and
the vector labels.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of
the GraphData1–GraphDataN style elements.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the vector line and arrowhead.
LINETHICKNESSMAX=dimension
specifies the maximum line thickness when a response variable is used to
determine the line thickness.
LINETHICKNESSMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum line thickness.
LINETHICKNESSMIN=dimension
specifies the minimum line thickness when a response variable is used to
determine the line thickness.
LINETHICKNESSRESPONSE=numeric-column | range-attr-var | expression
specifies a response column or range attribute variable that is used to map a
line thickness to each group value.
Axes options
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for
determining default axis features.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data
tips.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a
vector line.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns.
TIPLABEL=(role-label-list)
specifies display labels for tip columns.
Label options
DATALABEL=column | expression
specifies the labels at the ends of the vectors.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels.
DATALABELPOSITION=AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT |
CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the end points and arrow
heads.
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at specified split characters.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if
needed.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
DATALABELSPLITJUSTIFY=AUTO | CENTER | LEFT | RIGHT
specifies the justification of the strings that are inside the data label blocks.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Midpoint options
GROUP=column | discrete-attr-var | expression
creates a distinct set of vector lines and data label colors for each unique
group value in the specified column.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the
plot.
Vector options
ARROWDIRECTION=OUT | IN |BOTH
specifies the placement of the arrowhead(s) at the end of the vector.
ARROWHEADS=TRUE | FALSE
specifies whether arrowheads are displayed on the vectors.
ARROWHEADSHAPE=OPEN | CLOSED | FILLED | BARBED
specifies the shape of the arrowheads.
840 Chapter 6 • Plot Statements
SCALE=number
specifies the scale factor of the vector length.
Required Arguments
X=numeric-column | expression
specifies the column for the X values of the vector endpoints.
Y=numeric-column | expression
specifies the column for the Y values of the vector endpoints.
XORIGIN=numeric-constant | numeric-column | expression
specifies the X data coordinate of the vector origin.
YORIGIN=numeric-constant | numeric-column | expression
specifies the Y data coordinate of the vector origin.
Optional Arguments
ARROWDIRECTION=OUT | IN |BOTH
specifies the placement of the arrowhead(s) at the end of the vector.
OUT
specifies a single arrowhead, pointing away from the origin, at the end of the
vector away from the origin.
IN
specifies a single arrowhead, pointing toward the origin, at the end of the vector
near the origin.
BOTH
specifies two arrowheads. One arrowhead points away from the origin, at the end
of the vector opposite from the origin. The other arrowhead points toward the
origin, at the end of the vector near the origin.
Default OUT
ARROWHEADS=TRUE | FALSE
specifies whether arrowheads are displayed on the vectors.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
Default OPEN
CLIP=TRUE | FALSE
specifies whether the origin is considered when determining the data ranges for the
axes.
FALSE
includes the origin when establishing the axis scales. Each axis might be
extended to force the display of the origin.
TRUE
ignores the origin when establishing axis scales. Each axis scale is determined by
the other plots in the overlay. This might result in the origin not being displayed
if its data range is not within the data ranges of tips of the vectors.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interaction For this option to take effect, the COLORRESPONSE= option must
also be specified.
DATALABEL=column | expression
specifies the labels at the ends of the vectors.
Note The label positions are automatically adjusted to prevent the labels from
colliding with other labels and other arrows.
Interaction For this option to take effect, the DATALABEL= option must also be
specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default AUTO
DATALABELSPLIT=TRUE | FALSE
specifies whether to split the data labels at specified split characters.
See “boolean ” on page 1339 for other Boolean values that you can use.
DATALABELSPLITCHAR="character-list"
specifies one or more characters on which the data labels can be split if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
data label. In that case, all of the specified split characters together are treated as a
single split character.
When DATALABEL= is specified and DATALABELSPLIT=TRUE, the data label is
split unconditionally at each occurrence of any of the specified split characters. If the
data label does not contain any of the specified characters, then the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
datalabelsplitchar="abc"
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
DATALABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the data labels.
TRUE
drops the split characters from the data label.
FALSE
includes the split characters in the data label. When DATALABELSPLIT=TRUE
and DATALABELSPLITCHARDROP=FALSE, each split character remains as
the last character in the current line. The characters that follow the split character,
up to and including the next split character, are then wrapped to the next line.
The following figure shows an example of a data label with the following
specifications:
• the data label text for this label is Product*Group*A
• DATALABELSPLIT=TRUE
• DATALABELSPLITCHARDROP=TRUE | FALSE
• DATALABELSPLITCHAR="*"
Default TRUE. The split characters are dropped from the data label.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot, the
specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
DATATRANSPARENCY=number
specifies the degree of the transparency of the vector line and arrowhead, and the
vector labels.
Default 0
Interactions The group values are mapped in the order of the data, unless the
INDEX= option is used to alter the default sequence of line patterns
and colors.
Tip You can use the LINEATTRS= option to override the representations
that are used to identify the groups. For example, You can use
LINEATTRS=(PATTERN=SOLID) to assign the same pattern to all of
the lines, letting the line color distinguish group values. Likewise, you
can use LINEATTRS=(COLOR=BLACK) to assign the same color to
all of the lines, letting the line pattern distinguish group values.
INCLUDEMISSINGGROUP=TRUE | FALSE
specifies whether missing values of the group variable are included in the plot.
Default TRUE
Interaction For this option to take effect, the GROUP= option must also be
specified.
Tip The attributes of the missing group value are determined by the
GraphMissing style element unless a discrete attribute map is in effect,
the INDEX= option is used, the MISSING= system option changes the
default missing character, or a user-defined format is applied to the
group value. In those cases, the attributes of the missing group value
are determined by a GraphData1–GraphDataN style element instead of
by the GraphMissing style element.
See “boolean ” on page 1339 for other Boolean values that you can use.
INDEX=positive-integer-column | expression
specifies indices for mapping line attributes (color and line pattern) to one of the
GraphData1–GraphDataN style elements.
All of the indexes for a specific group value must be the same.
Otherwise, the results are unpredictable.
Interaction For this option to take effect, the GROUP= option must also be
specified.
Notes The index values are 1-based indices. For the style attributes in
GraphData1–GraphDataN, if the index value is greater than N, then
848 Chapter 6 • Plot Statements
If you do not use this option, then the group values are mapped in
the order of the data.
Tip You can use indexing to collapse the number of groups that are
represented in a graph. For more information, see “Remapping
Groups for Grouped Data” on page 183.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Note The arrow head size is nonlinearly proportional to the line thickness in
order to maintain appropriately sized arrow heads for thicker lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element
LINETHICKNESSMAX=dimension
specifies the maximum line thickness when a response variable is used to determine
the line thickness. By default, this option determines the thickness of the line that
represents the maximum response column value.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default Ten times the thickness that is specified by the GraphDataDefault style
element LineThickness attribute.
LINETHICKNESSMAXRESPONSE=numeric | scalar-numeric-expression
specifies the response value that corresponds to the maximum line thickness.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default The maximum value in the response column that is specified in the
LINETHICKNESSRESPONSE= option.
The thickness for all lines that exceed the maximum response value is
set to the value specified in the LINETHICKNESSMAX= option.
LINETHICKNESSMIN=dimension
specifies the minimum line thickness when a response variable is used to determine
the line thickness.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Interactions When the column values are all zero, all negative, or all missing, this
option is ignored. In these cases, the default line thickness is used for
all of the lines.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
PRIMARY=TRUE | FALSE
specifies that the data columns for this plot and the plot type be used for determining
default axis features. This option is needed only when two or more plots within an
overlay-type layout contribute to a common axis.
Default FALSE
Note In an OVERLAY layout, only one plot in an overlay can be the primary
plot on a per-axis basis. When no plot is designated as the primary plot,
the first plot that can be a primary plot is considered the primary plot. If
multiple plots specify PRIMARY=TRUE for the same axis, then the
last such plot encountered is considered the primary plot.
See “When Plots Share Data and a Common Axis” on page 880
“boolean ” on page 1339 for other Boolean values that you can use.
VECTORPLOT Statement 851
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles X, Y, DATALABEL, XORIGIN, YORIGIN,
GROUP, and INDEX.
SCALE=number
specifies the scale factor of the vector length.
Default 1.0
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a vector line.
If this option is used, then the information specified replaces all of the information
that is displayed by default. You can specify roles for columns that do not contribute
to the vector plot along with roles that do.
(role-list)
an ordered, space-separated list of unique VECTORPLOT roles and user-defined
roles. VECTORPLOT roles include X, Y, DATALABEL, XORIGIN, YORIGIN,
GROUP, INDEX, and COLORRESPONSE.
Define user-defined roles with the ROLENAME= option.
Note Starting with the third maintenance release of SAS 9.4, the
COLORRESPONSE role is valid.
Example The following example displays data tips for the columns assigned to
the roles X, Y, GROUP, and the column Obs, which is not assigned to
any pre-defined VECTORPLOT role. The Obs column must first be
assigned a role.
ROLENAME=(TIP1=OBS)
TIP=(TIP1 X Y GROUP)
NONE
suppresses data tips from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: X, Y, DATALABEL, XORIGIN, YORIGIN,
GROUP, and COLORRESPONSE.
852 Chapter 6 • Plot Statements
Requirement To generate data tips in the output, you must include an ODS
GRAPHICS ON statement that specifies the IMAGEMAP option,
and you must write the output to the ODS HTML destination.
Tip You can control the labels and formats for the TIP roles with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example ROLENAME=(TIP1=SALARY)
TIP=(TIP1)
TIPFORMAT=(TIP1=DOLLAR12.)
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example ROLENAME=(TIP1=PCT)
TIP=(TIP1)
TIPLABEL=(TIP1="Percent")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
Requirement A column must be assigned to each of the specified roles. (See the
ROLENAME= option.)
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Example: VECTORPLOT Statement 853
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
By default in a VECTORPLOT, each vector starts at 0, 0 in the data space and is
terminated with an open arrowhead. Zero-length vectors are represented by a dot at the
starting point. To specify alternative coordinates for the starting point, use the
XORIGIN= and YORIGIN= arguments.
The following graph was generated by the “Example Program” on page 853:
Example Program
data CarPref;
input Make $11. Model $13. (S1-S25) (1.);
854 Chapter 6 • Plot Statements
datalines;
Cadillac Deville 8007990491240508971093809
Chevrolet Aveo 0051200423451043003515698
Chevrolet Cavalier 4053305814161643544747795
Chevrolet Malibu 6027400723121345545668658
Dodge Intrepid 7006000434101107333458708
Dodge Stratus 3005005635461302444675655
Dodge Neon 4005003614021602754476555
Ford Taurus 2024006715021443530648655
Ford Mustang 5007197705021101850657555
Ford Focus 0021000303030201500514078
Honda Accord 5956897609699952998975078
Honda Civic 4836709507488852567765075
Lincoln LS 7008990592230409962091909
Pontiac Firebird 0107895613201206958265907
Volkswagen Jetta 4858696508877795377895000
Volkswagen Beetle 4858509709695795487885000
Volvo S40 9989998909999987989919000
;
run;
* Compute Two Component Model;
ods graphics;
ods exclude all;
ods output mdprefplot=plotdata;
proc prinqual data=CarPref n=2 replace mdpref method=mgv;
id model;
transform monotone(S1-S25);
run;
ods select all;
proc template;
define statgraph vectorplot;
begingraph;
entrytitle "Multidimensional Preference Analysis";
entrytitle "of Preference Ratings for Automobiles";
layout overlayequated / equatetype=fit cycleattrs=true;
referenceline y=0 / datatransparency=0.7;
referenceline x=0 / datatransparency=0.7;
vectorplot y=vec2 x=vec1 xorigin=0 yorigin=0 /
datalabel=label2var;
scatterplot y=prin2 x=prin1 /
datalabel=idlab1 primary=true
markerattrs=(symbol=circlefilled);
endlayout;
endgraph;
end;
run;
WATERFALLCHART Statement
Creates a waterfall chart that is computed from input data.
WATERFALLCHART Statement 855
Interaction: A Waterfall chart accumulates response values in data order. Any change in the
order of the X-axis values from the data order can adversely affect the waterfall
chart. The X-axis value order can change when the Waterfall chart is overlaid with
other plots or when it is used in a Lattice with uniform axes. It can also change when
certain options are applied to the X axis.
Tip: Starting with the third maintenance release of SAS 9.4, you can use subpixel
rendering with this statement. It is enabled by default. To disable subpixel rendering,
specify SUBPIXEL=OFF in the BEGINGRAPH statement or in an ODS GRAPHICS
statement. For information about the BEGINGRAPH statement SUBPIXEL= option,
see SUBPIXEL= on page 33. For information about the ODS GRAPHICS statement
SUBPIXEL= option, see “ODS GRAPHICS Statement” in SAS ODS Graphics:
Procedures Guide.
Syntax
WATERFALLCHART CATEGORY=column | expression
RESPONSE=numeric-column | expression </option(s)>;
Appearance options
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
COLORGROUP=column | discrete-attr-var | expression
specifies a column that is used to discretely color the transaction bars.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
COLORRESPONSE=numeric-column | range-attr-var | expression
specifies the numeric column or range attribute map variable that is used to
determine the transaction-bar colors.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
enhances the visual appearance of the filled bars.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fill, bar outline, bar labels,
and trend lines, if displayed.
DISPLAY=STANDARD | ALL | (display-options)
specifies which bar features to display.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the filled transaction bars.
FILLTYPE=SOLID | GRADIENT
determines whether a solid or gradient fill is used in the bars.
FINALBARATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the “final” bar, if displayed.
INITIALBARATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the appearance of the “initial” bar, if displayed.
INITIALBARVALUE=number
specifies a value for the initial bar.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the bar outlines.
856 Chapter 6 • Plot Statements
Axes options
BASELINEINTERCEPT=number
specifies the response axis intercept for the baseline.
FINALBARTICKVALUE="string"
specifies a tick value to use on the category axis when the “final” bar is
displayed
INITIALBARTICKVALUE="string"
specifies a tick value to use on the category axis when the “initial” bar is
displayed.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the
secondary X2 (top) axis.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the
secondary Y2 (right) axis.
Label options
BARLABEL=TRUE | FALSE
specifies whether the bar statistic value is displayed at the end of the bar.
BARLABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the text properties of the bar label text.
BARLABELFITPOLICY=AUTO | NONE
specifies a policy for avoiding collisions among the bar labels when labels
are displayed.
BARLABELFORMAT=format
specifies the text format used to display the bar label.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
ODS options
URL=string-column
specifies an HTML page to display when a bar is selected.
Statistics options
COLORSTAT=SUM | MEAN
specifies the statistic to use for computing the response colors.
WATERFALLCHART Statement 857
STAT=SUM | MEAN
specifies the statistic to be computed for the RESPONSE axis.
Required Arguments
CATEGORY=column | expression
specifies the column or expression for the category values. Duplicated category
values are summarized into a unique value. All values are treated as discrete.
RESPONSE=numeric-column | expression
specifies the numeric column or expression for the response values.
Optional Arguments
BARLABEL=TRUE | FALSE
specifies whether the bar statistic value is displayed at the end of the bar.
Default FALSE
Tip The font and color attributes for the label are specified by the
BARLABELATTRS= option. The text format is specified by the
BARLABELFORMAT= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
BARLABELFITPOLICY=AUTO | NONE
specifies a policy for avoiding collisions among the bar labels when labels are
displayed.
858 Chapter 6 • Plot Statements
AUTO
rotates the bar labels if the labels exceed the midpoint spacing. If the labels
collide horizontally due to thin bars, then AUTO drops all of the labels. The
following figure shows an example.
See the BARWIDTH= option for more information about the bar spacing.
NONE
does not rotate the bar labels. Labels that are too long overlap.
Default AUTO
BARLABELFORMAT=format
specifies the text format used to display the bar label.
BARWIDTH=number
specifies the width of a bar as a ratio of the maximum possible width.
Default 0.85
By default, the bar width automatically adjusts based on the number of bars
to be displayed and the wall width.
BASELINEATTRS=style-element | (line-options)
specifies the appearance of the baseline.
WATERFALLCHART Statement 859
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
BASELINEINTERCEPT=number
specifies the response axis intercept for the baseline. The baseline is always
displayed in the chart, whether for a specified value or for the default value. When
this option is used, the axis range is adjusted to include the baseline, and the baseline
is placed at the specified value on the response axis.
Default 0
Interactions The value set by this option affects only the chart’s initial and final
bars. If no initial bar value is specified, then the first transaction bar is
drawn from 0, no matter what is set for the baseline value.
Note Label positions are automatically adjusted to prevent the labels from
overlapping.
Notes All of the COLORGROUP values for a specific category value must
be the same. Otherwise, the results are unpredictable.
All the transaction bars have only one fill and one outline color,
determined by the ODS style or set by the FILLATTRS= and
OUTLINEATTRS= options.
COLORMODEL=color-ramp-style-element | (color-list)
specifies a color ramp to use with the COLORRESPONSE= option.
color-ramp-style-element
specifies the name of a color-ramp style element. The style element should
contain these style attributes:
STARTCOLOR specifies the color for the smallest data value of the
COLORRESPONSE= column.
WATERFALLCHART Statement 861
NEUTRALCOLOR specifies the color for the midpoint of the range of the
COLORRESPONSE= column.
ENDCOLOR specifies the color for the highest data value of the
COLORRESPONSE= column.
(color-list)
specifies a space-separated list of colors to use in the color ramp. You can use
style attribute references such as GraphData3:Color, color names, or RGB,
CMYK, HLS, and HSV (HSB) color codes to specify a color. The list can
contain a mix of style attribute references, color names, and color codes.
Interactions For this option to take effect, the COLORRESPONSE= option must
also be specified.
Tip To manage the color of the initial bar, use the INITIALBARATTRS=
option. To manage the color of the final bar, use the
FINALBARATTRS= option.
Restriction This option affects only the fill colors. When only the bar outlines are
displayed, this option has no effect.
Interactions When the COLORGROUP= option is specified with this option, the
COLORGROUP= option is ignored.
COLORSTAT=SUM | MEAN
specifies the statistic to use for computing the response colors.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default SUM
Tip This option might affect existing SAS programs. For programs written
before the third maintenance release of SAS 9.4, if STAT= and
COLORRESPONSE= are specified in a WATERFALLCHART
statement, the chart colors and color statistic might change from the
previous SAS releases. To restore the original colors and color statistic
in that case, set COLORSTAT= in the WATERFALLCHART statement
to the same statistic that is specified in STAT=.
CONNECT=START | END
determines whether trend lines connect to the adjacent bar’s starting or ending value.
START
draws the trend lines horizontally and connects each to the adjacent bar’s starting
value. Each connecting line extends from the right corner of one bar’s ending
value to the left corner of the adjacent bar’s starting value.
END
draws the trend lines diagonally and connects each to the adjacent bar’s ending
value. Each connecting line extends from the right corner of one bar’s ending
value to the left corner of the adjacent bar’s ending value.
Default START
Restriction The last connect line is always drawn horizontally, extending from the
right corner of the last data bar’s ending value to the left corner of the
“final” bar’s starting value.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
WATERFALLCHART Statement 863
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Restriction Starting with the first maintenance release of SAS 9.4, the maximum
number of skinned graphical elements is limited to 200 per plot in an
overlay or prototype layout. When this limit is exceeded for a plot,
the specified data skin is not applied to that plot. In that case, use the
DATASKINMAX= option in your ODS GRAPHICS statement to
increase the maximum limit.
864 Chapter 6 • Plot Statements
Requirement For this option to have any effect, the fill must be enabled by the
ODS style or the DISPLAY= option.
When a data skin is applied, all bar outlines are set by the skin, and
the OUTLINEATTRS= option is ignored.
DATATRANSPARENCY=number
specifies the degree of the transparency of the bar fill, bar outline, bar labels, and
trend lines, if displayed.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the filled
bar area. The INITIALBARATTRS= and FINALBARATTRS= options can
be used to specify transparency for the initial and final bars. You can
combine this option with FILLATTRS=, INITIALBARATTRS=, and
FINALBARATTRS= to set one transparency for the bar outlines and trend
lines but a different transparency for the bar fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
Default STANDARD
Tip The DATATRANSPARENCY= option sets the transparency for the bar
fill, bar outline, and trend lines. You can combine this option with
DATATRANSPARENCY= to set one transparency for the bar outlines
and trend lines but a different transparency for the bar fills. Example:
datatransparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FILLTYPE=SOLID | GRADIENT
determines whether a solid or gradient fill is used in the bars.
Default SOLID
Tip The colors that are used depend on whether the COLORGROUP= option
or the COLORRESPONSE= option is also specified.
Interaction This option is ignored if the DISPLAY= option does not display the
“final” bar.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
FINALBARTICKVALUE="string"
specifies a tick value to use on the category axis when the “final” bar is displayed
Default "Final"
Interaction This option is ignored if the DISPLAY= option does not display the
“final” bar.
Interaction For this option to take effect, the INITIALBARVALUE= option must
also be specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
INITIALBARTICKVALUE="string"
specifies a tick value to use on the category axis when the “initial” bar is displayed.
Default "Initial"
Interaction For this option to take effect, the INITIALBARVALUE= option must
also be specified.
INITIALBARVALUE=number
specifies a value for the initial bar. The initial bar’s value is used as the starting
response value for the first transaction bar.
Interactions If this option is not specified, then the initial bar is not included in the
chart and the first transaction bar is drawn from response value 0. This
is true even if an intercept value is set by the
BASELINEINTERCEPT= option.
LEGENDLABEL="string"
specifies a label to be used in a discrete legend for this plot.
Default The response-variable label. If a label is not defined, then the response-
variable name is used.
NAME="string"
assigns a name to this plot statement for reference in other template statements. The
specified name is used primarily in legend statements to coordinate the use of colors
and line patterns between the plot and the legend.
Restriction The string is case sensitive, cannot contain spaces, and must define a
unique name within the template.
Interaction The string is used as the default legend label if the LEGENDLABEL=
option is not used.
Interactions For this option to have any effect, outlines must be enabled by the
ODS style or the DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the data tips.
This option provides a way to add to the data columns that appear in data tips that are
specified by the TIP= option.
(role-name-list)
a space-separated list of role-name = column pairs.
Example The following example assigns the column Obs to the user-defined
role TIP:
ROLENAME=(TIP1=OBS)
Requirement The role names that you choose must be unique and different from
the predefined roles CATEGORY, RESPONSE, COLORGROUP, and
COLORRESPONSE.
868 Chapter 6 • Plot Statements
STAT=SUM | MEAN
specifies the statistic to be computed for the RESPONSE axis.
Default SUM
Tip If you use this option with COLORRESPONSE= in SAS programs that
were written before the third maintenance release of SAS 9.4, the chart
colors and color statistic might change from the previous SAS releases. To
restore the original colors and color statistic in that case, set
COLORSTAT= in the WATERFALLCHART statement to the same statistic
that is specified in STAT=.
TIP=(role-list) | NONE
specifies the information to display when the cursor is positioned over a bar. If this
option is used, then it replaces all of the information that is displayed by default.
Roles for columns that do not contribute to the waterfall chart can be specified along
with roles that do.
(role-list)
an ordered, space-separated list of unique WATERFALLCHART and user-
defined roles. WATERFALLCHART roles include CATEGORY , RESPONSE ,
COLORGROUP , and COLORRESPONSE .
Example The following example displays data tips only for the column that is
assigned to the RESPONSE role:
TIP=(RESPONSE)
NONE
suppresses data tips and URLs (if requested) from the plot.
Default The columns assigned to these roles are automatically included in the
data tip information: CATEGORY and RESPONSE .
Requirement To enable data tips in the output, you must include an ODS
GRAPHICS ON statement that has the IMAGEMAP option
specified, and you must write the output to the ODS HTML
destination.
Tip The labels and formats for the TIP roles can be controlled with the
TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns. This option provides a way to control the
formats of columns that appear in data tips.
(role-format-list)
a space-separated list of role-name = format pairs.
Example TIP=(RESPONSE)
TIPFORMAT=(RESPONSE=DOLLAR12.)
WATERFALLCHART Statement 869
Default The column format of the column assigned to the role or BEST6 if no
format is assigned to a numeric column.
Restriction Only the roles that appear in the TIP= option are used.
TIPLABEL=(role-label-list)
specifies display labels for tip columns. This option provides a way to control the
labels of columns that appear in data tips.
role-label-list
a space-separated list of rolename ="string" pairs.
Example TIP=(RESPONSE)
TIPLABEL=(RESPONSE="Average Sales")
Default The column label or column name of the column assigned to the role.
Restriction Only the roles that appear in the TIP= option are used.
URL=string-column
specifies an HTML page to display when a bar is selected.
string-column
specifies a column that contains a valid HTML page reference (HREF) for each
bar that is to have an active link.
Example http://www.sas.com/technologies/analytics/
index.html
For grouped data, the values of the column are expected to be the
same for each unique RESPONSE and group combination.
Tips The URL value can be blank for some RESPONSE values, meaning
that no action is taken when the bars for those RESPONSE values
are selected.
870 Chapter 6 • Plot Statements
The URL value can be the same for different RESPONSE values,
meaning that the same action is taken when the bars for those
RESPONSE values are selected.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary
X2 (top) axis.
Default X
Interaction The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2
(right) axis.
Default Y
The overall plot specification and the layout type determine the axis
display. For more information, see “How Axis Features Are
Determined” on page 875.
Details
The input data for the WATERFALLCHART statement is raw, unsummarized input data,
and the statement calculates appropriate summarization statistics (sum or mean). By
default, the bars in the chart appear in the order in which the CATEGORY values are
present in the input data. A waterfall chart is typically used to show credit and debit
transactions or successive changes to a given state.
In a waterfall chart, the bars that are calculated from the data are called “transaction”
bars. The transaction bars represent the values of the RESPONSE variable across a
series of intermediate values for the specified CATEGORY variable. You can manage
the color of the transaction bars using the COLORGROUP , COLORMODEL , or
COLORRESPONSE= option.
A waterfall chart can also display an “initial” bar and a “final” bar. The value of the
initial bar determines the starting response value for the first transaction bar. To set the
initial value, use the INITIALBARVALUE= option. If the initial bar is not displayed,
then the first transaction bar has a starting response value of 0. The value of the final bar
is set automatically to the ending value of the last transaction bar.
The following graph was generated by the “Example Program” on page 871:
Example: WATERFALLCHART Statement 871
Example Program
data transactions;
input ID $ Amount type $;
datalines;
Alpha 2000 credit
Beta -2500 debit
Gamma -2000 debit
Delta -500 debit
Epsilon 2250 credit
;
proc template;
define statgraph waterfallchart;
begingraph;
layout overlay;
waterfallchart category=id response=amount /
colorgroup=type
initialbarvalue=1000
name="waterfall";
discretelegend "waterfall";
endlayout;
endgraph;
end;
run;
Part 5
Plot Axes
Chapter 7
Axis Features in Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
Chapter 8
Axis Options in Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
874
875
Chapter 7
Axis Features in Layouts
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
How Axis Features Are Determined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
Plot Data Are Mapped to a Designated Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876
When Plots Share Data and a Common Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880
Plot Axis Types Must Agree on Common Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
Controlling Axis Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
Setting the Axis Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884
Adjusting the Axis View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884
Adjusting Axis Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885
Adjusting Axis Offsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
Overview
GTL plots are specified within layout blocks that enable you to control the graph display
features, including the display of the axes for the plots within the layout. For example,
the LAYOUT OVERLAY statement has XAXISOPTS= and YAXISOPTS= options that
enable you to specify axis features for the plots within the layout.
The following sections explain how the axis features are determined in a layout. The
sections also discuss the issues that you must consider when setting the axis type or
adjusting the appearance of the axis display.
Overview
The GTL uses various criteria to determine the displayed axis features for a graph.
Generally, axis features are based on the following criteria:
• the layout type
• the order of plot statements in the layout and the options specified on those
statements
876 Chapter 7 • Axis Features in Layouts
• the use of primary and secondary axes on the plots (when secondary axes are
supported)
• the plot type
• the column or columns of data that contribute to defining the axis range
• the data formats for the contributing data columns
Because the default axis features depend on a combination of the factors above, it is
useful to understand how the axis features are determined in the templates that you
build:
• how the data are mapped to the plot axes
• how the various layout types manage the axes.
In this example, the first HISTOGRAM maps its Y-axis data to the Y2 axis, and the
second HISTOGRAM maps its Y-axis data to the Y axis. The DENSITY plot does not
explicitly map its Y-axis data, so the default Y axis is used. None of the plots explicitly
maps X-data, so the default X axis is used for all three plots. Thus, the GTL must
manage any interactions that result from representing multiple plots on the X and Y
axes. For example, on the X axis, it must determine an appropriate data range for
representing the data values of all three plots.
When establishing axis features for each axis, the GTL determines which plot
specifications map data to the axis. The GTL also collects the data for all of the plots
that must be represented and maps that data to the designated axis. “When Plots Share
Data and a Common Axis” on page 880 discusses the criteria the GTL uses to
determine the axis features for the axes after this mapping has been done for each axis.
For example, the following template uses a LAYOUT LATTICE to generate a grid that
displays a height analysis next to a weight analysis. By default in a LAYOUT LATTICE
statement, the options ROWDATARANGE= and ROW2DATARANGE= are set to
DATA. The DATA setting scales the Y-axis and Y2-axis data ranges separately for each
cell in the layout. To ensure that the Y-axis data range is the same in both cells, the
example specifies ROWDATARANGE=UNION. Similarly, to ensure that the Y2-axis
data range is the same in both cells, the example specifies
ROW2DATARANGE=UNION:
proc template;
define statgraph y2axis;
begingraph;
layout lattice / columns=2 columngutter=10
rowdatarange=union row2datarange=union ;
layout overlay;
histogram height / scale=count yaxis=y2;
histogram height / scale=percent yaxis=y;
densityplot height / normal();
endlayout;
layout overlay;
histogram weight / scale=count yaxis=y2;
histogram weight / scale=percent yaxis=y;
densityplot weight / normal();
endlayout;
endlayout;
endgraph;
end;
a separate measure from the weight, so the separate scales are appropriate for the X-axes
across cells. If the X-axes were displaying the same measure (for example, comparing
the height of female subjects to the height of male subjects), then you could specify
COLUMNDATARANGE=UNIONALL. This would set the same scaling to the X-axis
data ranges across the two layout columns. In this example you would not bother
changing the default COLUMN2DATARANGE= setting because the X2 axis is not
needed.
Note: For DATALATTICE and DATAPANEL statements, UNIONALL is the default
value for the data ranges. Thus, you would not have to change the data ranges unless
you wanted to set UNION to scale data ranges per row or per column in the layout.
In the example, scaling the data ranges across the row ensures proper axis scaling.
However, the graph display is cluttered by the duplicate display of ticks, axis values, and
axis labels on both the Y and Y2 axes. To simplify the display, you can consolidate the
axes. To do so, use a ROWAXES block to display a single Y axis for both cells, and a
ROW2AXES block to display a single Y2 axis for both cells. The consolidated view
removes the internal axes from the grid and displays only the external axes:
proc template;
define statgraph y2axis;
begingraph;
layout lattice / columns=2 columngutter=10
rowdatarange=union row2datarange=union;
rowaxes;
rowaxis / griddisplay=on;
endrowaxes;
row2axes;
rowaxis;
endrow2axes;
layout overlay;
histogram height / scale=count yaxis=y2;
histogram height / scale=percent yaxis=y;
densityplot height / normal();
endlayout;
layout overlay;
histogram weight / scale=count yaxis=y2;
histogram weight / scale=percent yaxis=y;
densityplot weight / normal();
endlayout;
endlayout;
endgraph;
end;
When using ROWAXES or ROW2AXES blocks in a LATTICE layout, you nest within
the block one ROWAXIS statement for each row in the layout grid. The ROWAXIS
statements are applied sequentially to the rows, and each ROWAXIS statement specifies
the axis options for the Y or Y2 axes in its corresponding row. ROWAXIS statements
within the ROWAXES block apply to the Y axes, and ROWAXIS statements within the
ROW2AXES block apply to the Y2 axes. This example has just a single row in the grid,
so each block specifies only one ROWAXIS statement. Notice that the ROWAXIS
statement in the ROW2AXES block does not use any options. Thus, it consolidates Y2
axes in the row into a single, external Y2 axis, but it does not alter the default features of
that axis. For columns in the grid, the LATTICE layout provides COLUMNAXES and
COLUMN2AXES blocks. These blocks use COLUMNAXIS statements to externalize X
and X2 axes and specify their features.
When you use DATALATTICE and DATAPANEL layouts, the layout dynamically
generates a grid that contains as many cells as can be produced from the combination of
classification values. In those layouts the axes are always external, and you can use the
COLUMNAXISOPTS=, COLUMN2AXISOPTS=, ROWAXISOPTS=, and
ROW2AXISOPTS= options to specify the features for the axes. The settings on each
option apply across the entire grid. For example, if you specify the ROWAXISOPTS=
option in a DATALATTICE layout, then the specified settings apply to the external Y
axes in every row.
Overview
If a layout block contains multiple plots that share data and a common axis, then the plot
settings often interact in ways that affect the axis features. Axis features include the axis
type, axis label, tick-mark layout, and so on. The GTL resolves these interactions in
ways that vary according to the layout block and plot statements.
Note: Axis interactions might not occur if other settings in the template prevent them.
As discussed in “Plot Data Are Mapped to a Designated Axis” on page 876, if two
How Axis Features Are Determined 881
plot statements are within an OVERLAY layout, then one of them might map its data
to the X axis and the other might map its data to the X2 (top) axis. Mapping to
separate axes can avoid the interactions that might occur if they both mapped their
data to the X axis.
• If no plot in an overlay-type layout is designated as primary, then the first plot that
generates an axis is considered primary on a per-axis basis.
• If PRIMARY=TRUE for a plot within an overlay-type layout, then that plot’s data
columns, data type, and plot 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, then the last one encountered is considered
primary.
The following SCATTERPLOT specifies a character column 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 label that is
assigned to column Name, or Name if no label is assigned to column Name.
Note: The SAS format on the primary plot’s column determines the axis format,
although the axis might not use that SAS format “as-is” from the column.
If a SCATTERPLOT’s X= argument specifies a column that has a SAS DATETIME
format, then the default X-axis type is TIME. The default X-axis label is the column
label or name of the DateTime column:
layout overlay;
scatterplot x=date ... / primary=true;
882 Chapter 7 • Axis Features in Layouts
...
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 category=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.
Overview
To enable you to control axis features within each of the layout types, there are different
sets of axis options for the different types of axes:
The options that are available for each layout are documented separately, but it is worth
discussing the following tasks in general for all of the layout types:
• Setting the Axis Type
• Adjusting the Axis View
• Adjusting Axis Thresholds
• Adjusting Axis Offsets
One or more of these options can be specified for an axis, but the specified settings are
applied only to the axis type that supports them.
For example, a bar chart has two axes – a TYPE=DISCRETE axis for the X axis and a
TYPE=LINEAR axis for the Y axis. If a numeric column (for example, Age) is assigned
to the X role, then this column’s values are always treated as discrete values, never as a
continuous range of values. You cannot request another axis type for the X axis, but you
can request a different axis type for the Y axis.
Sometimes you want a specialized axis type depending on the nature of the data. For
example, if the data have a very large range of values (orders of magnitude apart), then
you could request that the values be displayed on a logarithmic scale. To set a
logarithmic scale, use the TYPE=LOG axis option.
Time series data benefit from displaying the X axis with a TYPE=TIME axis. A TIME
axis type requires that the column values are SAS Date, Time, or Datetime values.
Three-dimensional plots such as BIHISTOGRAM3DPARM and SURFACEPLOTPARM
always use TYPE=LINEAR for X, Y, and Z axes.
Note: Certain plot types or layouts might impose restrictions on what type of axis can be
assigned. The documentation for each plot and layout type identifies any restrictions
that might apply to the axes.
default, the VIEWMIN= value is the minimum data value for the specified axis and the
VIEWMAX= value is the maximum data value for the specified axis.
A VIEWMIN= value that is greater than the data minimum or a VIEWMAX= value that
is less than the data maximum acts like a “zoom in” operation. The adjusted view
reduces the range of values represented on the axis and can sometimes exclude markers,
lines, or fills that would normally appear.
A VIEWMIN= value that is less than the data minimum or a VIEWMAX= value that is
greater than the data maximum acts like a “zoom out” operation. The adjusted view
extends the range of values represented on the axis and sometimes compresses the
markers, lines, or fills into a smaller area.
The following figure shows how the view settings can affect the tick and data displays.
This next figure shows how offset values might affect the discrete axis of a bar chart.
Controlling Axis Features 887
888 Chapter 7 • Axis Features in Layouts
889
Chapter 8
Axis Options in Layouts
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
Axis Options for LAYOUT OVERLAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
Axis Options for LAYOUT OVERLAY3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945
Axis Options for LAYOUT LATTICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963
Axis Options for LAYOUT OVERLAYEQUATED . . . . . . . . . . . . . . . . . . . . . . 1013
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL . . . . 1032
Dictionary
Syntax
Axis options for the plots within an OVERLAY layout are specified with the following
options on a LAYOUT OVERLAY statement:
XAXISOPTS=(axis-options)
YAXISOPTS=(axis-options)
X2AXISOPTS=(axis-options)
Y2AXISOPTS=(axis-options)
document the axis options that are available only for specific axis types: discrete, linear,
log, or time axes. The following table provides a summary of the options.
DISCRETEOPTS=(discrete-axis-options)
specifies one or more options for a discrete axis. Options must be enclosed in
parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Discrete Axes Only” on page 903 for the options that
you can use for discrete-axis-options.
TICKVALUES displays the values that are represented by the major tick
marks
Default STANDARD
Tips The default line attributes for the axis line and axis tick marks are defined
in the GraphAxisLine style element.
Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis grid
lines.
When LINE is excluded from the DISPLAY= option, the layout wall
outline or the default baseline of a bar chart, needle plot, or waterfall chart
can appear to be an axis line. To suppress the wall outline, use the
WALLDISPLAY= option in the layout statement. To suppress the plot
baseline, use the BASELINEATTRS= option in the plot statement.
Default NONE
Restriction If some plot statements set XAXIS=X and others set XAXIS=X2, both
the X and X2 axis are primary and a secondary X axis cannot be
displayed. In that case, this option is ignored. The same applies for the
Y axes.
Tip Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis
grid lines.
Axis Options for LAYOUT OVERLAY 893
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tip On a log axis, this option affects the appearance of the major grid lines
only. It does not affect the appearance of the minor grid lines. To
control the appearance of the minor grid lines on a log axis, use the
MINORGRIDATTRS= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
AUTO_OFF AUTO no
AUTO_OFF ON yes
AUTO_OFF OFF no
AUTO_ON ON yes
AUTO_ON OFF no
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
Default AUTO_OFF
Note Supplied styles use DisplayOpts="AUTO," which means that the style has
no preference about grid lines and the graphics template setting for grid
lines is always used.
Default The default label is derived from the primary plot in the layout. For
more information, see “When Plots Share Data and a Common Axis”
on page 880.
Note If the axis label is too long to fit along the axis, then it is truncated by
default.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
that does not fit the available space even after splitting might overlap the
adjoining space.
SPLITALWAYS
always split the axis label at every occurrence of a split character, which is
specified by the LABELSPLITCHAR= option. If the label cannot be split, then it
is clipped.
Default AUTO
Restriction These options are valid for the Y and Y2 axes only.
Note When TOP or BOTTOM is used, the label might collide with other
graphical features.
LEFT | RIGHT
positions the label to the left or right of the axis area. The label is centered
vertically in the axis area.
Restriction These options are valid for the X and X2 axes only.
896 Chapter 8 • Axis Options in Layouts
Note When LEFT or RIGHT is used, the label might collide with other
graphical features.
The following figure shows the CENTER and DATACENTER positions for a blue Y
axis label Type and a red X axis label MPG.
In this example, an axis offset is applied to the maximum end of both axes in order to
demonstrate the difference between CENTER and DATACENTER. CENTER
centers the labels on the entire axis area, including the offset. DATACENTER
centers the labels on the tick display areas, which does not include the offset.
The next figure shows the TOP and LEFT positions, and the BOTTOM and RIGHT
positions for the same axis labels.
Default CENTER
Restriction This option does not support collision avoidance. In some cases, axis
label collisions can occur in the axis area.
See SHORTLABEL= on page 900 for information about how short labels
are used.
LABELSPLITCHAR="character-list"
specifies one or more characters on which the axis labels can be split, if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
axis label. In that case, all of the specified split characters together are treated as a
single split character.
Axis Options for LAYOUT OVERLAY 897
When LABELFITPOLICY=SPLIT, if the axis label does not fit the available space,
then it is split on a specified split character only if a split is needed at that point to
make the label fit. In this case, a split might not occur on every split character. When
LABELFITPOLICY=SPLITALWAYS, the axis label is split unconditionally on
every occurrence of a split character. If the axis label does not contain any of the
specified split characters, the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
LABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed axis labels.
TRUE
drops the split characters from the axis label display.
FALSE
includes the split characters in the axis label display. When
LABELSPLIT=TRUE and LABELSPLITCHARDROP=FALSE, each split
character remains as the last character in the current line. The characters that
follow the split character, up to and including the next split character, are then
wrapped to the next line.
Default TRUE. The split characters are dropped from the axis label.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABELSPLITJUSTIFY=justification
specifies the justification of the strings that are inside the axis label blocks.
justification
CENTER | LEFT | RIGHT
specifies the justification for the X or X2 axis label.
CENTER | TOP | BOTTOM
specifies the justification for the Y or Y2 axis label.
Default CENTER
LINEAROPTS=(linear-axis-options)
specifies one or more options for a numeric interval axis. Options must be enclosed
in parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Linear Axes Only” on page 912 for the options that you
can use for linear-axis-options.
Range 0–1
Tip A numeric value is useful for bar charts when DATA terminates the axis
line at the midpoint positions of the minimum and maximum bars. In
that case, you can specify a numeric value to lengthen the axis line so
that it extends to the full width of both bars.
Axis Options for LAYOUT OVERLAY 899
The following figure shows a simple example of each value for the X and Y axis lines.
The light-blue dashed lines depict the minimum and maximum offsets that are set on the
axes.
Default FULL
Tip The graph wall outline might appear to be an axis line. In that case, use
the WALLDISPLAY=NONE or WALLDISPLAY=(FILL) option in the
layout statement to suppress the wall outline.
LOGOPTS=(log-axis-options)
specifies one or more options for a log axis. Options must be enclosed in
parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Log Axes Only” on page 925 for the options that you
can use for log-axis-options.
NAME="string"
assigns a name to an axis for reference in other statements. Currently, it is used only
in an AXISLEGEND statement.
Interactions This option is ignored unless the axis is discrete. The axis can be
discrete by default, or explicitly set to discrete with a TYPE=
DISCRETE setting.
AUTOCOMPRESS
applies an automatic offset that prevents axis labels and tick values from
extending beyond the axis length.
number
specifies the offset as a decimal proportion of the full axis length.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
REVERSE=TRUE | FALSE
specifies whether tick values should appear in the reverse order.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SHORTLABEL="string"
specifies an alternate axis label to display when the default label or the label
specified by the LABEL= option is too long to fit the available space.
When LABELPOSITION=CENTER (default), the available space for an axis label is
the full axis, including the axis offsets. When LABELPOSITION=DATACENTER,
the available space for an axis label is the axis tick display area, which excludes the
axis offsets. If the label length exceeds the available space, then the label is anchored
at the left or bottom offset. It extends beyond the opposing offset until it reaches the
end of the axis where it is truncated. An ellipsis designates the truncation.
This option has effect only when the LABELPOSITION= option is set
to CENTER or DATACENTER.
Axis Options for LAYOUT OVERLAY 901
Note If the specified label is itself too long for the axis, it is truncated in the
display.
Notes This option has no affect on the placement of the tick values, which are
always outside the axis frame.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TIMEOPTS=(time-axis-options)
specifies one or more options for a time axis.
Requirements Columns associated with a time axis must be in SAS time, SAS
date, or SAS datetime units and have an associated SAS time, date,
or datetime format.
See “Options for Time Axes Only” on page 934 for the options that
you can use for time-axis-options.
Axis Options for LAYOUT OVERLAY 903
Interaction If a log axis is requested and the axis data contains 0 or negative
values, the axis reverts to a linear axis. This outcome can occur for
the response axis of a bar chart, line chart, needle plot, or waterfall
chart when a baseline intercept of 0 or less is specified. It can also
occur for the response axis of a waterfall chart when an initial bar
value of 0 or less is specified. To get a log response axis in those
cases, set the baseline intercept or initial bar value to a positive
value.
Default AUTO
Interactions If this option is set to anything other than AUTO, then plots within the
layout are dropped from the display if their data types or data ranges
do not match the axis type requirements. For more information, see
“Plot Axis Types Must Agree on Common Axes” on page 883.
After the axis type is determined (whether you set a specific type or
AUTO is in effect), you can use only options that are supported by
that axis type. For example, if TYPE=TIME, then only the general
OVERLAY axis options and those available on TIMEOPTS= are
supported.
Default NONE
Interaction Specifying this option for more than one axis in the layout might have
unexpected results. The order in which color bands are drawn might
not match the order in which the axis options are specified.
Note The full width of a color band is the distance between midpoints. When
no axis offsets are specified, the first band begins at one-half of the
midpoint distance, and the last band ends at one-half of the midpoint
distance. When axis offsets are specified, the first and last color bands
on the axis might extend into their adjacent offsets by as much as half
the color-band width.
Tips Borders for the color bands can be added by setting TICKTYPE=
INBETWEEN in the DISCRETEOPTS= option, and by setting
GRIDDISPLAY= ON.
Axis Options for LAYOUT OVERLAY 905
Because alternating color bands are drawn on top of the plot wall, this
option can be coordinated with the LAYOUT OVERLAY statement’s
WALLCOLOR= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
Example The following example specifies the axis tick values 10, 20, 30, and
40, and the tick display values A, B, C, and D:
tickvaluelist=("10" "20" "30" "40");
tickdisplaylist=("A" "B" "C" "D");
TICKTYPE=MIDPOINT | INBETWEEN
specifies the position of the axis tick marks.
Default MIDPOINT
Note Starting with the second maintenance release of SAS 9.4, when
TICKTYPE=INBETWEEN, the outermost tick marks and grid lines at
each end of the axis are not drawn.
906 Chapter 8 • Axis Options in Layouts
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
EXTRACT
displays consecutive integers along the axis instead of the actual tick values in
order to represent those tick values. In most cases, this policy is implemented if
the system estimates that a collision might occur. If no collision occurs, then the
actual tick values are displayed on the axis in the normal manner.
EXTRACTALWAYS
same as EXTRACT, except that the extraction is implemented regardless of
whether collision occurs.
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
SPLIT
splits the tick value at a split character, which is specified by the
TICKVALUESPLITCHAR= option, only when necessary in order to make the
value fit the available space. A split does not occur at a split character if a split is
not needed at that location. If the value does not contain any of the specified split
characters, then the value is not split. Values that are not split or that do not fit the
available space even after splitting might overlap the adjoining space.
See TICKVALUESPLITCHAR=
SPLITALWAYS
always splits the axis tick value at every occurrence of a split character that is
specified by the TICKVALUESPLITCHAR= option.
See TICKVALUESPLITCHAR=
SPLITALWAYSTHIN
same as SPLITALWAYS, except that thinning is performed when long words do
not fit the available space.
SPLITTHIN
same as SPLIT, except that thinning is performed when long words do not fit the
available space.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
Axis Options for LAYOUT OVERLAY 907
EXTRACT
display consecutive integers along the axis instead of the actual tick values to
represent those tick values. In most cases, this policy is implemented if the
system estimates that a collision might occur. If no collision occurs, then the
actual tick values are displayed on the axis in the normal manner.
EXTRACTALWAYS
same as EXTRACT, except that the extraction is implemented regardless of
whether collision occurs.
NONE
does not attempt to fit tick values that collide.
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATEALWAYSDROP
attempts the ROTATEALWAYS policy, and then drops the tick values if
collisions still occur.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
SPLIT
splits the tick value at a split character, which is specified by the
TICKVALUESPLITCHAR= option, only when necessary in order to make the
value fit the available space. A split does not occur at a split character if a split is
not needed at that location. If the value does not contain any of the specified split
characters, then the value is not split. Values that are not split or that do not fit the
available space even after splitting might overlap the adjoining space.
See TICKVALUESPLITCHAR=
SPLITALWAYS
always splits the axis tick value at every occurrence of a split character that is
specified by the TICKVALUESPLITCHAR= option.
See TICKVALUESPLITCHAR=
908 Chapter 8 • Axis Options in Layouts
SPLITROTATE
attempts the SPLIT policy, and then the ROTATE policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
STAGGERTRUNCATE
attempts the STAGGER policy, and then the TRUNCATE policy.
THIN
eliminates alternate tick values.
TRUNCATE
shortens the tick values when they exceed a certain number of characters.
TRUNCATEROTATE
attempts the TRUNCATE policy, and then the ROTATE policy.
TRUNCATESTAGGER
attempts the TRUNCATE policy, and then the STAGGER policy.
TRUNCATETHIN
attempts the TRUNCATE policy, and then the THIN policy.
Note A note is written to the SAS log when tick value thinning occurs.
TICKVALUEFORMAT=format
specifies how to format the values for major tick marks.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Interaction This option is ignored when the axis tick values are extracted to an
axis legend. See TICKVALUEFITPOLICY=EXTRACT |
EXTRACTALWAYS on page 906.
Tip Use this option when you want to duplicate tick values on an axis.
TICKVALUELIST=(string-list)
specifies the list of tick values that are to be displayed on the axis.
string-list
a space-separated list of values, enclosed in parentheses. You must enclose each
value in the list in quotation marks.
Only the tick values that are included in the string list are displayed on the axis. The
values are displayed in the order in which they are listed. The data values that are not
in the list are dropped. The list can be a subset of the data values. It can also contain
Axis Options for LAYOUT OVERLAY 909
values that are not included in the actual data. A tick value that is not included in the
data appears on the axis, but no data is represented at its tick mark.
Notes If the string list contains duplicate values, then the first occurrence
of the duplicated value in the list is honored and the remaining
instances are ignored.
When the values specified in the list are compared with the actual
data values, leading blanks are honored and trailing blanks are
ignored.
Tips You can use this option to subset the axis values or to display the
values in a specific order.
You can use this option to display values on the axis that are not
contained in the data.
Examples The following example specifies the axis tick values Sedan, Sports,
Wagon, and SUV:
tickvaluelist=("Sedan" "Sports" "Wagon" "SUV")
The following example specifies the axis tick values 10, 20, 30, and
40:
tickvaluelist=("10" "20" "30" "40")
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
TICKVALUESPLITCHAR="character-list"
specifies a list of characters on which the tick values can be split, if needed. When
multiple characters are specified, each character in the list is treated as a separate
split character unless the specified characters appear consecutively in the tick value.
In that case, all of the specified split characters together are treated as a single split
character.
When TICKVALUESPLITPOLICY=SPLIT, if a tick value collision is detected, then
the tick value is split on a split character only if necessary at that point in order to
avoid collision. In that case, a split might not occur on every split character. When
TICKVALUEFITPOLICY=SPLITALWAYS, the tick value is split unconditionally
910 Chapter 8 • Axis Options in Layouts
on every occurrence of a split character. If the tick value does not contain any of the
specified split characters, then it is not split.
"character-list"
one or more characters with no delimiter between each character.
TICKVALUESPLITCHARDROP=TRUE | FALSE
specifies whether the split characters should be included in the displayed tick values.
The split characters are specified by the TICKVALUESPLITCHAR= option.
TRUE
drops the split characters from the tick value display. The following figure shows
an example in which TICKVALUESPLITCHARDROP=TRUE and three-word,
asterisk-delimited tick values are split on the asterisk character by using the
SPLITALWAYS policy.
Axis Options for LAYOUT OVERLAY 911
Notice that a split occurs on the first asterisk and not at the second. In this case, a
split is not needed at the second asterisk.
If the fit policy is SPLITALWAYS or SPLITALWAYSTHIN, and
TICKVALUESPLITCHARDROP=FALSE, then each tick value is split at every
instance of a split character in the value regardless of whether a split is actually
needed. Each split character remains as the last character in the current line. The
characters that follow each split character, up to and including the next split
character, are then wrapped to the next line. The following figure shows an
example in which TICKVALUESPLITCHARDROP=FALSE and three-word,
asterisk-delimited tick values are split on the asterisk character by using the
SPLITALWAYS policy.
Notice that a split occurs after each asterisk and each asterisk appears at the end
of the line. In this case, three lines are displayed.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
The following figure shows a linear axis, broken into ranges 50–52 and 56–73.
As shown in the figure, break lines are drawn to indicate the break in the axis.
Restrictions This option is valid for linear and time axes in an OVERLAY layout
only.
Only one axis can be broken. If this option is specified for both
axes, then it is honored for the vertical axis and ignored for the
horizontal axis.
When plots are associated with the X and X2 axes or with Y and Y2
axes, neither axis can be broken.
When this option is specified, the plot statement TIP= and URL=
options are ignored.
Axis Options for LAYOUT OVERLAY 915
Notes When this option is specified, data-clipping might occur for the
following: plot markers and marker characters, box-plot outlier
markers, fixed-position data labels, needle plots and fringe plots in
the X direction, reference lines and drop lines on the broken axis,
axis tables, and relative bubble plots.
Curve label positions are based on the contiguous axis data range.
When curve labels are specified with a broken axis, the curve label
positions might not be ideal.
Tip Starting with the third maintenance release of SAS 9.4, you can use
the AXISBREAKTYPE= and AXISBREAKSYMBOL= options in
the BEGINGRAPH statement to display the break in the axis as
only a symbol on the axis line.
INTEGER=TRUE | FALSE
specifies that evenly spaced integer values are used for tick marks.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
916 Chapter 8 • Axis Options in Layouts
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
Axis Options for LAYOUT OVERLAY 917
Defaults Four ticks with five intervals in the first maintenance release of SAS
9.4 and earlier releases.
One tick with two intervals starting with the second maintenance
release of SAS 9.4.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORIGIN=number
specifies that the axis perpendicular to the current axis is drawn at the indicated data
value.
For managing origin settings, the GTL treats the X and Y axes as a pair, and the X2
and Y2 axes as a separate pair. Thus, if you set the Y-axis origin to 200, then the X
axis is drawn from that origin point. If the graph also displays an X2 axis, then it is
unaffected and does not move. Similarly, if you set an origin for the Y2 axis, then the
X2 axis moves to that origin point and the X axis is unaffected.
If you set an origin for the Y2 axis and there is no X2 axis, then the origin setting for
Y2 does not affect the graph display. That is, the X axis does not move to that origin
point.
If you set an origin for an axis and the axis has a tick value at that origin value, the
tick value is not displayed. Suppressing the tick value at the origin prevents the value
from colliding with the axis value on the perpendicular axis. However, it is possible
that the tick values on the orthogonal axes will collide.
Default The axis perpendicular to the current axis is drawn at the minimum
tick value minus the OFFSETMIN= value.
Interactions If the specified value is outside the data range for the current axis, then
the data range is extended to include the value.
918 Chapter 8 • Axis Options in Layouts
The axis line, ticks, and tick values of the “perpendicular” axis move
to the location indicated by the origin. The axis label is not moved.
Tip This option is often used to create Cartesian axes (axes centered at
ORIGIN=0).
THRESHOLDMAX=number
specifies a bias for including one more tick mark at the maximum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
THRESHOLDMIN=number
specifies a bias for including one more tick mark at the minimum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
920 Chapter 8 • Axis Options in Layouts
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
THIN
eliminates alternate tick values.
Default THIN
Note A note is written to the SAS log when tick value thinning occurs.
Default 8
MAXDECIMALS=integer
specifies the maximum number of decimals for displayed tick values. Values
might be rounded or converted to E notation to fit into this width.
Default 6
PREFERREDDECIMALS=integer
specifies the number of decimal places that you want to display for most
values. The actual number might vary based on other constraints.
Default 2
EXTRACTSCALE=TRUE | FALSE
specifies whether to extract a scale factor from the tick values and use it to
reduce the tick value width. The scale can be a named scale or a scientific-
notation scale. The EXTRACTSCALETYPE= option specifies the scale type.
The scale that is used is appended to the axis label, as shown in the following
example.
Total Sales (millions)
For long axis labels, if the scale does not fit the available space, then the label
is truncated, and the scale is appended to the truncated label. Ellipses indicate
that the label was truncated, as shown in the following example.
Total Sales for the Fourth Quarter Of ... (millions)
In extreme cases in which the scale does not fit even with truncation, the
entire axis is dropped.
Default FALSE
Axis Options for LAYOUT OVERLAY 921
See “boolean ” on page 1339 for other Boolean values that you
can use.
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
specifies whether to extract a named scale or a scientific-notation scale.
DEFAULT
extracts a named scale. A named scale can be millions, billions, or
trillions for values of 999 trillion or less, or a multiple of 10 (denoted as
10^n) for values over 999 trillion. For large tick values, the scale factor is
set to ensure that the absolute value of the largest value is greater than 1.
For small fractional tick values, the scale factor is set to ensure that the
absolute value of the smallest value is greater than 1. The scale can be
millionth, billionth, or trillionth for values of 1 trillionth or more, or a
multiple of 1/10 (10^–n) for values less than 1 trillionth.
SCIENTIFIC
extracts a scientific-notation scale. A scientific-notation scale is a
multiple of 10 expressed as 10^n for values greater than 1, or a multiple
of 1/10 expressed as 10^–n for values less than 1.
Default DEFAULT
Restriction The scale is derived from the English locale for all locales.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are the tick values in numeric-list that fall
within the explicit data range (set by VIEWMIN= and VIEWMAX=)
or the implicit data range (set by the actual data minimum and data
maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the minimum tick list value and
the VIEWMAX= option is set to the maximum tick list value, then all
ticks in the tick list are displayed. This might result in some data not
being displayed. For example, data might not be displayed when the
VIEWMIN= value is greater than the actual data minimum, or when
the VIEWMAX= value is less than actual data maximum.
Tip The values in the list are formatted according to the setting for the
TICKVALUEFORMAT= option.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether an axis tick specification (TICKVALUELIST= or
TICKVALUESEQUENCE=) can extend the axis data range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by either the TICKVALUELIST= or
TICKVALUESEQUENCE= option. If the minimum and maximum of the user-
specified values are within the data range, this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
Axis Options for LAYOUT OVERLAY 923
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
TICKVALUESEQUENCE=(sequence-options)
specifies the tick values by start, end, and increment.
(sequence-options)
a space-separated list of the following name-value-pair options that control major
tick values. You must provide all three options.
START=number
specifies the value for the first tick mark.
END=number
specifies the value for the last tick mark.
INCREMENT=number
specifies the increment for intermediate tick marks between the first and last
tick marks. The END value always controls the last tick mark. The interval
between the last tick mark and the previous tick mark might not necessarily
be the INCREMENT value.
924 Chapter 8 • Axis Options in Layouts
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are those that fall within the explicit data range
(set by VIEWMIN= and VIEWMAX=) or the implicit data range (set
by the actual data minimum and data maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the START= option value and the
VIEWMAX= option is set to the END= option value, then all ticks in
the tick sequence are displayed.
Tip The values in the sequence are formatted according to the setting for
the TICKVALUEFORMAT= option.
VIEWMAX=number
specifies the maximum data value to include in the display. The value might be
adjusted by the threshold calculation.
Default The maximum value in the data for the specified axis.
Interactions This option does not determine the maximum axis tick value that is
displayed. The THRESHOLDMAX= value is used to determine the
maximum tick value.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display. The value might be
adjusted by the threshold calculation.
Axis Options for LAYOUT OVERLAY 925
Default The minimum value in the data for the specified axis.
Interactions This option does not determine the minimum axis tick value that is
displayed. The THRESHOLDMIN= value is used to determine the
minimum tick value.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
BASE=10 | 2 | E
specifies the base of the logarithmic scale for the axis values.
Default 10
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
Axis Options for LAYOUT OVERLAY 927
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
THRESHOLDMAX=number
specifies a bias for including one more tick mark at the maximum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
THRESHOLDMIN=number
specifies a bias for including one more tick mark at the minimum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
Base=10
Base=2
Base=E
LOGEXPONENT
places the major tick marks at uniform intervals at integer powers of the base.
The tick values are only the integer exponents for all bases.
LINEAR
places the major tick marks at non-uniform intervals that cover the range of the
data.
Default AUTO
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
930 Chapter 8 • Axis Options in Layouts
TICKVALUEFORMAT=DATA | format
specifies how to format the values for major tick marks.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
See BASE=
TICKINTERVALSTYLE=
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Default Only the tick values specified in the list that fall within the explicit
data range set by the VIEWMIN= and VIEWMAX= options or by
the implicit data range set by the actual data minimum and data
maximum are displayed. An internal algorithm determines the tick
marks.
Interactions The VALUESTYPE= option determines how the values in the list
are interpreted.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether the TICKVALUELIST= specification can extend the axis data
range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by the TICKVALUELIST= option. If the
minimum and maximum of the user-specified values are within the data range,
this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
VALUESTYPE=EXPANDED | EXPONENT
specifies the scale that the system uses when interpreting the TICKVALUELIST=,
VIEWMAX=, and VIEWMIN= option values. Use this option to choose your
preferred way of specifying log-axis values.
EXPANDED values are interpreted as powers of the base such as 0.1, 1, 10,
100, and so on, for base 10, for example.
EXPONENT values are interpreted as integer exponents of the base such as 1,
2, 3, and so on, for base 10, base 2, and base E.
Default EXPANDED
Note This option does not change the style of the tick values that are
displayed on the axis. It changes only how the VIEWMIN=,
VIEWMAX=, and TICKVALUELIST= option values are interpreted by
the system.
VIEWMAX=number
specifies the maximum data value to include in the display.
Default The maximum value in the data for the specified axis.
Requirement The value that you specify must be appropriate for the
VALUESTYPE= specification and the log base. Otherwise,
unexpected results might occur. If VALUESTYPE=EXPANDED is in
effect (default), specify an increment of the log base power such as
Axis Options for LAYOUT OVERLAY 933
0.1, 1, 10, 100, and so on, on a base 10 log axis, for example. If
VALUESTYPE=EXPONENT is in effect, specify an integer
increment of the log base power exponent such as 1, 2, 3, and so on.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use
the TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display.
Default The minimum value in the data for the specified axis.
Requirement The value that you specify must be appropriate for the
VALUESTYPE= specification and the log base. Otherwise,
unexpected results might occur. If VALUESTYPE=EXPANDED is in
effect (default), specify an increment of the log base power such as
0.1, 1, 10, 100, and so on, on a base 10 log axis, for example. If
VALUESTYPE=EXPONENT is in effect, specify an integer
increment of the log base power exponent such as 1, 2, 3, and so on.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
The following figure shows a time axis, broken into ranges '01Jan2001'd–'01May2003'd
and '01Jan2005'd–'01Oct2005'd.
As shown in the figure, break lines are drawn to indicate the break in the axis.
Restrictions This option is valid for linear and time axes in an OVERLAY layout only.
Only one axis can be broken. If this option is specified for both axes, then it is
honored for the vertical axis and ignored for the horizontal axis.
When plots are associated with the X and X2 axes or with Y and Y2 axes,
neither axis can be broken.
A broken axis is not supported in vector graphics output. When a broken axis
is specified and vector graphics output is requested, the graph is converted
into an image instead. A note indicating the conversion is written to the SAS
log. To restore the vector graphics output in that case, remove the
INCLUDERANGES= option from the LINEAROPTS= or TIMEOPTS=
option.
You must specify each range as a starting value, a hyphen, and an ending
value. You must separate adjacent ranges with a space.
When this option is specified, the plot statement TIP= and URL= options are
ignored.
Notes When this option is specified, data-clipping might occur for the following:
plot markers and marker characters, box-plot outlier markers, fixed-position
Axis Options for LAYOUT OVERLAY 937
data labels, needle plots and fringe plots in the X direction, reference lines and
drop lines on the broken axis, axis tables, and relative bubble plots.
Curve label positions are based on the contiguous axis data range. When curve
labels are specified with a broken axis, the curve label positions might not be
ideal.
Tip Starting with the third maintenance release of SAS 9.4, you can use the
AXISBREAKTYPE= and AXISBREAKSYMBOL= options in the
BEGINGRAPH statement to display the break in the axis as only a symbol on
the axis line.
See “Creating a Broken Time Axis” in SAS Graph Template Language: User's
Guide
INTERVAL=interval
specifies the time interval between major ticks. Valid interval keywords are AUTO,
SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,
QUARTER, SEMIYEAR, YEAR.
Table 8.1 Time Intervals
Default AUTO. An appropriate interval is chosen based on the data and the
column date, date-time, or time format.
Requirement The data column(s) mapped to a time axis must be in the same
duration units: TIME, DATE, or DATETIME. The selection of an
interval must be consistent with the duration unit. For example, if the
data are in time units, you can specify only AUTO, SECOND,
MINUTE, HOUR.
INTERVALMULTIPLIER=positive-integer
specifies a multiplier to apply to the time interval that is in effect for the axis.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default 1
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Axis Options for LAYOUT OVERLAY 939
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKINTERVAL=interval
specifies the time interval between minor ticks. See Table 8.1 on page 937 for
information about the intervals that you can select. The interval that you select must
be consistent with the axis data duration units such as TIME, DATE, or DATETIME.
For example, if the axis data is in TIME units, then you must specify AUTO,
SECOND, MINUTE, or HOUR.
Default AUTO
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
SPLITTICKVALUE=TRUE | FALSE
specifies whether to split the tick values on an X or X2 axis, if possible. This option
is not available for a Y or Y2 axis.
Axis Options for LAYOUT OVERLAY 941
TRUE
splits the axis tick values into two lines allowing more tick values to appear. For
example, with INTERVAL= MONTH, this is how tick values are split:
FALSE
does not split the axis tick values. For example, when this option specifies
FALSE, this is how the tick values in the previous example appear:
Typically, fewer tick values fit, causing thinning, rotation, or staggering of the
values. See the TICKVALUEFITPOLICY= option.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an X or X2 axis. This option is
not available for the Y and Y2 axes. The effectiveness of a collision-avoidance
policy depends on the number of tick values, their length, and the length of the axis.
The following policies are valid:
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
942 Chapter 8 • Axis Options in Layouts
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
THIN
eliminates alternate tick values.
Default THIN
Interaction When SPLITTICKVALUE= TRUE, this option is ignored and only the
THIN policy is used.
Note A note is written to the SAS log when tick value thinning occurs.
TICKVALUEFORMAT=format | DATA
specifies how to format the values for major tick marks.
format
specifies a SAS date, time, or datetime format to control how the major tick
values are displayed. This format must be in the same duration units as the data
column(s) mapped to a time axis: TIME, DATE, or DATETIME and should be
appropriate for the value of the INTERVAL= option. For example, if
INTERVAL=MONTH and there are two years of data displayed on the axis, then
choosing TICKVALUEFORMAT=YEAR. would result in several ticks having
the same year value.
DATA
specifies that the SAS date, time, or datetime format associated with the data
column assigned to the axis be used to control how the major tick values are
displayed.
Default The default format used by the INTERVAL= option. The default does
not apply if TICKVALUELIST= is specified.
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
Interactions The values in the list are formatted according to the format specified
on the TICKVALUEFORMAT= option. If TICKVALUEFORMAT=
is not used, then the values are formatted according to the column
format (the default TICKVALUEFORMAT value is not applied to
these values).
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether the TICKVALUELIST= specification can extend the axis data
range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by the TICKVALUELIST= option. If the
minimum and maximum of the user-specified values are within the data range,
this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
944 Chapter 8 • Axis Options in Layouts
VIEWMAX=number
specifies the maximum data value to include in the display.
Default The maximum value in the data for the specified axis.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display.
Default The minimum value in the data for the specified axis.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
Details
The LAYOUT OVERLAY statement provides the XAXISOPTS=, YAXISOPTS=,
X2AXISOPTS=, Y2AXISOPTS= options that enable you to manage the axis display
separately for the X, Y, X2, and Y2 axes. The following example template uses the
YAXISOPTS= option to manage the grid lines, tick marks, and tick values on a Y axis:
Axis Options for LAYOUT OVERLAY3D 945
begingraph;
layout overlay /
yaxisopts=(
griddisplay=on
display=(ticks tickvalues)
);
seriesplot x=month y=predict;
endlayout;
endgraph;
Within an OVERLAY layout block, each plot axis is always of a particular type. In the
default cases, the axis type is always DISCRETE, LINEAR, or TIME. The TYPE=
option enables you to specify an axis type that overrides the default. For example, when
appropriate for the data, you can request a LOG axis. When you override the default axis
type, you must be sure to specify the correct axis type for the plot(s) that you are
defining.
Each axis type has features specific to that type, and the following axis options enable
you to specify features for the different types: DISCRETEOPTS= , LINEAROPTS= ,
LOGOPTS= , and TIMEOPTS= . One or more of these options can be specified for an
axis, but the specified settings are applied only to the axis type that supports them.
Syntax
Axis options for the plots within an OVERLAY3D layout are specified with the
following options on a LAYOUT OVERLAY3D statement:
XAXISOPTS=(axis-options)
YAXISOPTS=(axis-options)
ZAXISOPTS=(axis-options)
Default STANDARD
Tips The default line attributes for the axis line and axis tick marks are defined
in the GraphAxisLine style element.
Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis grid
lines.
Axis Options for LAYOUT OVERLAY3D 947
When LINE is excluded from the DISPLAY= option, the layout wall
outline or the default baseline of a bar chart, needle plot, or waterfall chart
can appear to be an axis line. To suppress the wall outline, use the
WALLDISPLAY= option in the layout statement. To suppress the plot
baseline, use the BASELINEATTRS= option in the plot statement.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
AUTO_OFF AUTO no
AUTO_OFF ON yes
AUTO_OFF OFF no
AUTO_ON ON yes
AUTO_ON OFF no
948 Chapter 8 • Axis Options in Layouts
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
Default AUTO_OFF
Note Supplied styles use DisplayOpts="AUTO," which means that the style has
no preference about grid lines and the graphics template setting for grid
lines is always used.
Default The default label is derived from the primary plot in the layout. For
more information, see “When Plots Share Data and a Common Axis”
on page 880.
Interaction This option is ignored if the DISPLAY= option does not display the
axis label.
Note If the axis label is too long to fit along the axis, then it is truncated by
default.
Interaction This option is ignored if the DISPLAY= option does not display the
axis label.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LINEAROPTS=(linear-axis-options)
specifies one or more options for a numeric interval axis. Options must be enclosed
in parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Linear Axes Only” on page 950 for the options that you
can use for linear-axis-options.
OFFSETMAX=AUTO | number
reserves an area at the maximum end of the axis. No tick marks are displayed in the
reserved area.
Axis Options for LAYOUT OVERLAY3D 949
AUTO
reserves just enough area to fully display markers and other graphical features
near the maximum end of an axis.
number
specifies the offset as a decimal proportion of the full axis length. For a
continuous axis, the offset follows the highest data value or highest tick value,
whichever is greater.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
OFFSETMIN=AUTO | number
reserves an area at the minimum end of the axis. No tick marks are displayed in the
reserved area.
AUTO
reserves just enough area to fully display markers and other graphical features
near the minimum end of an axis.
number
specifies the offset as a decimal proportion of the full axis length. For a
continuous axis, the offset precedes the lowest data value or lowest tick value,
whichever is less.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
Interaction This option is ignored if the DISPLAY= option does not display tick
values.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TIMEOPTS=(time-axis-options)
specifies one or more options for a time axis.
Requirements Columns associated with a time axis must be in SAS time, SAS
date, or SAS datetime units and have an associated SAS time, date,
or datetime format.
See “Options for Time Axes Only” on page 958 for the options that
you can use for time-axis-options.
Default AUTO
Interactions If this option is set to anything other than AUTO, then plots within the
layout are dropped from the display if their data types or data ranges
do not match the axis type requirements. For more information, see
“Plot Axis Types Must Agree on Common Axes” on page 883.
After the axis type is determined (whether you set a specific type or
AUTO is in effect), only options supported by that axis type can be
used. For example, if TYPE=TIME, then only the general
OVERLAY3D axis options and those available on TIMEOPS= are
supported.
INTEGER=TRUE | FALSE
specifies that evenly spaced integer values are used for tick marks.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
952 Chapter 8 • Axis Options in Layouts
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
Axis Options for LAYOUT OVERLAY3D 953
Defaults Four ticks with five intervals in the first maintenance release of SAS
9.4 and earlier releases.
One tick with two intervals starting with the second maintenance
release of SAS 9.4.
Interactions The DISPLAY= option specification must include TICKS for this
option to have any effect.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
THRESHOLDMAX=number
specifies a bias for including one more tick mark at the maximum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
THRESHOLDMIN=number
specifies a bias for including one more tick mark at the minimum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
(format-options)
specifies one or more formatting options for major tick values. Together, these
options provide parameters for determining an optimal format (w.d, Ew.,
BESTw.) for displaying major tick values.
MAXWIDTH=integer
specifies the maximum width for displayed tick values. Values might be
rounded or converted to E notation to fit into this width.
Default 8
MAXDECIMALS=integer
specifies the maximum number of decimals for displayed tick values. Values
might be rounded or converted to E notation to fit into this width.
Default 6
PREFERREDDECIMALS=integer
specifies the number of decimal places that you want to display for most
values. The actual number might vary based on other constraints.
Default 2
EXTRACTSCALE=TRUE | FALSE
specifies whether to extract a scale factor from the tick values and use it to
reduce the tick value width. The scale can be a named scale or a scientific-
notation scale. The EXTRACTSCALETYPE= option specifies the scale type.
The scale that is used is appended to the axis label, as shown in the following
example.
Total Sales (millions)
For long axis labels, if the scale does not fit the available space, then the label
is truncated, and the scale is appended to the truncated label. Ellipses indicate
that the label was truncated, as shown in the following example.
Total Sales for the Fourth Quarter Of ... (millions)
In extreme cases in which the scale does not fit even with truncation, the
entire axis is dropped.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you
can use.
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
specifies whether to extract a named scale or a scientific-notation scale.
DEFAULT
extracts a named scale. A named scale can be millions, billions, or
trillions for values of 999 trillion or less, or a multiple of 10 (denoted as
10^n) for values over 999 trillion. For large tick values, the scale factor is
set to ensure that the absolute value of the largest value is greater than 1.
For small fractional tick values, the scale factor is set to ensure that the
absolute value of the smallest value is greater than 1. The scale can be
millionth, billionth, or trillionth for values of 1 trillionth or more, or a
multiple of 1/10 (10^–n) for values less than 1 trillionth.
SCIENTIFIC
extracts a scientific-notation scale. A scientific-notation scale is a
multiple of 10 expressed as 10^n for values greater than 1, or a multiple
of 1/10 expressed as 10^–n for values less than 1.
Default DEFAULT
Restriction The scale is derived from the English locale for all locales.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Tip The values in the list are formatted according to the setting for the
TICKVALUEFORMAT= option.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether an axis tick specification (TICKVALUELIST= or
TICKVALUESEQUENCE=) can extend the axis data range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by either the TICKVALUELIST= or
TICKVALUESEQUENCE= option. If the minimum and maximum of the user-
specified values are within the data range, this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the actual data minimum and data
maximum.
Default FALSE
This option is ignored if the DISPLAY= option does not display the
tick values.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUESEQUENCE=(sequence-options)
specifies the tick values by start, end, and increment.
(sequence-options)
a space-separated list of the following name-value-pair options that control major
tick values. You must provide all three options.
START=number
specifies the value for the first tick mark.
END=number
specifies the value for the last tick mark.
INCREMENT=number
specifies the increment for intermediate tick marks between the first and last
tick marks. The END value always controls the last tick mark. The interval
between the last tick mark and the previous tick mark might not necessarily
be the INCREMENT value.
This option is ignored if the DISPLAY= option does not display tick
marks.
Tip The values in the sequence are formatted according to the setting for
the TICKVALUEFORMAT= option.
INTERVAL=interval
specifies the time interval between major ticks. Valid interval keywords are AUTO,
SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,
QUARTER, SEMIYEAR, YEAR.
Table 8.2 Time Intervals
Default AUTO. An appropriate interval is chosen based on the data and the
column date, date-time, or time format.
Requirement The data column(s) mapped to a time axis must be in the same
duration units: TIME, DATE, or DATETIME. The selection of an
interval must be consistent with the duration unit. For example, if the
data are in time units, you can specify only AUTO, SECOND,
MINUTE, HOUR.
INTERVALMULTIPLIER=positive-integer
specifies a multiplier to apply to the time interval that is in effect for the axis.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
960 Chapter 8 • Axis Options in Layouts
Default 1
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
The following figure shows the minor grid lines set to light blue, dotted lines on a time
axis. (See the example.)
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKINTERVAL=interval
specifies the time interval between minor ticks. See Table 8.2 on page 958 for
information about the intervals that you can select. The interval that you select must
be consistent with the axis data duration units such as TIME, DATE, or DATETIME.
For example, if the axis data is in TIME units, then you must specify AUTO,
SECOND, MINUTE, or HOUR.
Default AUTO
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
962 Chapter 8 • Axis Options in Layouts
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEFORMAT=format | DATA
specifies how to format the values for major tick marks.
format
specifies a SAS date, time, or datetime format to control how the major tick
values are displayed. This format must be in the same duration units as the data
column(s) mapped to a time axis: TIME, DATE, or DATETIME and should be
appropriate for the value of the INTERVAL= option. For example, if
INTERVAL=MONTH and there are two years of data displayed on the axis, then
choosing TICKVALUEFORMAT=YEAR. would result in several ticks having
the same year value.
DATA
specifies that the SAS date, time, or datetime format associated with the data
column assigned to the axis be used to control how the major tick values are
displayed.
Default The default format used by the INTERVAL= option. The default does
not apply if TICKVALUELIST= is specified.
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
Interactions The values in the list are formatted according to the format specified
on the TICKVALUEFORMAT= option. If TICKVALUEFORMAT=
is not used, then the values are formatted according to the column
format (the default TICKVALUEFORMAT value is not applied to
these values).
Details
The LAYOUT OVERLAY3D statement provides XAXISOPTS=, YAXISOPTS=, and
ZAXISOPTS= options that enable you to manage the axis display separately for the X,
Y, and Z axes. The following example template uses the YAXISOPTS= option to
manage the display of grid lines, tick marks, and tick values on a Y axis:
begingraph;
layout overlay3d /
yaxisopts=(
griddisplay=on
display=(ticks tickvalues)
);
bihistogram3dparm x=rater y=customer z=percent;
endlayout;
endgraph;
Within an OVERLAY3D layout block, each plot axis is always either a linear or a time
axis. The default axis-type setting is AUTO, which specifies that the axis type be
automatically determined by the plot or the overlay contents. The TYPE= option enables
you to explicitly specify either a LINEAR or a TIME axis type. When you override the
default axis type, you must be sure to specify the correct axis type for the plot(s) that you
are defining.
Each axis type has features specific to that type, and the axis options LINEAROPTS=
and TIMEOPS= enable you to specify features for a linear or a time axis. You can
combine one or more general axis options with the options for the specific axis type.
However, specified settings are applied only to the axis type that supports them. For
example, if you specify general axis options with time axis options and the generated
graph produces a linear axis type, then the time axis options are ignored.
Syntax
Axis options for the plots within a LATTICE layout are specified with the following
statements within a LAYOUT LATTICE statement block:
COLUMNAXIS /external-axis-options
ROWAXIS /external-axis-options
964 Chapter 8 • Axis Options in Layouts
DISCRETEOPTS=(discrete-axis-options)
specifies one or more options for a discrete axis. Options must be enclosed in
parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Discrete Axes Only” on page 975 for the options that
you can use for discrete-axis-options.
Default STANDARD
Tips The default line attributes for the axis line and axis tick marks are defined
in the GraphAxisLine style element.
Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis grid
lines.
When LINE is excluded from the DISPLAY= option, the layout wall
outline or the default baseline of a bar chart, needle plot, or waterfall chart
can appear to be an axis line. To suppress the wall outline, use the
WALLDISPLAY= option in the layout statement. To suppress the plot
baseline, use the BASELINEATTRS= option in the plot statement.
See “Details” on page 1009 for more information about the primary and
secondary axes.
Default NONE
Restriction If some plot statements set XAXIS=X and others set XAXIS=X2, both
the X and X2 axis are primary and a secondary X axis cannot be
Axis Options for LAYOUT LATTICE 967
displayed. In that case, this option is ignored. The same applies for the
Y axes.
Tip Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis
grid lines.
See “Details” on page 1009 for more information about the primary and
secondary axes.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tip On a log axis, this option affects the appearance of the major grid lines
only. It does not affect the appearance of the minor grid lines. To
control the appearance of the minor grid lines on a log axis, use the
MINORGRIDATTRS= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
AUTO_OFF AUTO no
AUTO_OFF ON yes
AUTO_OFF OFF no
AUTO_ON ON yes
AUTO_ON OFF no
Default AUTO_OFF
Note Supplied styles use DisplayOpts="AUTO," which means that the style has
no preference about grid lines and the graphics template setting for grid
lines is always used.
Default The default label is derived from the primary plot in the layout. For
more information, see “When Plots Share Data and a Common Axis”
on page 880.
Note If the axis label is too long to fit along the axis, then it is truncated by
default.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default AUTO
LABELPOSITION=CENTER | DATACENTER
specifies the position of the axis label.
CENTER
centers each row or column axis label in its axis area. For the external Y and Y2
axes, the label is oriented vertically and is centered in the axis area (including the
offsets) of its row. It is positioned to the left of the tick values for the Y axis or to
the right of the axis values for the Y2 axis. For the external X and X2 axes, the
label is centered in the axis area (including the offsets) of its column. It is
positioned below the tick values for the X axis or above the axis values for the
X2 axis.
DATACENTER
centers each row or column axis label in its axis tick display area. For the
external Y and Y2 axes, each label is oriented vertically and is centered in the
axis tick display area (excluding the offsets) of its row. The labels are positioned
to the left of the tick values for the Y axis or to the right of the axis values for the
Y2 axis. For the external X and X2 axes, each label is centered in the axis tick
display area (excluding the offsets) of its column. The labels are positioned
below the tick values for the X axis or above the axis values for the X2 axis.
The following figure shows the CENTER and DATACENTER positions for external
Y axis labels Open and “Close, and external X axis label Month. An offset is applied
to the maximum end of each axis for demonstration purposes.
970 Chapter 8 • Axis Options in Layouts
Default CENTER
LABELSPLITCHAR="character-list"
specifies one or more characters on which the axis labels can be split, if needed.
When multiple split characters are specified, each character in the list is treated as a
separate split character unless the specified characters appear consecutively in the
axis label. In that case, all of the specified split characters together are treated as a
single split character.
When LABELFITPOLICY=SPLIT, if the axis label does not fit the available space,
then it is split on a specified split character only if a split is needed at that point to
make the label fit. In this case, a split might not occur on every split character. When
LABELFITPOLICY=SPLITALWAYS, the axis label is split unconditionally on
every occurrence of a split character. If the axis label does not contain any of the
specified split characters, the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
LABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed axis labels.
TRUE
drops the split characters from the axis label display.
FALSE
includes the split characters in the axis label display. When
LABELSPLIT=TRUE and LABELSPLITCHARDROP=FALSE, each split
character remains as the last character in the current line. The characters that
follow the split character, up to and including the next split character, are then
wrapped to the next line.
Default TRUE. The split characters are dropped from the axis label.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABELSPLITJUSTIFY=justification
specifies the justification of the strings that are inside the axis label blocks.
justification
CENTER | LEFT | RIGHT
specifies the justification for the X or X2 axis label.
CENTER | TOP | BOTTOM
specifies the justification for the Y or Y2 axis label.
Default CENTER
LINEAROPTS=(linear-axis-options)
specifies one or more options for a numeric interval axis. Options must be enclosed
in parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Linear Axes Only” on page 983 for the options that you
can use for linear-axis-options.
LOGOPTS=(log-axis-options)
specifies one or more options for a log axis. Options must be enclosed in
parentheses. Each option is specified as a name = value pair and each pair is space
separated.
972 Chapter 8 • Axis Options in Layouts
See “Options for Log Axes Only” on page 993 for the options that you
can use for log-axis-options.
NAME="string"
assigns a name to an axis for reference in other statements. Currently, it is used only
in an AXISLEGEND statement.
Interactions This option is ignored unless the axis is discrete. The axis can be
discrete by default, or explicitly set to discrete with a TYPE=
DISCRETE setting.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
Default AUTO
Axis Options for LAYOUT LATTICE 973
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
REVERSE=TRUE | FALSE
specifies whether tick values should appear in the reverse order.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SHORTLABEL="string"
specifies an alternate axis label to display when the default label or the label
specified by the LABEL= option is too long to fit the available space.
Note If the specified label is itself too long for the axis, it is truncated in the
display.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TIMEOPTS=(time-axis-options)
specifies one or more options for a time axis.
Requirements Columns associated with a time axis must be in SAS time, SAS
date, or SAS datetime units and have an associated SAS time, date,
or datetime format.
See “Options for Time Axes Only” on page 1001 for the options that
you can use for time-axis-options.
TIME
uses a TIME axis if possible. Data for this axis must be SAS time, SAS date, or
SAS datetime values. You can add a TIMEOPTS= option list to customize this
axis type.
LOG
uses a LOG axis if possible. You can add a LOGOPTS= option list to customize
this axis type.
Interaction If a log axis is requested and the axis data contains 0 or negative
values, the axis reverts to a linear axis. This outcome can occur for
the response axis of a bar chart, line chart, needle plot, or waterfall
chart when a baseline intercept of 0 or less is specified. It can also
occur for the response axis of a waterfall chart when an initial bar
value of 0 or less is specified. To get a log response axis in those
cases, set the baseline intercept or initial bar value to a positive
value.
Default AUTO
Interactions If this option is set to anything other than AUTO, then plots within the
layout are dropped from the display if their data types or data ranges
do not match the axis type requirements. For more information, see
“Plot Axis Types Must Agree on Common Axes” on page 883.
After the axis type is determined (whether you set a specific type or
AUTO is in effect), you can use only options that are supported by
that axis type. For example, if TYPE=TIME, then only the general
OVERLAY axis options and those available on TIMEOPTS= are
supported.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
Example The following example specifies the axis tick values 10, 20, 30, and
40, and the tick display values A, B, C, and D:
tickvaluelist=("10" "20" "30" "40");
tickdisplaylist=("A" "B" "C" "D");
TICKTYPE=MIDPOINT | INBETWEEN
specifies the position of the axis tick marks.
Default MIDPOINT
Note Starting with the second maintenance release of SAS 9.4, when
TICKTYPE=INBETWEEN, the outermost tick marks and grid lines at
each end of the axis are not drawn.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
Axis Options for LAYOUT LATTICE 977
EXTRACT
displays consecutive integers along the axis instead of the actual tick values in
order to represent those tick values. In most cases, this policy is implemented if
the system estimates that a collision might occur. If no collision occurs, then the
actual tick values are displayed on the axis in the normal manner.
EXTRACTALWAYS
same as EXTRACT, except that the extraction is implemented regardless of
whether collision occurs.
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
SPLIT
splits the tick value at a split character, which is specified by the
TICKVALUESPLITCHAR= option, only when necessary in order to make the
value fit the available space. A split does not occur at a split character if a split is
not needed at that location. If the value does not contain any of the specified split
characters, then the value is not split. Values that are not split or that do not fit the
available space even after splitting might overlap the adjoining space.
See TICKVALUESPLITCHAR=
SPLITALWAYS
always splits the axis tick value at every occurrence of a split character that is
specified by the TICKVALUESPLITCHAR= option.
See TICKVALUESPLITCHAR=
SPLITALWAYSTHIN
same as SPLITALWAYS, except that thinning is performed when long words do
not fit the available space.
SPLITTHIN
same as SPLIT, except that thinning is performed when long words do not fit the
available space.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
EXTRACT
display consecutive integers along the axis instead of the actual tick values to
represent those tick values. In most cases, this policy is implemented if the
system estimates that a collision might occur. If no collision occurs, then the
actual tick values are displayed on the axis in the normal manner.
978 Chapter 8 • Axis Options in Layouts
EXTRACTALWAYS
same as EXTRACT, except that the extraction is implemented regardless of
whether collision occurs.
NONE
does not attempt to fit tick values that collide.
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATEALWAYSDROP
attempts the ROTATEALWAYS policy, and then drops the tick values if
collisions still occur.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
SPLIT
splits the tick value at a split character, which is specified by the
TICKVALUESPLITCHAR= option, only when necessary in order to make the
value fit the available space. A split does not occur at a split character if a split is
not needed at that location. If the value does not contain any of the specified split
characters, then the value is not split. Values that are not split or that do not fit the
available space even after splitting might overlap the adjoining space.
See TICKVALUESPLITCHAR=
SPLITALWAYS
always splits the axis tick value at every occurrence of a split character that is
specified by the TICKVALUESPLITCHAR= option.
See TICKVALUESPLITCHAR=
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
Axis Options for LAYOUT LATTICE 979
STAGGERTRUNCATE
attempts the STAGGER policy, and then the TRUNCATE policy.
THIN
eliminates alternate tick values.
TRUNCATE
shortens the tick values when they exceed a certain number of characters.
TRUNCATEROTATE
attempts the TRUNCATE policy, and then the ROTATE policy.
TRUNCATESTAGGER
attempts the TRUNCATE policy, and then the STAGGER policy.
TRUNCATETHIN
attempts the TRUNCATE policy, and then the THIN policy.
Note A note is written to the SAS log when tick value thinning occurs.
TICKVALUEFORMAT=format
specifies how to format the values for major tick marks.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Interaction This option is ignored when the axis tick values are extracted to an
axis legend. See TICKVALUEFITPOLICY=EXTRACT |
EXTRACTALWAYS on page 976.
Tip Use this option when you want to duplicate tick values on an axis.
TICKVALUELIST=(string-list)
specifies the list of tick values that are to be displayed on the axis.
string-list
a space-separated list of values, enclosed in parentheses. You must enclose each
value in the list in quotation marks.
Only the tick values that are included in the string list are displayed on the axis. The
values are displayed in the order in which they are listed. The data values that are not
in the list are dropped. The list can be a subset of the data values. It can also contain
values that are not included in the actual data. A tick value that is not included in the
data appears on the axis, but no data is represented at its tick mark.
Notes If the string list contains duplicate values, then the first occurrence
of the duplicated value in the list is honored and the remaining
instances are ignored.
980 Chapter 8 • Axis Options in Layouts
When the values specified in the list are compared with the actual
data values, leading blanks are honored and trailing blanks are
ignored.
Tips You can use this option to subset the axis values or to display the
values in a specific order.
You can use this option to display values on the axis that are not
contained in the data.
Examples The following example specifies the axis tick values Sedan, Sports,
Wagon, and SUV:
tickvaluelist=("Sedan" "Sports" "Wagon" "SUV")
The following example specifies the axis tick values 10, 20, 30, and
40:
tickvaluelist=("10" "20" "30" "40")
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
TICKVALUESPLITCHAR="character-list"
specifies a list of characters on which the tick values can be split, if needed. When
multiple characters are specified, each character in the list is treated as a separate
split character unless the specified characters appear consecutively in the tick value.
In that case, all of the specified split characters together are treated as a single split
character.
When a tick value collision is detected, the tick value is split at each occurrence of
any of the characters in the character list or all. If all of the split characters occur
consecutively in the tick value, then they are treated as a single split character. If the
tick value does not contain any of the specified characters, then the value is not split.
"character-list"
one or more characters with no delimiter between each character.
tickvaluesplitchar="abc"
TICKVALUESPLITCHARDROP=TRUE | FALSE
specifies whether the split characters should be included in the displayed tick values.
The split characters are specified by the TICKVALUESPLITCHAR= option.
TRUE
drops the split characters from the tick value display. The following figure shows
an example in which TICKVALUESPLITCHARDROP=TRUE and three-word,
asterisk-delimited tick values are split on the asterisk character by using the
SPLITALWAYS policy.
Notice that a split occurs on the first asterisk and not at the second. In this case, a
split is not needed at the second asterisk.
If the fit policy is SPLITALWAYS or SPLITALWAYSTHIN, and
TICKVALUESPLITCHARDROP=FALSE, then each tick value is split at every
instance of a split character in the value regardless of whether a split is actually
needed. Each split character remains as the last character in the current line. The
characters that follow each split character, up to and including the next split
character, are then wrapped to the next line. The following figure shows an
example in which TICKVALUESPLITCHARDROP=FALSE and three-word,
asterisk-delimited tick values are split on the asterisk character by using the
SPLITALWAYS policy.
Notice that a split occurs after each asterisk and each asterisk appears at the end
of the line. In this case, three lines are displayed.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
INTEGER=TRUE | FALSE
specifies that evenly spaced integer values are used for tick marks.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Axis Options for LAYOUT LATTICE 985
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
Defaults Four ticks with five intervals in the first maintenance release of SAS
9.4 and earlier releases.
One tick with two intervals starting with the second maintenance
release of SAS 9.4.
986 Chapter 8 • Axis Options in Layouts
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
THRESHOLDMAX=number
specifies a bias for including one more tick mark at the maximum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
THRESHOLDMIN=number
specifies a bias for including one more tick mark at the minimum end of the axis.
Default 0.30
Axis Options for LAYOUT LATTICE 987
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
988 Chapter 8 • Axis Options in Layouts
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
THIN
eliminates alternate tick values.
Default THIN
Note A note is written to the SAS log when tick value thinning occurs.
Default 8
MAXDECIMALS=integer
specifies the maximum number of decimals for displayed tick values. Values
might be rounded or converted to E notation to fit into this width.
Default 6
PREFERREDDECIMALS=integer
specifies the number of decimal places that you want to display for most
values. The actual number might vary based on other constraints.
Default 2
Axis Options for LAYOUT LATTICE 989
EXTRACTSCALE=TRUE | FALSE
specifies whether to extract a scale factor from the tick values and use it to
reduce the tick value width. The scale can be a named scale or a scientific-
notation scale. The EXTRACTSCALETYPE= option specifies the scale type.
The scale that is used is appended to the axis label, as shown in the following
example.
Total Sales (millions)
For long axis labels, if the scale does not fit the available space, then the label
is truncated, and the scale is appended to the truncated label. Ellipses indicate
that the label was truncated, as shown in the following example.
Total Sales for the Fourth Quarter Of ... (millions)
In extreme cases in which the scale does not fit even with truncation, the
entire axis is dropped.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you
can use.
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
specifies whether to extract a named scale or a scientific-notation scale.
DEFAULT
extracts a named scale. A named scale can be millions, billions, or
trillions for values of 999 trillion or less, or a multiple of 10 (denoted as
10^n) for values over 999 trillion. For large tick values, the scale factor is
set to ensure that the absolute value of the largest value is greater than 1.
For small fractional tick values, the scale factor is set to ensure that the
absolute value of the smallest value is greater than 1. The scale can be
millionth, billionth, or trillionth for values of 1 trillionth or more, or a
multiple of 1/10 (10^–n) for values less than 1 trillionth.
SCIENTIFIC
extracts a scientific-notation scale. A scientific-notation scale is a
multiple of 10 expressed as 10^n for values greater than 1, or a multiple
of 1/10 expressed as 10^–n for values less than 1.
Default DEFAULT
Restriction The scale is derived from the English locale for all locales.
990 Chapter 8 • Axis Options in Layouts
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are the tick values in numeric-list that fall
within the explicit data range (set by VIEWMIN= and VIEWMAX=)
or the implicit data range (set by the actual data minimum and data
maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the minimum tick list value and
the VIEWMAX= option is set to the maximum tick list value, then all
ticks in the tick list are displayed. This might result in some data not
being displayed. For example, data might not be displayed when the
VIEWMIN= value is greater than the actual data minimum, or when
the VIEWMAX= value is less than actual data maximum.
Tip The values in the list are formatted according to the setting for the
TICKVALUEFORMAT= option.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether an axis tick specification (TICKVALUELIST= or
TICKVALUESEQUENCE=) can extend the axis data range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by either the TICKVALUELIST= or
TICKVALUESEQUENCE= option. If the minimum and maximum of the user-
specified values are within the data range, this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
TICKVALUESEQUENCE=(sequence-options)
specifies the tick values by start, end, and increment.
992 Chapter 8 • Axis Options in Layouts
(sequence-options)
a space-separated list of the following name-value-pair options that control major
tick values. You must provide all three options.
START=number
specifies the value for the first tick mark.
END=number
specifies the value for the last tick mark.
INCREMENT=number
specifies the increment for intermediate tick marks between the first and last
tick marks. The END value always controls the last tick mark. The interval
between the last tick mark and the previous tick mark might not necessarily
be the INCREMENT value.
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are those that fall within the explicit data range
(set by VIEWMIN= and VIEWMAX=) or the implicit data range (set
by the actual data minimum and data maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the START= option value and the
VIEWMAX= option is set to the END= option value, then all ticks in
the tick sequence are displayed.
Tip The values in the sequence are formatted according to the setting for
the TICKVALUEFORMAT= option.
VIEWMAX=number
specifies the maximum data value to include in the display. The value might be
adjusted by the threshold calculation.
Default The maximum value in the data for the specified axis.
Interactions This option does not determine the maximum axis tick value that is
displayed. The THRESHOLDMAX= value is used to determine the
maximum tick value.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
Axis Options for LAYOUT LATTICE 993
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display. The value might be
adjusted by the threshold calculation.
Default The minimum value in the data for the specified axis.
Interactions This option does not determine the minimum axis tick value that is
displayed. The THRESHOLDMIN= value is used to determine the
minimum tick value.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
BASE=10 | 2 | E
specifies the base of the logarithmic scale for the axis values.
Default 10
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Axis Options for LAYOUT LATTICE 995
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
Base=10
Base=2
Base=E
LOGEXPONENT
places the major tick marks at uniform intervals at integer powers of the base.
The tick values are only the integer exponents for all bases.
LINEAR
places the major tick marks at non-uniform intervals that cover the range of the
data.
Axis Options for LAYOUT LATTICE 997
Default AUTO
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
TICKVALUEFORMAT=DATA | format
specifies how to format the values for major tick marks.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
See BASE=
TICKINTERVALSTYLE=
998 Chapter 8 • Axis Options in Layouts
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Default Only the tick values specified in the list that fall within the explicit
data range set by the VIEWMIN= and VIEWMAX= options or by
the implicit data range set by the actual data minimum and data
maximum are displayed. An internal algorithm determines the tick
marks.
Interactions The VALUESTYPE= option determines how the values in the list
are interpreted.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether the TICKVALUELIST= specification can extend the axis data
range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by the TICKVALUELIST= option. If the
minimum and maximum of the user-specified values are within the data range,
this option has no effect.
Axis Options for LAYOUT LATTICE 999
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
VALUESTYPE=EXPANDED | EXPONENT
specifies the scale that the system uses when interpreting the TICKVALUELIST=,
VIEWMAX=, and VIEWMIN= option values. Use this option to choose your
preferred way of specifying log-axis values.
EXPANDED values are interpreted as powers of the base such as 0.1, 1, 10,
100, and so on, for base 10, for example.
EXPONENT values are interpreted as integer exponents of the base such as 1,
2, 3, and so on, for base 10, base 2, and base E.
Default EXPANDED
Note This option does not change the style of the tick values that are
displayed on the axis. It changes only how the VIEWMIN=,
VIEWMAX=, and TICKVALUELIST= option values are interpreted by
the system.
tickvaluepriority=true
valuestype=expanded
tickvaluelist=(10 100 1000 10000 100000)));
VIEWMAX=number
specifies the maximum data value to include in the display.
Default The maximum value in the data for the specified axis.
Requirement The value that you specify must be appropriate for the
VALUESTYPE= specification and the log base. Otherwise,
unexpected results might occur. If VALUESTYPE=EXPANDED is in
effect (default), specify an increment of the log base power such as
0.1, 1, 10, 100, and so on, on a base 10 log axis, for example. If
VALUESTYPE=EXPONENT is in effect, specify an integer
increment of the log base power exponent such as 1, 2, 3, and so on.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use
the TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display.
Default The minimum value in the data for the specified axis.
Axis Options for LAYOUT LATTICE 1001
Requirement The value that you specify must be appropriate for the
VALUESTYPE= specification and the log base. Otherwise,
unexpected results might occur. If VALUESTYPE=EXPANDED is in
effect (default), specify an increment of the log base power such as
0.1, 1, 10, 100, and so on, on a base 10 log axis, for example. If
VALUESTYPE=EXPONENT is in effect, specify an integer
increment of the log base power exponent such as 1, 2, 3, and so on.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
INTERVAL=interval
specifies the time interval between major ticks. Valid interval keywords are AUTO,
SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,
QUARTER, SEMIYEAR, YEAR.
Table 8.3 Time Intervals
Default AUTO. An appropriate interval is chosen based on the data and the
column date, date-time, or time format.
Requirement The data column(s) mapped to a time axis must be in the same
duration units: TIME, DATE, or DATETIME. The selection of an
interval must be consistent with the duration unit. For example, if the
data are in time units, you can specify only AUTO, SECOND,
MINUTE, HOUR.
INTERVALMULTIPLIER=positive-integer
specifies a multiplier to apply to the time interval that is in effect for the axis.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default 1
INTERVAL=MONTH INTERVALMULTIPLIER=3
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Axis Options for LAYOUT LATTICE 1005
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKINTERVAL=interval
specifies the time interval between minor ticks. See Table 8.3 on page 1002 for
information about the intervals that you can select. The interval that you select must
be consistent with the axis data duration units such as TIME, DATE, or DATETIME.
For example, if the axis data is in TIME units, then you must specify AUTO,
SECOND, MINUTE, or HOUR.
Default AUTO
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
SPLITTICKVALUE=TRUE | FALSE
specifies whether to split the tick values on an X or X2 axis, if possible. This option
is not available for a Y or Y2 axis.
TRUE
splits the axis tick values into two lines allowing more tick values to appear. For
example, with INTERVAL= MONTH, this is how tick values are split:
FALSE
does not split the axis tick values. For example, when this option specifies
FALSE, this is how the tick values in the previous example appear:
Typically, fewer tick values fit, causing thinning, rotation, or staggering of the
values. See the TICKVALUEFITPOLICY= option.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an X or X2 axis. This option is
not available for the Y and Y2 axes. The effectiveness of a collision-avoidance
policy depends on the number of tick values, their length, and the length of the axis.
The following policies are valid:
THIN
eliminates alternate tick values.
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
Axis Options for LAYOUT LATTICE 1007
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
Default THIN
Interaction When SPLITTICKVALUE= TRUE, this option is ignored and only the
THIN policy is used.
Note A note is written to the SAS log when tick value thinning occurs.
TICKVALUEFORMAT=format | DATA
specifies how to format the values for major tick marks.
format
specifies a SAS date, time, or datetime format to control how the major tick
values are displayed. This format must be in the same duration units as the data
column(s) mapped to a time axis: TIME, DATE, or DATETIME and should be
appropriate for the value of the INTERVAL= option. For example, if
INTERVAL=MONTH and there are two years of data displayed on the axis, then
choosing TICKVALUEFORMAT=YEAR. would result in several ticks having
the same year value.
DATA
specifies that the SAS date, time, or datetime format associated with the data
column assigned to the axis be used to control how the major tick values are
displayed.
Default The default format used by the INTERVAL= option. The default does
not apply if TICKVALUELIST= is specified.
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
Interactions The values in the list are formatted according to the format specified
on the TICKVALUEFORMAT= option. If TICKVALUEFORMAT=
is not used, then the values are formatted according to the column
format (the default TICKVALUEFORMAT value is not applied to
these values).
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether the TICKVALUELIST= specification can extend the axis data
range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by the TICKVALUELIST= option. If the
minimum and maximum of the user-specified values are within the data range,
this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
VIEWMAX=number
specifies the maximum data value to include in the display.
Default The maximum value in the data for the specified axis.
Notes Setting a VIEWMAX= or VIEWMIN= value does not alter the original
data or any calculations on it.
The maximum axis tick value might differ from the VIEWMAX= value.
The VIEWMIN= and VIEWMAX= values, and additional factors such as
thresholds and the tick values computed by the plot statement, are used to
determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display.
Default The minimum value in the data for the specified axis.
Notes Setting a VIEWMAX= or VIEWMIN= value does not alter the original
data or any calculations on it.
The minimum axis tick value might differ from the VIEWMIN= value. The
VIEWMIN= and VIEWMAX= values, and additional factors such as
thresholds and the tick values computed by the plot statement, are used to
determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
Details
The LAYOUT LATTICE statement creates a grid of graphs that automatically aligns plot
areas, data display areas, axis labels, and headers across the columns and rows of the
layout. The axis data ranges can be scaled, and the axes for individual cells in the layout
can be managed by row and by column using COLUMNAXIS and ROWAXIS
statements. COLUMNAXIS statements are used within a COLUMNAXES or
COLUMN2AXES block to externalize column axes for the layout. Similarly,
ROWAXIS statements are used within a ROWAXES or ROW2AXES block to
externalize row axes for the layout. Each axis block is used to manage the primary axis.
The axis that is considered primary depends on the settings for the XAXIS= and
YAXIS= options in plot statements that are specified within the layout:
1010 Chapter 8 • Axis Options in Layouts
endlayout;
Example: Axis Options for LAYOUT LATTICE 1011
This example shows how to externalize axes in a LAYOUT LATTICE and manage the
axis features on primary Y and Y2 axes.
• The first HISTOGRAM statement specifies YAXIS=Y2 to make the Y2 axis the
primary axis for COUNT measures. The second HISTOGRAM statement specifies
YAXIS=Y to make the Y axis the primary axis for PERCENT measures.
• In order to externalize the axes within the layout, the data ranges for the axes must be
unified. In the LAYOUT LATTICE statement, the ROWDATARANGE= option
unifies the data ranges for the Y axes across the row. The ROW2DATARANGE=
option unifies the data ranges for the Y2 axes across the row.
• The ROWAXIS statement is used to manage axis features for the row axes. To
manage the primary Y axis, a ROWAXIS statement is specified within a ROWAXES
block. To manage the primary Y2 axis, another ROWAXIS statement is specified
within a ROW2AXES block.
• Within the ROWAXES block, the ROWAXIS statement consolidates Y axes in the
row into a single, external Y axis and also displays grid lines. Within the
ROW2AXES block, the ROWAXIS statement consolidates Y2 axes in the row into a
single, external Y2 axis, but it does not alter the default features of that axis.
The following graph was generated by the “Example Program” on page 1012 :
1012 Chapter 8 • Axis Options in Layouts
Example Program
proc template;
define statgraph y2axis;
begingraph;
layout lattice / columns=2 columngutter=10
rowdatarange=union row2datarange=union ;
rowaxes;
rowaxis / griddisplay=on;
endrowaxes;
row2axes;
rowaxis;
endrow2axes;
layout overlay;
histogram height / scale=count yaxis=y2 ;
histogram height / scale=percent yaxis=y ;
densityplot height / normal();
endlayout;
layout overlay;
histogram weight / scale=count yaxis=y2 ;
histogram weight / scale=percent yaxis=y ;
densityplot weight / normal();
endlayout;
endlayout;
endgraph;
end;
Syntax
Axis options for the plots within an OVERLAYEQUATED layout are specified with the
following options on a LAYOUT OVERLAYEQUATED statement:
COMMONAXISOPTS=(common-equated-axis-options)
XAXISOPTS=(equated-axis-options)
YAXISOPTS=(equated-axis-options)
INTEGER=TRUE | FALSE
specifies that evenly spaced integer values are used for tick marks.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Range 0–1
Tip A numeric value is useful for bar charts when DATA terminates the axis
line at the midpoint positions of the minimum and maximum bars. In
that case, you can specify a numeric value to lengthen the axis line so
that it extends to the full width of both bars.
Axis Options for LAYOUT OVERLAYEQUATED 1015
The following figure shows a simple example of each value for the X and Y axis lines.
The light-blue dashed lines depict the minimum and maximum offsets that are set on the
axes.
Default FULL
Tip The graph wall outline might appear to be an axis line. In that case, use
the WALLDISPLAY=NONE or WALLDISPLAY=(FILL) option in the
layout statement to suppress the wall outline.
Notes This option has no affect on the placement of the tick values, which are
always outside the axis frame.
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
1016 Chapter 8 • Axis Options in Layouts
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are the tick values in numeric-list that fall
within the explicit data range (set by VIEWMIN= and VIEWMAX=)
or the implicit data range (set by the actual data minimum and data
maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the minimum tick list value and
the VIEWMAX= option is set to the maximum tick list value, then all
ticks in the tick list are displayed. This might result in some data not
being displayed. For example, data might not be displayed when the
VIEWMIN= value is greater than the actual data minimum, or when
the VIEWMAX= value is less than actual data maximum.
Tip The values in the list are formatted according to the setting for the
TICKVALUEFORMAT= option.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether an axis tick specification (TICKVALUELIST= or
TICKVALUESEQUENCE=) can extend the axis data range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by either the TICKVALUELIST= or
TICKVALUESEQUENCE= option. If the minimum and maximum of the user-
specified values are within the data range, this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Axis Options for LAYOUT OVERLAYEQUATED 1017
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUESEQUENCE=(sequence-options)
specifies the tick values by start, end, and increment.
(sequence-options)
a space-separated list of the following name-value-pair options that control major
tick values. You must provide all three options.
START=number
specifies the value for the first tick mark.
END=number
specifies the value for the last tick mark.
INCREMENT=number
specifies the increment for intermediate tick marks between the first and last
tick marks. The END value always controls the last tick mark. The interval
between the last tick mark and the previous tick mark might not necessarily
be the INCREMENT value.
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are those that fall within the explicit data range
(set by VIEWMIN= and VIEWMAX=) or the implicit data range (set
by the actual data minimum and data maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the START= option value and the
VIEWMAX= option is set to the END= option value, then all ticks in
the tick sequence are displayed.
Tip The values in the sequence are formatted according to the setting for
the TICKVALUEFORMAT= option.
VIEWMAX=number
specifies the maximum data value to include in the display on the X and Y axes
when the axis lengths and major tick values are equal. The value might be adjusted
by the threshold calculation.
Default The maximum value in the data for the X and Y axes.
Interactions This option does not determine the maximum axis tick value that is
displayed. The THRESHOLDMAX= value is used to determine the
maximum tick value.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display on the X and Y axes when
the axis lengths and major tick values are equal. The value might be adjusted by the
threshold calculation.
Default The minimum value in the data for the X and Y axes.
Interactions This option does not determine the minimum axis tick value that is
displayed. The THRESHOLDMIN= value is used to determine the
minimum tick value.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
Default STANDARD
Tips The default line attributes for the axis line and axis tick marks are defined
in the GraphAxisLine style element.
Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis grid
lines.
Axis Options for LAYOUT OVERLAYEQUATED 1021
When LINE is excluded from the DISPLAY= option, the layout wall
outline or the default baseline of a bar chart, needle plot, or waterfall chart
can appear to be an axis line. To suppress the wall outline, use the
WALLDISPLAY= option in the layout statement. To suppress the plot
baseline, use the BASELINEATTRS= option in the plot statement.
Default NONE
Tip Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis grid
lines.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
AUTO_OFF
specifies that grid lines are not displayed unless the GraphGridLines element in
the current style contains DisplayOpts="ON."
AUTO_ON
specifies that grid lines are displayed unless the GraphGridLines element in the
current style contains DisplayOpts="OFF."
ON
specifies that grid lines are always displayed. The current style has no override.
OFF
specifies that grid lines are never displayed. The current style has no override.
The following table shows the end results for various combinations of the
GRIDDISPLAY= option and the DisplayOpts= attribute of the GraphGridLines style
element. Most supplied templates use the default setting AUTO_OFF to indicate a
preference for not displaying grid lines, but allowing the style to override.
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
AUTO_OFF AUTO no
AUTO_OFF ON yes
AUTO_OFF OFF no
AUTO_ON ON yes
AUTO_ON OFF no
Default AUTO_OFF
Note Supplied styles use DisplayOpts="AUTO," which means that the style has
no preference about grid lines and the graphics template setting for grid
lines is always used.
Default The default label is derived from the primary plot in the layout. For more
information, see “When Plots Share Data and a Common Axis” on page
880.
Note If the axis label is too long to fit along the axis, then it is truncated by
default.
Axis Options for LAYOUT OVERLAYEQUATED 1023
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Range 0–1
Tip A numeric value is useful for bar charts when DATA terminates the axis
line at the midpoint positions of the minimum and maximum bars. In
that case, you can specify a numeric value to lengthen the axis line so
that it extends to the full width of both bars.
The following figure shows a simple example of each value for the X and Y axis lines.
The light-blue dashed lines depict the minimum and maximum offsets that are set on the
axes.
Default FULL
1024 Chapter 8 • Axis Options in Layouts
Tip The graph wall outline might appear to be an axis line. In that case,
use the WALLDISPLAY=NONE or WALLDISPLAY=(FILL) option
in the layout statement to suppress the wall outline.
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
The following figure shows the minor grid lines set to light blue, dotted lines on a linear
axis. (See the example.)
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
1026 Chapter 8 • Axis Options in Layouts
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
Default AUTO
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
REVERSE=TRUE | FALSE
specifies whether tick values should appear in the reverse order.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SHORTLABEL="string"
specifies an alternate axis label to display when the default label or the label
specified by the LABEL= option is too long to fit the available space.
Axis Options for LAYOUT OVERLAYEQUATED 1027
Note If the specified label is itself too long for the axis, it is truncated in the
display.
THRESHOLDMAX=number
specifies a bias for including one more tick mark at the maximum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
THRESHOLDMIN=number
specifies a bias for including one more tick mark at the minimum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
ROTATE
rotates the tick values if a collision occurs.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
THIN
eliminates alternate tick values.
Default THIN
Note A note is written to the SAS log when tick value thinning occurs.
MAXWIDTH=integer
specifies the maximum width for displayed tick values. Values might be
rounded or converted to E notation to fit into this width.
Default 8
MAXDECIMALS=integer
specifies the maximum number of decimals for displayed tick values. Values
might be rounded or converted to E notation to fit into this width.
Default 6
PREFERREDDECIMALS=integer
specifies the number of decimal places that you want to display for most
values. The actual number might vary based on other constraints.
Default 2
EXTRACTSCALE=TRUE | FALSE
specifies whether to extract a scale factor from the tick values and use it to
reduce the tick value width. The scale can be a named scale or a scientific-
notation scale. The EXTRACTSCALETYPE= option specifies the scale type.
The scale that is used is appended to the axis label, as shown in the following
example.
Total Sales (millions)
For long axis labels, if the scale does not fit the available space, then the label
is truncated, and the scale is appended to the truncated label. Ellipses indicate
that the label was truncated, as shown in the following example.
Total Sales for the Fourth Quarter Of ... (millions)
In extreme cases in which the scale does not fit even with truncation, the
entire axis is dropped.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you
can use.
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
specifies whether to extract a named scale or a scientific-notation scale.
1030 Chapter 8 • Axis Options in Layouts
DEFAULT
extracts a named scale. A named scale can be millions, billions, or
trillions for values of 999 trillion or less, or a multiple of 10 (denoted as
10^n) for values over 999 trillion. For large tick values, the scale factor is
set to ensure that the absolute value of the largest value is greater than 1.
For small fractional tick values, the scale factor is set to ensure that the
absolute value of the smallest value is greater than 1. The scale can be
millionth, billionth, or trillionth for values of 1 trillionth or more, or a
multiple of 1/10 (10^–n) for values less than 1 trillionth.
SCIENTIFIC
extracts a scientific-notation scale. A scientific-notation scale is a
multiple of 10 expressed as 10^n for values greater than 1, or a multiple
of 1/10 expressed as 10^–n for values less than 1.
Default DEFAULT
Restriction The scale is derived from the English locale for all locales.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
VIEWMAX=number
specifies the maximum data value to include in the display on the X or Y axes when
the axis lengths and major tick values are equal. The value might be adjusted by the
threshold calculation.
Default The maximum value in the data for the X and Y axes.
This option does not determine the maximum axis tick value that is
displayed. The THRESHOLDMAX= value is used to determine the
maximum tick value.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
Axis Options for LAYOUT OVERLAYEQUATED 1031
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display on the X or Y axes when
the axis lengths and major tick values are equal. The value might be adjusted by the
threshold calculation.
Default The minimum value in the data for the X and Y axes.
This option does not determine the minimum axis tick value that is
displayed. The THRESHOLDMIN= value is used to determine the
minimum tick value.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
Details
The LAYOUT OVERLAYEQUATED statement is used for equated layouts where the X
and Y axes always have equal increments between tick values. Because the axes within
the equated layout are so closely correlated, some axis adjustments cannot be applied to
one axis without applying them to the other.
For example, the INTEGER= option sets evenly spaced integer values for the axis tick
marks. That setting must be applied to both axes if the correlation between them is to be
maintained. The LAYOUT OVERLAYEQUATED statement provides the
COMMONAXISOPTS= option for specifying the INTEGER= option and other options
whose settings apply in common to both axes.
Despite the close correlation between the axes, some axis adjustments can be made to
one axis without affecting the other. For example, displaying grid lines on one axis has
no impact on the other. The XAXISOPTS= and YAXISOPTS= options are available for
applying settings separately to the X and Y axes.
The following example template sets evenly spaced integer values for the axis tick marks
of both axes. It also specifies the display of grid lines, tick marks, and tick values for the
Y axis:
begingraph;
layout overlayequated /
commonaxisopts=(integer=true);
1032 Chapter 8 • Axis Options in Layouts
Syntax
The X and X2 axis options for the plots within DATALATTICE and DATAPANEL
layouts are specified with the following options:
COLUMNAXISOPTS=(axis-option(s))
COLUMN2AXISOPTS=(axis-option(s))
The Y and Y2 axis options for the plots within DATALATTICE and DATAPANEL
layouts are specified with the following options:
ROWAXISOPTS=(axis-option(s))
ROW2AXISOPTS=(axis-option(s))
Tips The default line attributes for the axis line and axis tick marks are defined
in the GraphAxisLine style element.
This option can be used to obtain the alternating axis information as seen in
a ScatterPlotMatrix.
See “Details” on page 1083 for more information about the primary and
secondary axes.
must map data to the same primary axis. For example, a secondary X2 axis can be
displayed on top in the layout, provided all plot statements set XAXIS=X to map
data to the primary X axis (bottom). Similarly, a secondary Y2 axis can be displayed
to the right in the layout, provided all plot statements set YAXIS=Y to map data to
the primary Y axis (left).
NONE
specifies that no axis features are displayed
STANDARD
specifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on
the secondary axis
ALL
specifies that LABEL, LINE, TICKS, and TICKVALUES are displayed on the
secondary axis
(display-options)
a space-separated list of one or more of the following options enclosed in
parentheses:
LABEL
displays the axis label. A common label is displayed at the center of the grid,
and the label applies to all the secondary axes in the row or column. This
label is overridden by a label specified on the DISPLAY= option.
LINE
displays the axis line.
TICKS
displays the tick marks.
TICKVALUES
displays the values that are represented by the major tick marks.
Restriction If some plot statements set XAXIS=X and others set XAXIS=X2, then
both the X and X2 axis are primary and a secondary X axis cannot be
displayed. In that case, this option is ignored. The same applies for the
Y axes.
Tips The default line attributes for the axis line and axis tick marks are
defined in the GraphAxisLine style element.
See “Details” on page 1083 for more information about the primary and
secondary axes.
DISCRETEOPTS=(discrete-axis-options)
specifies one or more options for a discrete axis. Options must be enclosed in
parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Discrete Axes Only” on page 1047 for the options that
you can use for discrete-axis-options.
Default STANDARD
Note When LABEL is specified, a common label is displayed at the center of the
grid, and the label applies to all the primary axes in the row or column.
This label overrides a label specified on the ALTDISPLAY= option.
Tips The default line attributes for the axis line and axis tick marks are defined
in the GraphAxisLine style element.
Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis grid
lines.
When LINE is excluded from the DISPLAY= option, the layout wall
outline or the default baseline of a bar chart, needle plot, or waterfall chart
can appear to be an axis line. To suppress the wall outline, use the
WALLDISPLAY= option in the layout statement. To suppress the plot
baseline, use the BASELINEATTRS= option in the plot statement.
See “Details” on page 1083 for more information about the primary and
secondary axes..
NONE
specifies that no axis features are displayed
STANDARD
specifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on
the secondary axis
ALL
specifies that LABEL, LINE, TICKS, and TICKVALUES are displayed on the
secondary axis
(display-options)
a space-separated list of one or more of the following options enclosed in
parentheses:
Default NONE
Restriction If some plot statements set XAXIS=X and others set XAXIS=X2, both
the X and X2 axis are primary and a secondary X axis cannot be
displayed. In that case, this option is ignored. The same applies for the
Y axes.
Tip Use the GRIDDISPLAY= and GRIDATTRS= options to set the axis
grid lines.
See for more information about the primary and secondary axes.“Details”
on page 1083 .
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tip On a log axis, this option affects the appearance of the major grid lines
only. It does not affect the appearance of the minor grid lines. To
control the appearance of the minor grid lines on a log axis, use the
MINORGRIDATTRS= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DisplayOpts= style
GRIDDISPLAY= option attribute Grid Lines Shown?
AUTO_OFF AUTO no
AUTO_OFF ON yes
AUTO_OFF OFF no
AUTO_ON ON yes
AUTO_ON OFF no
Default AUTO_OFF
Note Supplied styles use DisplayOpts="AUTO," which means that the style has
no preference about grid lines and the graphics template setting for grid
lines is always used.
Default The default label is derived from the primary plot in the layout. For
more information, see “When Plots Share Data and a Common Axis”
on page 880.
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1039
Note If the axis label is too long to fit along the axis, then it is truncated by
default.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default AUTO
Restriction These options are valid for the Y and Y2 axes only.
Note When TOP or BOTTOM is used, the label might collide with other
graphical features.
LEFT | RIGHT
positions the label to the left or right of the axis area. The label is centered
vertically in the axis area.
Restriction These options are valid for the X and X2 axes only.
Note When LEFT or RIGHT is used, the label might collide with other
graphical features.
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1041
The following figure shows the CENTER and DATACENTER positions for a blue Y
axis label Qtr and a red X axis label Close.
The next figure shows the TOP and LEFT positions, and the BOTTOM and RIGHT
positions for the same axis labels.
Default CENTER
Restriction This option does not support collision avoidance. In some cases, axis
label collisions can occur in the axis area.
See SHORTLABEL= on page 1044 for information about how short labels
are used.
LABELSPLITCHAR="character-list"
specifies one or more characters on which the axis labels can be split, if needed.
When multiple split characters are specified, each character in the list is treated as a
1042 Chapter 8 • Axis Options in Layouts
separate split character unless the specified characters appear consecutively in the
axis label. In that case, all of the specified split characters together are treated as a
single split character.
When LABELFITPOLICY=SPLIT, if the axis label does not fit the available space,
then it is split on a specified split character only if a split is needed at that point to
make the label fit. In this case, a split might not occur on every split character. When
LABELFITPOLICY=SPLITALWAYS, the axis label is split unconditionally on
every occurrence of a split character. If the axis label does not contain any of the
specified split characters, the label is not split.
"character-list"
one or more characters with no space between each character and enclosed in
quotation marks.
Notes When multiple characters are specified, the order of the characters
in the list is not significant.
LABELSPLITCHARDROP=TRUE | FALSE
specifies whether the split characters are included in the displayed axis labels.
TRUE
drops the split characters from the axis label display.
FALSE
includes the split characters in the axis label display. When
LABELSPLIT=TRUE and LABELSPLITCHARDROP=FALSE, each split
character remains as the last character in the current line. The characters that
follow the split character, up to and including the next split character, are then
wrapped to the next line.
Default TRUE. The split characters are dropped from the axis label.
See “boolean ” on page 1339 for other Boolean values that you can use.
LABELSPLITJUSTIFY=justification
specifies the justification of the strings that are inside the axis label blocks.
justification
CENTER | LEFT | RIGHT
specifies the justification for the X or X2 axis label.
CENTER | TOP | BOTTOM
specifies the justification for the Y or Y2 axis label.
Default CENTER
LINEAROPTS=(linear-axis-options)
specifies one or more options for a numeric interval axis. Options must be enclosed
in parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Linear Axes Only” on page 1055 for the options that you
can use for linear-axis-options.
LOGOPTS=(log-axis-options)
specifies one or more options for a log axis. Options must be enclosed in
parentheses. Each option is specified as a name = value pair and each pair is space
separated.
See “Options for Log Axes Only” on page 1065 for the options that you
can use for log-axis-options.
NAME="string"
assigns a name to an axis for reference in other statements. Currently, it is used only
in an AXISLEGEND statement.
Interactions This option is ignored unless the axis is discrete. The axis can be
discrete by default, or explicitly set to discrete with a TYPE=
DISCRETE setting.
AUTO
reserves just enough area to fully display markers and other graphical features
near the maximum end of an axis.
AUTOCOMPRESS
applies an automatic offset that prevents axis labels and tick values from
extending beyond the axis length.
number
specifies the offset as a decimal proportion of the full axis length. For a
continuous axis, the offset follows the highest data value or highest tick value,
whichever is greater.
Default AUTOCOMPRESS
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
Default AUTOCOMPRESS
Range 0–1. The sum of OFFSETMAX= and OFFSETMIN= should not be more
than 1.
REVERSE=TRUE | FALSE
specifies whether tick values should appear in the reverse order.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
SHORTLABEL="string"
specifies an alternate axis label to display when the default label or the label
specified by the LABEL= option is too long to fit the available space.
When LABELPOSITION=CENTER (default), the available space for an axis label is
the full axis, including the axis offsets. When LABELPOSITION=DATACENTER,
the available space for an axis label is the axis tick display area, which excludes the
axis offsets. If the label length exceeds the available space, then the label is anchored
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1045
at the left or bottom offset. It extends beyond the opposing offset until it reaches the
end of the axis where it is truncated. An ellipsis designates the truncation.
This option has effect only when the LABELPOSITION= option is set
to CENTER or DATACENTER.
Note If the specified label is itself too long for the grid length or the grid
width, then it is truncated in the display.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TIMEOPTS=(time-axis-options)
specifies one or more options for a time axis.
Requirements Columns associated with a time axis must be in SAS time, SAS
date, or SAS datetime units and have an associated SAS time, date,
or datetime format.
See “Options for Time Axes Only” on page 1074 for the options that
you can use for time-axis-options.
LOG
uses a LOG axis if possible. You can add a LOGOPTS= option list to customize
this axis type.
Interaction If a log axis is requested and the axis data contains 0 or negative
values, the axis reverts to a linear axis. This outcome can occur for
the response axis of a bar chart, line chart, needle plot, or waterfall
chart when a baseline intercept of 0 or less is specified. It can also
occur for the response axis of a waterfall chart when an initial bar
value of 0 or less is specified. To get a log response axis in those
cases, set the baseline intercept or initial bar value to a positive
value.
Default AUTO
Interactions If this option is set to anything other than AUTO, then plots within the
layout are dropped from the display if their data types or data ranges
do not match the axis type requirements. For more information, see
“Plot Axis Types Must Agree on Common Axes” on page 883.
After the axis type is determined (whether you set a specific type or
AUTO is in effect), you can use only options that are supported by
that axis type. For example, if TYPE=TIME, then only the general
OVERLAY axis options and those available on TIMEOPTS= are
supported.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
Example The following example specifies the axis tick values 10, 20, 30, and
40, and the tick display values A, B, C, and D:
tickvaluelist=("10" "20" "30" "40");
tickdisplaylist=("A" "B" "C" "D");
TICKTYPE=MIDPOINT | INBETWEEN
specifies the position of the axis tick marks.
Default MIDPOINT
Note Starting with the second maintenance release of SAS 9.4, when
TICKTYPE=INBETWEEN, the outermost tick marks and grid lines at
each end of the axis are not drawn.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
EXTRACT
displays consecutive integers along the axis instead of the actual tick values in
order to represent those tick values. In most cases, this policy is implemented if
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1049
the system estimates that a collision might occur. If no collision occurs, then the
actual tick values are displayed on the axis in the normal manner.
EXTRACTALWAYS
same as EXTRACT, except that the extraction is implemented regardless of
whether collision occurs.
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
SPLIT
splits the tick value at a split character, which is specified by the
TICKVALUESPLITCHAR= option, only when necessary in order to make the
value fit the available space. A split does not occur at a split character if a split is
not needed at that location. If the value does not contain any of the specified split
characters, then the value is not split. Values that are not split or that do not fit the
available space even after splitting might overlap the adjoining space.
See TICKVALUESPLITCHAR=
SPLITALWAYS
always splits the axis tick value at every occurrence of a split character that is
specified by the TICKVALUESPLITCHAR= option.
See TICKVALUESPLITCHAR=
SPLITALWAYSTHIN
same as SPLITALWAYS, except that thinning is performed when long words do
not fit the available space.
SPLITTHIN
same as SPLIT, except that thinning is performed when long words do not fit the
available space.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
EXTRACT
display consecutive integers along the axis instead of the actual tick values to
represent those tick values. In most cases, this policy is implemented if the
system estimates that a collision might occur. If no collision occurs, then the
actual tick values are displayed on the axis in the normal manner.
EXTRACTALWAYS
same as EXTRACT, except that the extraction is implemented regardless of
whether collision occurs.
NONE
does not attempt to fit tick values that collide.
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATEALWAYSDROP
attempts the ROTATEALWAYS policy, and then drops the tick values if
collisions still occur.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
SPLIT
splits the tick value at a split character, which is specified by the
TICKVALUESPLITCHAR= option, only when necessary in order to make the
value fit the available space. A split does not occur at a split character if a split is
not needed at that location. If the value does not contain any of the specified split
characters, then the value is not split. Values that are not split or that do not fit the
available space even after splitting might overlap the adjoining space.
See TICKVALUESPLITCHAR=
SPLITALWAYS
always splits the axis tick value at every occurrence of a split character that is
specified by the TICKVALUESPLITCHAR= option.
See TICKVALUESPLITCHAR=
SPLITROTATE
attempts the SPLIT policy, and then the ROTATE policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1051
STAGGERTRUNCATE
attempts the STAGGER policy, and then the TRUNCATE policy.
THIN
eliminates alternate tick values.
TRUNCATE
shortens the tick values when they exceed a certain number of characters.
TRUNCATEROTATE
attempts the TRUNCATE policy, and then the ROTATE policy.
TRUNCATESTAGGER
attempts the TRUNCATE policy, and then the STAGGER policy.
TRUNCATETHIN
attempts the TRUNCATE policy, and then the THIN policy.
Note A note is written to the SAS log when tick value thinning occurs.
TICKVALUEFORMAT=format
specifies how to format the values for major tick marks.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Interaction This option is ignored when the axis tick values are extracted to an
axis legend. See TICKVALUEFITPOLICY=EXTRACT |
EXTRACTALWAYS on page 1048.
Tip Use this option when you want to duplicate tick values on an axis.
TICKVALUELIST=(string-list)
specifies the list of tick values that are to be displayed on the axis.
string-list
a space-separated list of values, enclosed in parentheses. You must enclose each
value in the list in quotation marks.
Only the tick values that are included in the string list are displayed on the axis. The
values are displayed in the order in which they are listed. The data values that are not
in the list are dropped. The list can be a subset of the data values. It can also contain
values that are not included in the actual data. A tick value that is not included in the
data appears on the axis, but no data is represented at its tick mark.
Notes If the string list contains duplicate values, then the first occurrence
of the duplicated value in the list is honored and the remaining
instances are ignored.
1052 Chapter 8 • Axis Options in Layouts
When the values specified in the list are compared with the actual
data values, leading blanks are honored and trailing blanks are
ignored.
Tips You can use this option to subset the axis values or to display the
values in a specific order.
You can use this option to display values on the axis that are not
contained in the data.
Examples The following example specifies the axis tick values Sedan, Sports,
Wagon, and SUV:
tickvaluelist=("Sedan" "Sports" "Wagon" "SUV")
The following example specifies the axis tick values 10, 20, 30, and
40:
tickvaluelist=("10" "20" "30" "40")
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
TICKVALUESPLITCHAR="character-list"
specifies a list of characters on which the tick values can be split, if needed. When
multiple characters are specified, each character in the list is treated as a separate
split character unless the specified characters appear consecutively in the tick value.
In that case, all of the specified split characters together are treated as a single split
character.
When TICKVALUESPLITPOLICY=SPLIT, if a tick value collision is detected, then
the tick value is split on a split character only if necessary at that point in order to
avoid collision. In that case, a split might not occur on every split character. When
TICKVALUEFITPOLICY=SPLITALWAYS, the tick value is split unconditionally
on every occurrence of a split character. If the tick value does not contain any of the
specified split characters, then it is not split.
"character-list"
one or more characters with no delimiter between each character.
TICKVALUESPLITCHARDROP=TRUE | FALSE
specifies whether the split characters should be included in the displayed tick values.
The split characters are specified by the TICKVALUESPLITCHAR= option.
TRUE
drops the split characters from the tick value display. The following figure shows
an example in which TICKVALUESPLITCHARDROP=TRUE and three-word,
asterisk-delimited tick values are split on the asterisk character by using the
SPLITALWAYS policy.
line. The characters that follow the split character, up to and including the split
character at the next split point, are then wrapped to the following line. This
process repeats until the entire data tick value is displayed. The following figure
shows an example in which TICKVALUESPLITCHARDROP=FALSE and
three-word, asterisk-delimited tick values are split on the asterisk character by
using the SPLIT policy.
Notice that a split occurs on the first asterisk and not at the second. In this case, a
split is not needed at the second asterisk.
If the fit policy is SPLITALWAYS or SPLITALWAYSTHIN, and
TICKVALUESPLITCHARDROP=FALSE, then each tick value is split at every
instance of a split character in the value regardless of whether a split is actually
needed. Each split character remains as the last character in the current line. The
characters that follow each split character, up to and including the next split
character, are then wrapped to the next line. The following figure shows an
example in which TICKVALUESPLITCHARDROP=FALSE and three-word,
asterisk-delimited tick values are split on the asterisk character by using the
SPLITALWAYS policy.
Notice that a split occurs after each asterisk and each asterisk appears at the end
of the line. In this case, three lines are displayed.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
INTEGER=TRUE | FALSE
specifies that evenly spaced integer values are used for tick marks.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1057
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
Defaults Four ticks with five intervals in the first maintenance release of SAS
9.4 and earlier releases.
One tick with two intervals starting with the second maintenance
release of SAS 9.4.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
THRESHOLDMAX=number
specifies a bias for including one more tick mark at the maximum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
THRESHOLDMIN=number
specifies a bias for including one more tick mark at the minimum end of the axis.
Default 0.30
Range 0–1
Tips If the threshold is set to 0, the potential tick mark is never displayed. If
the threshold is set to 1, then the tick mark is always displayed.
TICKDISPLAYLIST=(string-list)
specifies the text that is displayed for the tick values that are defined in the
TICKVALUELIST= option. The string list is a space-separated list of string values
that are displayed on the axis in place of the values in the TICKVALUELIST=
option. The strings map one-to-one positionally with the values that are listed in the
TICKVALUELIST= option.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an axis. The effectiveness of a
collision-avoidance policy depends on the number of tick values, their length, and
the length of the axis. Which policies are valid depends on the axis on which this
option is used. For the Y and Y2 axes, the following policies are valid:
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
THIN
eliminates alternate tick values.
For the X and X2 axes, the following policies are valid:
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
THIN
eliminates alternate tick values.
Default THIN
Note A note is written to the SAS log when tick value thinning occurs.
MAXWIDTH=integer
specifies the maximum width for displayed tick values. Values might be
rounded or converted to E notation to fit into this width.
Default 8
MAXDECIMALS=integer
specifies the maximum number of decimals for displayed tick values. Values
might be rounded or converted to E notation to fit into this width.
Default 6
PREFERREDDECIMALS=integer
specifies the number of decimal places that you want to display for most
values. The actual number might vary based on other constraints.
Default 2
EXTRACTSCALE=TRUE | FALSE
specifies whether to extract a scale factor from the tick values and use it to
reduce the tick value width. The scale can be a named scale or a scientific-
notation scale. The EXTRACTSCALETYPE= option specifies the scale type.
The scale that is used is appended to the axis label, as shown in the following
example.
Total Sales (millions)
For long axis labels, if the scale does not fit the available space, then the label
is truncated, and the scale is appended to the truncated label. Ellipses indicate
that the label was truncated, as shown in the following example.
Total Sales for the Fourth Quarter Of ... (millions)
In extreme cases in which the scale does not fit even with truncation, the
entire axis is dropped.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you
can use.
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
specifies whether to extract a named scale or a scientific-notation scale.
1062 Chapter 8 • Axis Options in Layouts
DEFAULT
extracts a named scale. A named scale can be millions, billions, or
trillions for values of 999 trillion or less, or a multiple of 10 (denoted as
10^n) for values over 999 trillion. For large tick values, the scale factor is
set to ensure that the absolute value of the largest value is greater than 1.
For small fractional tick values, the scale factor is set to ensure that the
absolute value of the smallest value is greater than 1. The scale can be
millionth, billionth, or trillionth for values of 1 trillionth or more, or a
multiple of 1/10 (10^–n) for values less than 1 trillionth.
SCIENTIFIC
extracts a scientific-notation scale. A scientific-notation scale is a
multiple of 10 expressed as 10^n for values greater than 1, or a multiple
of 1/10 expressed as 10^–n for values less than 1.
Default DEFAULT
Restriction The scale is derived from the English locale for all locales.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are the tick values in numeric-list that fall
within the explicit data range (set by VIEWMIN= and VIEWMAX=)
or the implicit data range (set by the actual data minimum and data
maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the minimum tick list value and
the VIEWMAX= option is set to the maximum tick list value, then all
ticks in the tick list are displayed. This might result in some data not
being displayed. For example, data might not be displayed when the
VIEWMIN= value is greater than the actual data minimum, or when
the VIEWMAX= value is less than actual data maximum.
Tip The values in the list are formatted according to the setting for the
TICKVALUEFORMAT= option.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether an axis tick specification (TICKVALUELIST= or
TICKVALUESEQUENCE=) can extend the axis data range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by either the TICKVALUELIST= or
TICKVALUESEQUENCE= option. If the minimum and maximum of the user-
specified values are within the data range, this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
1064 Chapter 8 • Axis Options in Layouts
Default DIAGONAL
TICKVALUESEQUENCE=(sequence-options)
specifies the tick values by start, end, and increment.
(sequence-options)
a space-separated list of the following name-value-pair options that control major
tick values. You must provide all three options.
START=number
specifies the value for the first tick mark.
END=number
specifies the value for the last tick mark.
INCREMENT=number
specifies the increment for intermediate tick marks between the first and last
tick marks. The END value always controls the last tick mark. The interval
between the last tick mark and the previous tick mark might not necessarily
be the INCREMENT value.
Default An internal algorithm determines the tick marks, based on the actual
axis data range or the data range established by the VIEWMIN= and
VIEWMAX= options. By default, when this option is used, the only
tick values that appear are those that fall within the explicit data range
(set by VIEWMIN= and VIEWMAX=) or the implicit data range (set
by the actual data minimum and data maximum).
The VIEWMIN= and VIEWMAX= options alter the axis data range.
If the VIEWMIN= option is set to the START= option value and the
VIEWMAX= option is set to the END= option value, then all ticks in
the tick sequence are displayed.
Tip The values in the sequence are formatted according to the setting for
the TICKVALUEFORMAT= option.
VIEWMAX=number
specifies the maximum data value to include in the display. The value might be
adjusted by the threshold calculation.
Default The maximum value in the data for the specified axis.
Interactions This option does not determine the maximum axis tick value that is
displayed. The THRESHOLDMAX= value is used to determine the
maximum tick value.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display. The value might be
adjusted by the threshold calculation.
Default The minimum value in the data for the specified axis.
Interactions This option does not determine the minimum axis tick value that is
displayed. The THRESHOLDMIN= value is used to determine the
minimum tick value.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
BASE=10 | 2 | E
specifies the base of the logarithmic scale for the axis values.
Default 10
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1067
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKCOUNT=positive-integer
specifies the number of minor ticks that are displayed on the axis.
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
Base=10
Base=2
Base=E
LOGEXPONENT
places the major tick marks at uniform intervals at integer powers of the base.
The tick values are only the integer exponents for all bases.
LINEAR
places the major tick marks at non-uniform intervals that cover the range of the
data.
Default AUTO
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
TICKVALUEFORMAT=DATA | format
specifies how to format the values for major tick marks.
1070 Chapter 8 • Axis Options in Layouts
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
DATA
uses the format that has been assigned to the column that is contributing to the
axis (or BEST6 if no format is assigned) in order to control the formatting of the
major tick values.
format
specifies a format to apply to the major tick values.
Restriction GTL currently honors most, but not every, SAS format. For details,
see Appendix 4, “SAS Formats Not Supported,” on page 1353.
See BASE=
TICKINTERVALSTYLE=
TICKVALUELIST=(numeric-list)
specifies the tick values for a linear axis as a list.
Default Only the tick values specified in the list that fall within the explicit
data range set by the VIEWMIN= and VIEWMAX= options or by
the implicit data range set by the actual data minimum and data
maximum are displayed. An internal algorithm determines the tick
marks.
Interactions The VALUESTYPE= option determines how the values in the list
are interpreted.
displayed when the VIEWMIN= value is greater than the actual data
minimum, or when the VIEWMAX= value is less than actual data
maximum.
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether the TICKVALUELIST= specification can extend the axis data
range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by the TICKVALUELIST= option. If the
minimum and maximum of the user-specified values are within the data range,
this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
VALUESTYPE=EXPANDED | EXPONENT
specifies the scale that the system uses when interpreting the TICKVALUELIST=,
VIEWMAX=, and VIEWMIN= option values. Use this option to choose your
preferred way of specifying log-axis values.
1072 Chapter 8 • Axis Options in Layouts
EXPANDED values are interpreted as powers of the base such as 0.1, 1, 10,
100, and so on, for base 10, for example.
EXPONENT values are interpreted as integer exponents of the base such as 1,
2, 3, and so on, for base 10, base 2, and base E.
Default EXPANDED
Note This option does not change the style of the tick values that are
displayed on the axis. It changes only how the VIEWMIN=,
VIEWMAX=, and TICKVALUELIST= option values are interpreted by
the system.
VIEWMAX=number
specifies the maximum data value to include in the display.
Default The maximum value in the data for the specified axis.
Requirement The value that you specify must be appropriate for the
VALUESTYPE= specification and the log base. Otherwise,
unexpected results might occur. If VALUESTYPE=EXPANDED is in
effect (default), specify an increment of the log base power such as
0.1, 1, 10, 100, and so on, on a base 10 log axis, for example. If
VALUESTYPE=EXPONENT is in effect, specify an integer
increment of the log base power exponent such as 1, 2, 3, and so on.
default value for VIEWMAX= is less than the value specified by the
VIEWMIN= option, then the VIEWMIN= and VIEWMAX= values
are swapped.
The maximum axis tick value might differ from the VIEWMAX=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use
the TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display.
Default The minimum value in the data for the specified axis.
Requirement The value that you specify must be appropriate for the
VALUESTYPE= specification and the log base. Otherwise,
unexpected results might occur. If VALUESTYPE=EXPANDED is in
effect (default), specify an increment of the log base power such as
0.1, 1, 10, 100, and so on, on a base 10 log axis, for example. If
VALUESTYPE=EXPONENT is in effect, specify an integer
increment of the log base power exponent such as 1, 2, 3, and so on.
The minimum axis tick value might differ from the VIEWMIN=
value. The VIEWMIN= and VIEWMAX= values, and additional
factors such as thresholds and the tick values computed by the plot
statement, are used to determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
INTERVAL=interval
specifies the time interval between major ticks. Valid interval keywords are AUTO,
SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,
QUARTER, SEMIYEAR, YEAR.
1076 Chapter 8 • Axis Options in Layouts
Default AUTO. An appropriate interval is chosen based on the data and the
column date, date-time, or time format.
Requirement The data column(s) mapped to a time axis must be in the same
duration units: TIME, DATE, or DATETIME. The selection of an
interval must be consistent with the duration unit. For example, if the
data are in time units, you can specify only AUTO, SECOND,
MINUTE, HOUR.
INTERVALMULTIPLIER=positive-integer
specifies a multiplier to apply to the time interval that is in effect for the axis.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default 1
MINORGRID=TRUE | FALSE
specifies whether grid lines are displayed at the minor tick marks.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
Interaction This option is ignored if the GRIDDISPLAY= option does not display
the grid lines.
Tips The GRIDATTRS= option does not affect the appearance of the minor
grid lines. To control the minor grid line appearance, use the
MINORGRIDATTRS= option.
Use the MINORTICKS= option to display the minor tick marks on the
axis.
See “boolean ” on page 1339 for other Boolean values that you can use.
The following figure shows the minor grid lines set to light blue, dotted lines on a time
axis. (See the example.)
Defaults The GraphGridLines style element is used starting with SAS 9.4.
Tip Use the GRIDATTRS= option to control the appearance of the major
grid lines.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Example Here is an example that specifies light blue, dotted lines for the minor
grid.
minorgridattrs=(color=lightblue pattern=dot);
MINORTICKINTERVAL=interval
specifies the time interval between minor ticks. See Table 8.6 on page 1076 for
information about the intervals that you can select. The interval that you select must
be consistent with the axis data duration units such as TIME, DATE, or DATETIME.
For example, if the axis data is in TIME units, then you must specify AUTO,
SECOND, MINUTE, or HOUR.
Default AUTO
MINORTICKS=TRUE | FALSE
specifies whether minor ticks are displayed. When MINORTICKS=TRUE, the minor
tick marks are displayed on the axis as shown in the following figure.
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1079
Default FALSE
Tip Use the MINORGRID= option to display grid lines at the minor tick
values.
See “boolean ” on page 1339 for other Boolean values that you can use.
SPLITTICKVALUE=TRUE | FALSE
specifies whether to split the tick values on an X or X2 axis, if possible. This option
is not available for a Y or Y2 axis.
TRUE
splits the axis tick values into two lines allowing more tick values to appear. For
example, with INTERVAL= MONTH, this is how tick values are split:
FALSE
does not split the axis tick values. For example, when this option specifies
FALSE, this is how the tick values in the previous example appear:
Typically, fewer tick values fit, causing thinning, rotation, or staggering of the
values. See the TICKVALUEFITPOLICY= option.
Default TRUE
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEFITPOLICY=policy
specifies a policy for avoiding tick value collision on an X or X2 axis. This option is
not available for the Y and Y2 axes. The effectiveness of a collision-avoidance
policy depends on the number of tick values, their length, and the length of the axis.
The following policies are valid:
1080 Chapter 8 • Axis Options in Layouts
NONE
makes no attempt to avoid collisions between tick values. Tick values are display
even when they collide.
ROTATE
rotates the tick values if a collision occurs. The TICKVALUEROTATION=
option specifies whether the values are rotated to a 45-degree diagonal or a 90-
degree vertical position. By default, the values are rotated to a 45-degree
diagonal position.
ROTATEALWAYS
rotates the tick values regardless of whether a collision occurs. The
TICKVALUEROTATION= option specifies whether the values are rotated to a
45-degree diagonal or a 90-degree vertical position. By default, the values are
rotated to a 45-degree diagonal position.
ROTATETHIN
attempts the ROTATE policy, and then the THIN policy.
STAGGER
alternates the tick values between two rows.
STAGGERROTATE
attempts the STAGGER policy, and then the ROTATE policy.
STAGGERTHIN
attempts the STAGGER policy, and then the THIN policy.
THIN
eliminates alternate tick values.
Default THIN
Interaction When SPLITTICKVALUE= TRUE, this option is ignored and only the
THIN policy is used.
Note A note is written to the SAS log when tick value thinning occurs.
TICKVALUEFORMAT=format | DATA
specifies how to format the values for major tick marks.
format
specifies a SAS date, time, or datetime format to control how the major tick
values are displayed. This format must be in the same duration units as the data
column(s) mapped to a time axis: TIME, DATE, or DATETIME and should be
appropriate for the value of the INTERVAL= option. For example, if
INTERVAL=MONTH and there are two years of data displayed on the axis, then
choosing TICKVALUEFORMAT=YEAR. would result in several ticks having
the same year value.
DATA
specifies that the SAS date, time, or datetime format associated with the data
column assigned to the axis be used to control how the major tick values are
displayed.
Default The default format used by the INTERVAL= option. The default does
not apply if TICKVALUELIST= is specified.
GTL currently honors most but not every SAS format. For details, see
Appendix 4, “SAS Formats Not Supported,” on page 1353.
Interactions The values in the list are formatted according to the format specified
on the TICKVALUEFORMAT= option. If TICKVALUEFORMAT=
is not used, then the values are formatted according to the column
format (the default TICKVALUEFORMAT value is not applied to
these values).
TICKVALUEPRIORITY=TRUE | FALSE
specifies whether the TICKVALUELIST= specification can extend the axis data
range.
TRUE
extends the axis data range (but does not reduce it) to include the minimum and
maximum values that are specified by the TICKVALUELIST= option. If the
minimum and maximum of the user-specified values are within the data range,
this option has no effect.
FALSE
displays only the tick values that are specified by the TICKVALUELIST= option
that fall within the explicit data range set by the VIEWMIN= and VIEWMAX=
options or by the implicit data range set by the actual data minimum and data
maximum.
Default FALSE
Restriction This option is valid only in the ROWAXIS= and ROW2AXIS= layout
axis options.
Interactions When this option is set to TRUE, the VIEWMIN= and VIEWMAX=
options are ignored.
1082 Chapter 8 • Axis Options in Layouts
Note If the minimum and maximum of the specified values are within the
data range, then this option has no effect.
See “boolean ” on page 1339 for other Boolean values that you can use.
TICKVALUEROTATION=DIAGONAL | VERTICAL
specifies how the tick values are rotated on the X and X2 axes.
Default DIAGONAL
VIEWMAX=number
specifies the maximum data value to include in the display.
Default The maximum value in the data for the specified axis.
Notes Setting a VIEWMAX= or VIEWMIN= value does not alter the original
data or any calculations on it.
The maximum axis tick value might differ from the VIEWMAX= value.
The VIEWMIN= and VIEWMAX= values, and additional factors such as
thresholds and the tick values computed by the plot statement, are used to
determine the axis tick values.
Tip To display the VIEWMAX= value as the maximum tick value, use the
TICKVALUELIST= option.
VIEWMIN=number
specifies the minimum data value to include in the display.
Default The minimum value in the data for the specified axis.
Notes Setting a VIEWMAX= or VIEWMIN= value does not alter the original
data or any calculations on it.
The minimum axis tick value might differ from the VIEWMIN= value. The
VIEWMIN= and VIEWMAX= values, and additional factors such as
Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1083
thresholds and the tick values computed by the plot statement, are used to
determine the axis tick values.
Tip To display the VIEWMIN= value as the minimum tick value, use the
TICKVALUELIST= option.
Details
The LAYOUT DATALATTICE and LAYOUT DATAPANEL statements each create a
grid of graphs based on the values of one or more classification variables. In the grid, the
axes are always external and displayed on the “primary” axes by default. The axes that
are considered primary depend on the settings for the XAXIS= and YAXIS= options in
plot statements that are specified within the LAYOUT PROTOTYPE. For managing the
primary axes, both the LAYOUT DATALATTICE and LAYOUT DATAPANEL
statements have COLUMNAXISOPTS=, COLUMN2AXISOPTS=, ROWAXISOPTS=,
and ROW2AXISOPTS= options that manage the axis features separately for columns
and rows. The settings that are available can manage odd and even columns and rows
separately, enabling you to simplify the axis display within the grid.
The following table shows which axis is primary for the XAXIS= and YAXIS= settings,
and which axis option to use to manage that primary axis.
The settings that are available for the axis options can manage odd and even columns
and rows separately, enabling you to simplify the axis display within the grid.
• To manage the first, third, and odd occurrences of a primary axis, use the DISPLAY=
option.
• To manage the second, fourth, and even occurrences of a primary axis, use the
ALTDISPLAY= option.
You can also display “secondary” axes in the grid. A secondary axis is not an
independent axis. Rather, it mirrors the primary axis, but it is displayed on the opposite
side and can have different display options. For example, when the X axis (bottom) is
primary, you can mirror that axis with a secondary X axis at the top of the grid.
Similarly, when the Y2 axis (right) is primary, you can mirror that axis with a secondary
Y2 axis on the left of the grid. A secondary axis makes it easier to interpolate values in
the cells that are farthest away from the primary axis.
Secondary axes can be displayed in the graph, provided all plot statements in the
LAYOUT PROTOTYPE map data to the same primary axis. For example, a secondary
X axis can be displayed at the top of the layout, provided all plot statements set
XAXIS=X to map data to the primary X axis (bottom). Similarly, a secondary Y2 axis
can be displayed to the left in the layout, provided all plot statements set YAXIS=Y2 to
map data to the primary Y2 axis (right). If all plot statements in the LAYOUT
1084 Chapter 8 • Axis Options in Layouts
PROTOTYPE do not map data to the same primary axis, then the secondary axes are not
displayed.
To display secondary axes in the grid, use the DISPLAYSECONDARY= and
ALTDISPLAYSECONDARY= options. As with the options for the primary axes, the
DISPLAYSECONDARY= option manages the first, third, and odd occurrences of a
secondary axis. The ALTDISPLAYSECONDARY= option manages the second, fourth,
and even occurrences of a secondary axis.
In the default cases for the plots within the layout, the axis type is always DISCRETE,
LINEAR, or TIME. The TYPE= option enables you to specify an axis type that
overrides the default. For example, when appropriate for the data, you can request a
LOG axis. When you override the default axis type, you must be sure to specify the
correct axis type for the plot(s) that you are defining.
Each axis type has features specific to that type, and the following axis options enable
you to specify features for the different types: DISCRETEOPTS= , LINEAROPTS= ,
LOGOPTS= , and TIMEOPTS= . One or more of these options can be specified for an
axis, but the specified settings are applied only to the axis type that supports them.
Note: Certain plot types or layouts sometimes impose restrictions on what type of axis
can be assigned. See the plot or layout documentation for default axis types and any
restrictions that might apply.
The following graph was generated by the “Example Program” on page 1085:
Example: Axis Options for LAYOUT DATALATTICE and LAYOUT DATAPANEL 1085
Example Program
This example shows how axis attributes can be managed separately for even and odd
columns and rows in the layout grid. In this case, the ROWAXISOPTS= option is used
to stagger the Y-axes attributes. On the primary (left) Y axis, DISPLAY= displays
TICKS and TICKVALUES on the first and third rows while ALTDISPLAY= displays
just TICKS on the second row. On the secondary (right) Y axis,
DISPLAYSECONDARY= displays just TICKS on the first and third rows, while
ALTDISPLAYSECONDARY= displays TICKS and TICKVALUES on the second row.
This alternating pattern could also have been set for the column axes. The pattern is
independent of the number of rows and columns.
proc template;
define statgraph layoutdatalattice;
begingraph;
entrytitle "Annual Furniture Sales Comparisons";
layout datalattice rowvar=country columnvar=year /
rowdatarange=union
headerlabellocation=inside
headerlabeldisplay=value
headerbackgroundcolor=GraphAltBlock:color
rowaxisopts=(griddisplay=on
display=(tickvalues)
altdisplay=(ticks)
displaysecondary=(ticks)
altdisplaysecondary=(ticks tickvalues)
linearopts=(tickvalueformat=dollar12.))
columnaxisopts=(display=(tickvalues)
timeopts=(tickvalueformat=monname3.));
layout prototype / cycleattrs=true;
seriesplot x=month y=TotalActual / name="Actual";
seriesplot x=month y=TotalPredict / name="Predict";
endlayout;
sidebar / align=bottom;
discretelegend "Actual" "Predict" / border=false;
endsidebar;
endlayout;
endgraph;
end;
run;
Part 6
Legend Statements
Chapter 9
Legend Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
1088
1089
Chapter 9
Legend Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
AXISLEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
CONTINUOUSLEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098
DISCRETELEGEND and MERGEDLEGEND Statements . . . . . . . . . . . . . . . . 1109
LEGENDITEM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1126
LEGENDTEXTITEMS Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131
Dictionary
AXISLEGEND Statement
Generates consecutive integers for display as axis-tick values in the graph, and creates a legend that
correlates those integers with the actual tick values that they represent.
Requirements: The axis must be named with the axis NAME= option.
The axis must be a discrete axis (TYPE=DISCRETE).
The axis must use the TICKVALUEFITPOLICY=EXTRACT or
TICKVALUEFITPOLICY=EXTRACTALWAYS suboption of the DISCRETEOPTS=
axis option.
Interaction: A legend might be dropped if the total legend area in the graph exceeds the
percentage that is set by the MAXLEGENDAREA= option in an ODS GRAPHICS
statement that is in effect for the output destination. A legend might also be dropped
if DISPLAYCLIPPED= FALSE and the full legend cannot be displayed.
Syntax
AXISLEGEND "axis-name" </option(s)>;
Appearance options
ACROSS=positive-integer
specifies the number of legend entries that are placed horizontally before the
next row begins.
BACKGROUNDCOLOR=style-reference | color
1090 Chapter 9 • Legend Statements
Location options
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the legend is automatically aligned within its parent layout
when nested within an overlay-type layout.
HALIGN=CENTER | LEFT | RIGHT | number
specifies the horizontal alignment of the legend within its parent layout when
nested within an overlay-type or region layout.
LOCATION=OUTSIDE | INSIDE
specifies whether the legend appears inside or outside the plot area when the
legend is specified within an overlay-type or region layout.
VALIGN=CENTER | TOP | BOTTOM | number
specifies the vertical alignment of the legend within its parent layout when
nested within an overlay-type or region layout.
Text options
TITLE="string"
specifies the title of the legend.
TITLEATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the legend title.
Required Argument
"axis-name"
references an axis’s name. The name controls which axis determines the legend
entries.
Optional Arguments
ACROSS=positive-integer
specifies the number of legend entries that are placed horizontally before the next
row begins.
Default The entries are placed to best fit the available area. This “best fit”
approach works only when the legend is nested in the template’s
outermost layout.
Default NONE
Restriction AUTO is available only when the parent layout contains a scatter plot.
Otherwise, it is ignored.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the legend background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
Interaction OPAQUE= TRUE must be in effect for the color to be seen. By default,
OPAQUE=FALSE.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the legend.
1092 Chapter 9 • Legend Statements
Defaults TRUE in the first maintenance release of SAS 9.4 and earlier releases.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element
DISPLAYCLIPPED=TRUE | FALSE
specifies whether the legend is displayed when any portion of the legend cannot be
rendered entirely. Based on the legend contents and placement, or when the graph
size is reduced, parts of the legend (title, legend symbol, or legend value) might be
clipped (truncated). When clipping occurs and this option is set to FALSE, the entire
legend is removed from the graph. The space for that legend is then reclaimed by the
remainder of the graph. When this option is set to TRUE, the legend always appears,
even if some parts of it have been clipped.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
DOWN=positive-integer
specifies the number of legend entries that are placed vertically before the next
column begins.
Default The entries are placed to best fit the available area. This “best fit”
approach works only when the legend is nested in the template’s
outermost layout.
Default CENTER
Restriction This option is available only when this statement is nested within an
overlay-type or region layout.
LOCATION=OUTSIDE | INSIDE
specifies whether the legend appears inside or outside the plot area when the legend
is specified within an overlay-type or region layout.
Default OUTSIDE
Restriction This option has effect only when the legend statement appears within
an overlay-type or region layout and at least one stand-alone plot
statement is referenced by the parent layout.
Interactions The actual position is determined by the settings for the LOCATION=,
AUTOALIGN= , HALIGN= , and VALIGN= options.
OPAQUE=TRUE | FALSE
specifies whether the legend background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether legend entries are organized into rows or into columns.
Default ROWMAJOR
1094 Chapter 9 • Legend Statements
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the legend perimeter.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the legend perimeter.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
TITLE="string"
specifies the title of the legend.
Default No title
Interactions For this option to have any effect, the TITLE= option must also be
specified.
If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, style), then non-specified
properties will be derived from the GraphLabelText style element.
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Default CENTER
Restriction This option is available only when this statement is nested within an
overlay-type or region layout. It is ignored if the parent layout is not
an overlay-type or region layout.
Interaction If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, style), then non-specified
properties will be derived from the GraphLabelText style element.
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Details
An AXISLEGEND statement is used to consolidate the axis display so that a large
number of tick values can be clearly displayed without collision. In an axis legend, the
legend symbol is a positive integer that is generated to represent a specific axis tick
position, and the legend value displays the axis tick value. In the “Example:
AXISLEGEND Statement” on page 1097 , the first legend symbol is the integer 1 and
the first legend value is Neon SE 4dr.
To implement an axis legend, all of the following requirements must be met:
Example: AXISLEGEND Statement 1097
• The axis must be a discrete axis. The axis can be discrete by default, or explicitly set
to discrete by setting TYPE=DISCRETE among the parent layout’s axis-option
settings.
• The parent layout’s axis options must specify NAME= to assign a name to the axis.
• The parent layout’s axis options must use the DISCRETEOPTS= option to specify
either TICKVALUEFITPOLICY=EXTRACT or
TICKVALUEFITPOLICY=EXTRACTALWAYS. EXTRACT implements an axis
legend if the system estimates that a collision might occur. EXTRACTALWAYS
implements an axis legend regardless of whether a collision occurs.
• The AXISLEGEND statement must reference the axis name that was specified in the
parent layout’s NAME= axis option.
When all of these requirements are satisfied, the tick values of the named discrete axis
can be replaced with consecutive positive integers. The axis legend displays those
integer values and the corresponding tick values that the integers represent.
Within an overlay-type layout, when an axis legend is placed inside the plot area with
LOCATION= INSIDE,
• The axis legend is always placed on top of plot lines and markers.
• By default, its background is fully transparent ( OPAQUE= FALSE), meaning that
underlying lines, markers, and data labels show through the legend.
• Its position can be controlled with the AUTOALIGN= option, or with the HALIGN=
and VALIGN= options.
Within an overlay-type layout, when an axis legend is placed outside the plot area with
LOCATION=OUTSIDE,
• By default, its background is fully opaque (OPAQUE=TRUE).
• Its position can be controlled with the HALIGN= and VALIGN= options.
When an axis legend is placed within nested layouts, it might be necessary to do one of
the following to obtain the desired legend organization:
• use the ACROSS= option and also set ORDER= ROWMAJOR
• use the DOWN= option and also set ORDER=COLUMNMAJOR
The following graph was generated by the “Example Program” on page 1098 . The
LAYOUT OVERLAY statement’s XAXISOPTS= option uses NAME= to assign a name
to the X axis so that it can be referenced in an AXISLEGEND statement. The LAYOUT
OVERLAY statement’s DISCRETEOPTS= option specifies
TICKVALUEFITPOLICY=EXTRACT, which implements the axis legend if a collision
occurs in the tick-value display for the X axis. The AXISLEGEND statement references
the name that was assigned to the X axis.
1098 Chapter 9 • Legend Statements
Example Program
proc template;
define statgraph axislegend ;
begingraph;
entrytitle "Mileage for Vehicles Made by Dodge";
layout overlay / xaxisopts=(name="xaxis"
discreteopts=(tickvaluefitpolicy=extract)) ;
barchart category=model response=mpg_highway / stat=mean ;
axislegend "xaxis";
endlayout;
endgraph;
end;
CONTINUOUSLEGEND Statement
Creates a legend with a color ramp corresponding to a range of values.
Syntax
CONTINUOUSLEGEND "graph-name" </option(s)>;
CONTINUOUSLEGEND Statement 1099
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the legend background.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the legend.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the legend.
INTEGER=TRUE | FALSE
specifies whether only integer tick values are used in the continuous legend.
OPAQUE=TRUE | FALSE
specifies whether the legend background is opaque (TRUE) or transparent
(FALSE).
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the legend.
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space that is added outside the legend border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the legend
perimeter.
VALUEATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the legend values.
Location options
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the legend is automatically aligned within its parent layout
when nested within an overlay-type layout.
HALIGN=CENTER | LEFT | RIGHT | number
specifies the horizontal alignment of the legend within its parent layout when
nested within an overlay-type or region layout.
LOCATION=OUTSIDE | INSIDE
specifies whether the legend appears inside or outside the plot area when the
legend is specified within an overlay-type or region layout.
VALIGN=CENTER | TOP | BOTTOM | number
specifies the vertical alignment of the legend within its parent layout when
nested within an overlay-type or region layout.
Scale options
EXTRACTSCALE=TRUE | FALSE
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
Text options
TITLE="string"
specifies the title of the legend.
TITLEATTRS=style-element | style-element (text-options) | (text-options)
1100 Chapter 9 • Legend Statements
Required Argument
"graph-name"
specifies the plot to be represented by the legend. The plot is identified by the name
that is assigned to it on the plot statement’s NAME= option.
Optional Arguments
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the legend is automatically aligned within its parent layout when
nested within an overlay-type layout.
NONE
does not automatically align the legend within its parent layout. The legend’s
position is set by the HALIGN= and VALIGN= options.
AUTO
within the parent layout, attempts to center the legend in the area that is farthest
from any surrounding data point markers.
(location-list)
within the parent layout, restricts the legend’s possible locations to those
locations in the specified location-list, and use the location-list position that least
collides with the parent layout’s other graphics features. The location-list is
space-separated and can contain any of these locations: TOPLEFT, TOP,
TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and
BOTTOMRIGHT.
Default NONE
BACKGROUNDCOLOR=style-reference | color
specifies the color of the legend background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
Interaction OPAQUE= TRUE must be in effect for the color to be seen. By default,
OPAQUE=FALSE.
CONTINUOUSLEGEND Statement 1101
BORDER=TRUE | FALSE
specifies whether a border is displayed around the legend.
Defaults FALSE in the first maintenance release of SAS 9.4 and earlier releases.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
Tip The color of the frame around the color ramp and the color ramp tick
lines is controlled by the GraphAxisLines:contrastColor style attribute.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element
EXTRACTSCALE=TRUE | FALSE
specifies whether to extract a scale factor from the tick values and use it to reduce
the tick value width. The scale can be a named scale or a scientific-notation scale.
The EXTRACTSCALETYPE= option specifies the scale type. The scale used is
appended to the legend title as shown in the following example.
Total Sales (millions)
For long legend titles, if the scale does not fit the available space, then the title is
truncated, and the scale is appended to the truncated title. Ellipses indicate that the
label was truncated as shown in the following example.
Total Sales for the Fourth Quarter Of ... (millions)
In extreme cases where the title does not fit even with truncation, the title is dropped.
See “boolean ” on page 1339 for other Boolean values that you can use.
EXTRACTSCALETYPE=DEFAULT | SCIENTIFIC
specifies whether to extract a named scale or a scientific-notation scale.
1102 Chapter 9 • Legend Statements
DEFAULT
extracts a named scale. A named scale can be millions, billions, or trillions for
values of 999 trillion or less, or a multiple of 10 (denoted as 10^n) for values
over 999 trillion. For small fractional tick values, the scale factor is set to ensure
that the absolute value of the smallest value is greater than 1. The scale can be
millionth, billionth, or trillionth for values of 1 trillionth or more, or a multiple of
1/10 (10^–n) for values less than 1 trillionth.
SCIENTIFIC
extracts a scientific-notation scale. A scientific-notation scale is a multiple of 10
expressed as 10^n for values greater than 1, or a multiple of 1/10 expressed as
10^–n for values less than 1.
HALIGN=CENTER | LEFT | RIGHT | number
specifies the horizontal alignment of the legend within its parent layout when nested
within an overlay-type or region layout.
number
specifies an explicit position in the containing layout.
Restriction This option is available only when this statement is nested within an
overlay-type or region layout.
INTEGER=TRUE | FALSE
specifies whether only integer tick values are used in the continuous legend.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default FALSE
CONTINUOUSLEGEND Statement 1103
Restriction This option applies only to smooth color gradients. For leveled
gradients such as those used with contour plots of type FILL,
LINEFILL or LABELEDLINEFILL, this option is ignored. See
CONTOURTYPE=.
LOCATION=OUTSIDE | INSIDE
specifies whether the legend appears inside or outside the plot area when the legend
is specified within an overlay-type or region layout.
Default OUTSIDE
Restriction This option has effect only when the legend statement appears within
a 2-D overlay-type layout and there is at least one stand-alone plot
statement with XY axes that is referenced by the legend.
Interactions The actual position is determined by the settings for the LOCATION=,
AUTOALIGN= , HALIGN= , and VALIGN= options.
OPAQUE=TRUE | FALSE
specifies whether the legend background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORIENT=VERTICAL | HORIZONTAL
specifies the orientation of the legend.
Default VERTICAL
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the legend perimeter.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the legend perimeter.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
CONTINUOUSLEGEND Statement 1105
TITLE="string"
specifies the title of the legend. The title is placed below the legend body.
Default No title
Interactions For this option to have any effect, the TITLE= option must also be
specified.
If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, style), then non-specified
properties will be derived from the GraphLabelText style element.
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
Default CENTER
Restriction This option is available only when this statement is nested within an
overlay-type or region layout. It is ignored if the parent layout is not
an overlay-type or region layout.
Interaction If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, style), then non-specified
properties will be derived from the GraphLabelText style element.
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
VALUECOUNTHINT=positive-integer
recommends a number of values for the continuous legend to use to label the data
range.
Default 6
Restriction The associated plot must be displayed with smooth gradient for this
option to have any effect. For example, in a contour plot,
CONTOURTYPE must be set to GRADIENT or LINEGRADIENT.
Details
A continuous legend consists of a color ramp and a numeric scale indicating color
values.
CONTINUOUSLEGEND Statement 1107
In the following figure, the continuous legend references a contour plot with a fixed
number of levels. The color ramp and legend values automatically reflect these discrete
levels. The legend option VALUECOUNTHINT= has no effect.
In this next figure, the continuous legend references a contour plot with a continuous
gradient. The number of legend values displayed is automatically determined by the
legend, or decided by the contributing plot, such as the CONTOURPLOTPARM with
CONTOURTYPE=FILL. For plots with a continuous gradient, you can use the legend
option VALUECOUNTHINT= to control how many legend values appear. (This option
is ignored if there is no gradient.)
Within an overlay-type layout, when a continuous legend is placed inside the plot area
with LOCATION= INSIDE,
• It is always placed on top of plot lines and markers.
• By default, its background is fully transparent ( OPAQUE= FALSE), meaning that
underlying lines, markers, and data labels show through the legend.
1108 Chapter 9 • Legend Statements
• Its position can be controlled with the AUTOALIGN= option, or with the HALIGN=
and VALIGN= options.
Within an overlay-type layout, when a continuous legend is placed outside the plot area
with LOCATION=OUTSIDE,
• By default, its background is fully opaque (OPAQUE=TRUE).
• Its position can be controlled with the HALIGN= and VALIGN= options.
The following graph was generated by the “Example Program” on page 1108:
Example Program
proc template;
define statgraph continuouslegend;
begingraph;
entrytitle "Height and Weight Distribution";
layout overlay;
scatterplot x=height y=weight /
markercolorgradient=density
markerattrs=(symbol=squarefilled size=6px)
name="scatter";
continuouslegend "scatter" / orient=vertical
location=outside valign=center halign=right
valuecounthint=10 title="Density";
endlayout;
endgraph;
DISCRETELEGEND and MERGEDLEGEND Statements 1109
end;
run;
ods graphics / reset width=475px;
proc sgrender data=sashelp.gridded(where=(count>0))
template=continuouslegend;
run;
Syntax
DISCRETELEGEND "graph-name-1" | "legend-item-name-1" | "discrete-attr-name-1"
<"graph-name-2" | "legend-item-name-2" | "discrete-attr-name-2"…> </option(s)>;
MERGEDLEGEND "graph-name" | "legend-item-name" | "discrete-attr-name"
"graph-name" | "legend-item-name" | "discrete-attr-name"
</option(s)>;
Appearance options
ACROSS=positive-integer
specifies the number of legend entries that are placed horizontally before the
next row begins.
AUTOITEMSIZE=TRUE | FALSE
specifies that all markers, lines, and filled symbols in the legend are sized in
proportion to the font size used for the legend entry labels.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the legend background.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the legend.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
1110 Chapter 9 • Legend Statements
Content options
ADDITIONALNAMES=("graph-name" | "legend-item-name" | "discrete-attr-name"
<"graph-name" | "legend-item-name" | "discrete-attr-name">…)
specifies additional legend items that are to be added to the two items that are
required in the MERGEDLEGEND statement.
EXCLUDE=(item-names)
specifies a list of legend entries to exclude from the display.
TYPE=ALL | FILL | FILLCOLOR | LINE | LINECOLOR | LINEPATTERN |
MARKER | MARKERCOLOR | MARKERSYMBOL | TEXT
specifies which visual attributes to display for legend entries in the legend.
Location options
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the legend is automatically aligned within its parent layout
when nested within an overlay-type layout.
HALIGN=CENTER | LEFT | RIGHT | number
specifies the horizontal alignment of the legend within its parent layout when
nested within an overlay-type or region layout.
DISCRETELEGEND and MERGEDLEGEND Statements 1111
LOCATION=OUTSIDE | INSIDE
specifies whether the legend appears inside or outside the plot area when the
legend is specified within an overlay-type or region layout.
VALIGN=CENTER | TOP | BOTTOM | number
specifies the vertical alignment of the legend within its parent layout when
nested within an overlay-type or region layout.
Text options
TITLE="string"
specifies the title of the legend.
TITLEATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the legend title.
Required Arguments
"graph-name"
references one or more unique names that are specified by the NAME= option of a
plot statement. These names control which plots contribute to the legend, and the
order in which the legend entries occur. If a contributing plot uses a GROUP=
option, then there is a legend entry for each group value that is present in the data.
"legend-item-name"
references one or more unique values specified by the NAME= option of a
LEGENDITEM statement. Each legend-item-name must be enclosed in quotation
marks.
"discrete-attr-name"
references one or more unique values that are specified by the NAME= option in a
DISCRETEATTRMAP statement. The discrete attribute map that the name
references contributes all of its value statements as legend items, regardless of
whether they match the data.
Optional Arguments
ACROSS=positive-integer
specifies the number of legend entries that are placed horizontally before the next
row begins. A legend entry typically consists of two parts, such as a marker symbol
and an associated value.
Default The entries are placed to best fit the available area. This “best fit”
approach works only when the legend is nested in the template’s
outermost layout.
Default NONE
Restriction AUTO is available only when the parent layout contains a scatter plot.
Otherwise, it is ignored.
AUTOITEMSIZE=TRUE | FALSE
specifies that all markers, lines, and filled symbols in the legend are sized in
proportion to the font size used for the legend entry labels. These proportional sizes
take effect regardless of the size reported by the plot or LEGENDITEM. The line
segments are drawn as deemed appropriate by the legend, regardless of the line
thickness reported by the plot.
Default FALSE
Interaction When set to TRUE, this setting considers the font size in effect from
the VALUEATTRS= option.
See “boolean ” on page 1339 for other Boolean values that you can use.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the legend background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
Interaction OPAQUE= TRUE must be in effect for the color to be seen. By default,
OPAQUE=FALSE.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the legend.
Defaults TRUE in the first maintenance release of SAS 9.4 and earlier releases.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element
DISPLAYCLIPPED=TRUE | FALSE
specifies whether the legend is displayed when any portion of the legend cannot be
rendered entirely. Based on the legend contents and placement, or when the graph
size is reduced, parts of the legend (title, legend symbol, or legend value) might be
clipped (truncated). When clipping occurs and this option is set to FALSE, the entire
legend is removed from the graph. The space for that legend is then reclaimed by the
1114 Chapter 9 • Legend Statements
remainder of the graph. When this option is set to TRUE, the legend always appears,
even if some parts of it have been clipped.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
DOWN=positive-integer
specifies the number of legend entries that are placed vertically before the next
column begins. A legend entry typically consists of two parts, such as a marker
symbol and an associated value.
Default The entries are placed to best fit the available area. This “best fit”
approach works only when the legend is nested in the template’s
outermost layout.
EXCLUDE=(item-names)
specifies a list of legend entries to exclude from the display.
Requirement Each item name must be enclosed in quotation marks and separated
from adjacent names by a space.
Note When the specified names are compared with the legend entry names,
leading blanks are honored and trailing blanks are ignored.
Tip For plots with groups, you can exclude specific group values.
Example The following example excludes items Truck and Wagon from the
legend.
exclude=("Truck" "Wagon")
FILLITEMOUTLINE=AUTO | ON
specifies whether the fill swatches are outlined only when enabled by the
contributing statements or are always outlined.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
AUTO honors the DISPLAY= option settings for the contributing plot or the
FILLDISPLAY= setting of the legend item.
ON always outlines the fill swatches.
Default AUTO
Interaction The legend must display fill entries for this option to have any effect.
Note The outlines are always 1 pixel wide with a solid pattern.
DISCRETELEGEND and MERGEDLEGEND Statements 1115
Default CENTER
Restriction This option is available only when this statement is nested within an
overlay-type or region layout.
ITEMSIZE=(size-options)
specifies the size of specific types of items that are in a discrete or merged legend.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
The following size options are supported:
FILLASPECTRATIO=AUTO | GOLDEN | positive-number
specifies the aspect ratio for the fill swatches.
Note: This feature applies to the third maintenance release of SAS 9.4 and to
later releases.
AUTO
uses an equal width and height for color swatches with solid color fills, or
uses the golden ratio for swatches with pattern fills.
GOLDEN
specifies the golden ratio of 1.618 (width = 1.618 * height) for both solid
color and pattern fill swatches.
positive-number
specifies a custom aspect ratio.
1116 Chapter 9 • Legend Statements
Default AUTO
This option does not apply to bubble plot fill color swatches (filled
circle).
Interactions The legend must display fill entries for this option to have any
effect.
style-reference
specifies a style attribute that controls the height of the fill swatches. The
style reference must provide a valid dimensional value.
Default AUTO
Interactions The legend must display fill entries for this option to have any
effect.
HEIGHTSCALE=positive-number
specifies a scale factor that is to be applied to the fill swatch height. Values
greater than 1 increase the height of the fill swatches, and values less than 1
reduce the height.
Note: This feature applies to the third maintenance release of SAS 9.4 and to
later releases.
Default 1.5
Interactions The legend must display fill entries for this option to have any
effect.
LINELENGTH=dimension
specifies the length of the line glyph for line entries in the legend.
Interaction The legend must display line entries for this option to have any
effect.
LOCATION=OUTSIDE | INSIDE
specifies whether the legend appears inside or outside the plot area when the legend
is specified within an overlay-type or region layout.
Default OUTSIDE
Restriction This option has effect only when the legend statement appears within
an overlay-type or region layout and at least one stand-alone plot
statement is referenced by the parent layout.
Interactions The actual position is determined by the settings for the LOCATION=,
AUTOALIGN= , HALIGN= , and VALIGN= options.
OPAQUE=TRUE | FALSE
specifies whether the legend background is opaque (TRUE) or transparent (FALSE).
Default FALSE
1118 Chapter 9 • Legend Statements
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether legend entries are organized into rows or into columns.
Default ROWMAJOR
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
Starting with the first maintenance release of SAS 9.4, the default padding
between the discrete legend and the plot area (including the axes) is
increased to 10 pixels, depending on the context. If the new default
padding is not desirable, then use the OUTERPAD= option to adjust it.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the legend perimeter.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the legend perimeter.
DISCRETELEGEND and MERGEDLEGEND Statements 1119
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
SORTBY=LABEL | TEXT
specifies whether text legend items are sorted by label or by text.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
Default LABEL
SORTORDER=AUTO | ASCENDINGFORMATTED |
DESCENDINGFORMATTED
specifies the sort order to use for the legend entry labels.
Default AUTO. Groups of legend entries are presented in the order in which
they are listed in the legend statement. The internal ordering of the
entries is derived from the constituent plot-statement options.
Interactions This option overrides the order that is set by any constituent plot
statement’s GROUPORDER= option.
TITLE="string"
specifies the title of the legend. The title is placed to the left of the legend body,
except in the following cases:
• The legend contains two or more rows of items.
• The legend is in a nested layout.
• The legend is in an OVERLAYEQUATED layout.
• The legend title length exceeds the space that is available on the left side of the
legend.
In those cases, the title is placed above the legend body.
Default No title
Interactions For this option to have any effect, the TITLE= option must also be
specified.
If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, style), then non-specified
properties will be derived from the GraphLabelText style element.
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
TITLEBORDER=TRUE | FALSE
specifies a border around the legend title that separates it from the legend body.
Default FALSE
Tip The line attributes of the title border are set by the BORDERATTRS=
options.
See “boolean ” on page 1339 for other Boolean values that you can use.
Default ALL
Default CENTER
Restriction This option is available only when this statement is nested within an
overlay-type or region layout. It is ignored if the parent layout is not
an overlay-type or region layout.
Interaction If one or more text options are specified and they do not include all the
font properties (color, family, size, weight, style), then non-specified
properties will be derived from the GraphLabelText style element.
Note When you specify style-element, only the style attributes COLOR,
FONTFAMILY, FONTSIZE, FONTSTYLE, and FONTWEIGHT are
used.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Details
A discrete legend consists of one or more units called legend entries. Each legend entry
consists of a legend symbol and a legend value. The legend symbol is typically a marker,
line, or filled symbol that represents a specific area in the plot. The legend value is
descriptive text that is derived from group values, or that is assigned by the plot’s
LEGENDLABEL= option or by the LEGENDITEM statement’s LABEL= option. To
specify a discrete legend, you can use the DISCRETELEGEND statement. To
consolidate legend entries for common grouped values that are represented by two
separate plots, you can use the MERGEDLEGEND statement.
For grouped plots, a discrete legend represents all of the values that are present in the
data. To ensure that legend entries are displayed for group values, regardless of whether
DISCRETELEGEND and MERGEDLEGEND Statements 1123
those values are present in the data, you can use a discrete attribute map as described in
“Displaying Legend Entries for Group Values That Are Not in the Data” on page 1293.
In the DISCRETELEGEND statement, you can specify one or more names that
reference the source for the legend entry values. You can use the TYPE= option to
control the visual attributes for the legend display.
For legend items that represent fills or colors without a specific shape, a filled symbol
with a one-pixel-wide, solid outline is used to represent the data values. If the feature
being represented by the legend item has an outline, then the default outline color is
derived from the feature’s outline color. If the feature being represented is an outline
only or is a filled outlined marker, then the outline thickness is derived from the plot. If
the feature does not have an outline, then the default outline color for its corresponding
legend entry is derived from the GraphOutline style element.
You can use the MERGEDLEGEND statement to consolidate lines and marker symbols
from discrete legend entries when a graph displays grouped values for exactly two plots.
With a MERGEDLEGEND statement, the legend values from the group variables in two
plots are compared. For each common value, the corresponding legend lines and marker
symbols are combined, and only one legend entry is created for each matching set of
group values. You can use the MERGEDLEGEND statement only for grouped plots.
You must specify two names that reference the source for the legend entry values.
When a discrete legend is placed inside the plot area of an overlay type layout and
LOCATION= INSIDE, the following conditions apply:
• The discrete legend is always placed on top of plot lines and markers.
• By default, the background of the discrete legend is fully transparent ( OPAQUE=
FALSE). Underlying lines, markers, and data labels show through the legend.
• You can control the position of the discrete legend with the AUTOALIGN= option,
or with the HALIGN= and VALIGN= options. (The AUTOALIGN= option is not
available in a LAYOUT OVERLAY3D statement.)
When a discrete legend is placed outside the plot area of an overlay type layout and
LOCATION=OUTSIDE, the following conditions apply:
• By default, the background of the discrete legend is fully opaque
(OPAQUE=TRUE).
• You can control the position of the discrete legend with the HALIGN= and
VALIGN= options.
When a discrete legend is placed within nested layouts, you might need to do one of the
following to obtain the legend organization that you want:
• use the ACROSS= option, and also set ORDER= ROWMAJOR
• use the DOWN= option, and also set ORDER=COLUMNMAJOR
A legend might be dropped if the total legend area in the graph exceeds the percentage
that is set by the MAXLEGENDAREA= option in an ODS GRAPHICS ON statement
that is in effect for the output destination. A legend might also be dropped if
DISPLAYCLIPPED= FALSE and the full legend cannot be displayed.
1124 Chapter 9 • Legend Statements
Examples
Example Program
proc template;
define statgraph discretelegend;
begingraph;
entrytitle "Prediction Ellipses";
layout overlayequated / equatetype=equate;
scatterplot x=petallength y=petalwidth /
group=species name="s";
ellipse x=petallength y=petalwidth /
type=predicted alpha=0.2
name="p80" legendlabel="80%"
outlineattrs=graphconfidence;
ellipse x=petallength y=petalwidth /
type=predicted alpha=0.05
name="p95" legendlabel="95%"
outlineattrs=graphconfidence2;
discretelegend "s" / title="Species:" ;
discretelegend "p80" "p95" / across=1
autoalign=(topleft) location=inside ;
endlayout;
entryfootnote halign=left "Fisher's Iris Data";
endgraph;
end;
Example 2: MERGEDLEGEND Statement 1125
Example Program
proc sort data=sashelp.class
out =class;
by sex;
run;
proc template;
define statgraph mergedLegend;
begingraph;
entrytitle "Linear Regression By Gender";
layout overlay;
scatterplot x=height y=weight / group=sex name="scat";
regressionplot x=height y=weight/ group=sex name="reg";
mergedlegend "scat" "reg" / border=true;
endlayout;
endgraph;
end;
LEGENDITEM Statement
Creates the definition for a legend item that can be included in a discrete legend.
Restriction: The LEGENDITEM statement is used with the DISCRETELEGEND and
MERGEDLEGEND statements only.
Requirement: The LEGENDITEM statement must appear in the global definition area of the
template between the BEGINGRAPH statement and the first LAYOUT statement.
Note: The LEGENDITEM statement creates the definition for a legend item that can be
included in a discrete legend.
See: “DISCRETELEGEND and MERGEDLEGEND Statements” on page 1109
Syntax
LEGENDITEM TYPE=type NAME="string" </option(s)>;
Appearance options
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the color of the fill when TYPE= is set to FILL.
FILLDISPLAY=STANDARD | ALL | (FILL | OUTLINE)
specifies whether the fill swatch for this legend item displays fill only or
displays fill and outline.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the appearance of the line when TYPE= is set to LINE or
MARKERLINE.
MARKERATTRS=style-element | style-element (marker-options) | (marker-options)
specifies the appearance of the marker when TYPE= is set to MARKER or
MARKERLINE.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the color of the outline when TYPE= is set to FILL.
TEXT="string"
specifies the text to display when TYPE= is set to TEXT.
TEXTATTRS=style-element | style-element (text-options) | (text-options)
specifies the font and color attributes of the string that is specified on the
TEXT= option when TYPE= is set to TEXT.
Label options
LABEL="string"
specifies a label to be used for the legend item.
LABELATTRS
specifies the color and font attributes of the legend item’s label.
LEGENDITEM Statement 1127
Required Arguments
TYPE=FILL | MARKER | MARKERLINE | LINE | TEXT
specifies a type for the legend item.
FILL
specifies a fill (displayed as a filled square). The appearance can be managed
with the FILLATTRS= and OUTLINEATTRS= options.
MARKER
specifies a marker. The appearance can be managed with the MARKERATTRS=
option.
MARKERLINE
specifies a marker and a line. The appearance can be managed with the
MARKERATTRS= and LINEATTRS= options.
LINE
specifies a line. The appearance can be managed with the LINEATTRS= option.
TEXT
specifies text that can be displayed in the legend area. The text string is defined
with the TEXT= option, and the text appearance can be managed with the
TEXTATTRS= option.
NAME="string"
assigns a name to the legend item for reference in a DISCRETELEGEND or
MERGEDLEGEND statement.
Restriction The string is case sensitive and must define a unique name within the
template.
Optional Arguments
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the color of the fill when TYPE= is set to FILL.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default STANDARD
1128 Chapter 9 • Legend Statements
Requirement You must specify TYPE=FILL for this option to have any effect.
FILLEDOUTLINEDMARKERS=TRUE | FALSE
specifies whether markers are drawn with both fill and an outline.
TRUE
draws filled markers (marker symbols with the suffix FILLED) using both fill
and an outline.
Interaction When this option is TRUE, the marker fill is drawn using the
FILLATTRS= specification, and the outline is drawn using the
OUTLINEATTRS= specification.
FALSE
draws the markers using fill or an outline, but not both.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
LABEL="string"
specifies a label to be used for the legend item.
Tip The font and color attributes for the label are specified by the
LABELATTRS= option.
LABELATTRS
specifies the color and font attributes of the legend item’s label.
Interaction For this option to take effect, the LABEL= option must also be
specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Interaction The WEIGHT attribute cannot be derived from the style element, but it
can be set with this option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Restriction This option uses only the color specification in the style element or line
options. The line pattern and line thickness specifications are ignored.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TEXT="string"
specifies the text to display when TYPE= is set to TEXT. The font and color
attributes for the text are specified by the TEXTATTRS= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Details
The LEGENDITEM statement creates a definition for a legend item that can be included
in a legend. The item that you define is independent of the data and enables you to
customize the legend to enhance or replace a standard legend. For example, to display
annotation text within the legend area, you can define a LEGENDITEM statement with
TYPE=TEXT and specify the text in the TEXT= option.
As demonstrated in the “Example Program” on page 1130, multiple LEGENDITEM
statements can be used to replace a plot statement’s data-driven legend by defining
custom legend items to display in the legend. This use enables you to communicate
information that is not in the data. For this use, you would define one or more
LEGENDITEM statements to specify legend attributes, and then reference those items in
your legend statement. You must not reference the plot statement itself in the legend
statement. Although no direct connection would exist between the plot data and the
legend, you could communicate the connection by managing the visual attributes in both
the plot and the legend.
The LEGENDITEM statement must be located within the BEGINGRAPH block but
outside of the outermost layout block. You can use multiple LEGENDITEM statements
1130 Chapter 9 • Legend Statements
to define multiple definitions. In that case, each definition specifies a single legend entry
and each item name must be referenced in the legend statement.
Note: A single legend statement can reference multiple item names and also multiple
plot names.
When specifying attribute options for a particular LEGENDITEM statement, options
that do not apply to the specified TYPE= value are ignored. For example, the
MARKERATTRS= option sets the attributes for a marker and is useful if you set
TYPE=MARKER or TYPE=MARKERLINE. However, if TYPE= is set to a value that
does not display a marker symbol, then the MARKERATTRS= option is ignored.
The following graph was generated by the “Example Program” on page 1130. The
example specifies three LEGENDITEM statements to define graphical properties for
two marker symbols and a text string. The NAME= option in each LEGENDITEM
statement assigns a name to the definition. Those names are referenced in a
DISCRETELEGEND statement so that the definitions are displayed in the graph legend.
To correlate the legend with the scatter plot, the example creates an attribute map that
matches values M and F to the same graphical properties that are specified in the
LEGENDITEM statements. That attribute map is referenced in the scatter plot.
Example Program
proc template;
define statgraph scatterplot;
begingraph;
entrytitle "Team Tryouts: Height and Weight by Sex";
discreteattrmap name="symbols" / ignorecase=true trimleading=true;
LEGENDTEXTITEMS Statement 1131
LEGENDTEXTITEMS Statement
Creates the definition for data-driven text items that can be included in a discrete legend.
Restrictions: The LEGENDTEXTITEMS statement is used only with the DISCRETELEGEND
statement.
Grouping is not supported.
The maximum number of items that the LEGENDTEXTITEMS statement can
contribute to the legend is 100. If this limit is exceeded, the LEGENDTEXTITEMS
statement is dropped. If no other statements contribute to the legend in that case,
the legend is not drawn.
Requirements: The LEGENDTEXTITEMS statement must appear in the global definition area of the
template between the BEGINGRAPH statement and the first LAYOUT statement.
The TYPE= option in the legend statement that references this statement must be
set to ALL or TEXT.
Note: This feature applies to the third maintenance release of SAS 9.4 and to later
releases.
See: “DISCRETELEGEND and MERGEDLEGEND Statements” on page 1109
Syntax
LEGENDTEXTITEMS NAME="string" TEXT=column </option(s)>;
Required Arguments
NAME="string"
assigns a name to the legend items for reference in a DISCRETELEGEND or
MERGEDLEGEND statement.
1132 Chapter 9 • Legend Statements
TEXT=column
specifies the column in the plot data set that contains the text items.
Notes One item is added for each observation. Grouping is not supported.
The TEXT column should not contain missing values. A missing TEXT
column value is treated as if no text is specified. If an observation contains a
missing TEXT column value and a valid LABEL column value, only the
label value is added to the legend for that observation. If both values are
missing, nothing is added to the legend.
Optional Arguments
LABEL=column
specifies the column that contains the labels for the legend items.
Note Each observation that has a LABEL column value should have a
corresponding TEXT column value. If an observation contains a valid
LABEL column value and a missing TEXT column value, only the label
value is added to the legend for that observation.
Tip The font and color attributes for the label are specified by the
LABELATTRS= option.
Note Space is reserved in the legend for the height of the legend label text
regardless of whether the LABEL= option is specified.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element value.
See “General Syntax for Attribute Options” on page 1347 for the syntax for
using a style-element value.
Details
The LEGENDTEXTITEMS statement creates a definition for data-driven text legend
items that can be included in a discrete legend. The items that you define in the data are
independent of the plot and enable you to customize the legend in order to enhance or
replace a standard legend. The text items are stored in the plot data set in the column that
is specified by the TEXT= option. The LEGENDTEXTITEMS statement must be
located within the BEGINGRAPH block but outside of the outermost layout block. You
reference the LEGENDTEXTITEMS statement in your legend statement by the name
specified in the NAME= option. You must not reference the plot statement itself in the
legend statement. To add items from multiple columns, specify one
LEGENDTEXTITEMS statement for each column, and then reference all of the
LEGENDTEXTITEMS statements in your legend statement. Although no direct
connection would exist between the plot data and the legend, you could communicate
the connection by managing the visual attributes in both the plot and the legend.
The following graph was generated by the “Example Program” on page 1133. The
graph shows a scatter plot of height and weight by sex for 19 participants in a team
tryout. To reduce clutter in the plot, a numeric ID is used to label the marker for each
individual in the plot. A legend in the right margin of the graph displays the participant
name for each ID.
Example Program
In this example program, a LEGENDTEXTITEMS statement is used to create the legend
of IDs and names in the right margin of the graph. The name IDLEGEND is assigned to
the LEGENDTEXTITEMS statement. The ID column provides the legend text items,
and the Name column provides a name as the label for each text item. Here is the SAS
code.
/* Assign a numeric ID to each name */
1134 Chapter 9 • Legend Statements
data class;
set sashelp.class;
id=_N_;
run;
Part 7
Text Statements
Chapter 10
Managing Text Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1137
Chapter 11
Text Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1147
1136
1137
Chapter 10
Managing Text Items
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1137
Using Prefix Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1138
Available Prefix Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1138
Managing Horizontal Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1138
Managing Font Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139
Using Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140
Available Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140
Subscripting and Superscripting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1141
Using UNICODE Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1141
Rules for Unicode and Special Character Specifications . . . . . . . . . . . . . . . . . . . 1142
Reserved Keywords and Unicode Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1142
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1142
Lowercase Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1143
Uppercase Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1144
Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145
Overview
The ENTRY, ENTRYTITLE, and ENTRYFOOTNOTE statements all use the same
syntax for specifying one or more pieces of text called text items. For example, here is
the ENTRYTITLE syntax:
ENTRYTITLE text-item <…<text-item>> </option(s)>;
Each text item can be specified using the following syntax:
<prefix-option…<prefix-option>> "string" | dynamic | character-expression | {text-command}
The simplest specification for each statement is to specify a string in quotation marks.
For example, you might specify a graph title as follows:
In this example, the string “Height and Weight by Sex” is formatted as the graph title
and displayed in the title position. If multiple strings are specified, then they are
concatenated into a single line of text. This second specification generates the same title:
entrytitle "Height " "and " "Weight " "by " "Sex";
1138 Chapter 10 • Managing Text Items
To provide control over the text, multiple prefix options can precede each text item, and
the text item can be a string literal, a dynamic, or a text command. All text items with the
same HALIGN= setting are concatenated into one string. Up to three strings with
different horizontal alignment can result for each ENTRY statement. Leading and
trailing blanks in the concatenated string are always used.
• a string must be enclosed in quotation marks.
• a character expression must be enclosed in an EVAL function.
• a text command must be enclosed in braces. (See “Using Text Commands” on page
1140).
entry "One" " Two" " Three" " Four" " Five" " Six";
The HALIGN= option can be used to change the horizontal alignment to LEFT,
CENTER, or RIGHT. The following specification left-justifies the text:
entry halign=left
"One" " Two" " Three" " Four" " Five" " Six";
Text items are positionally concatenated by alignment area. For example, the following
specification left-justifies the first three strings and right-justifies the last three strings:
Using Prefix Options 1139
Even if the HALIGN= specifications are jumbled, the final text is nevertheless
positionally concatenated by alignment area:
Note: When long strings are used or the bounding container is constrained, the
alignment areas might overlap.
• The TEXTATTRS= options are reset each time a new TEXTATTRS= appears—there
is no “carry over” or accumulation of the settings.
• Blanks (spaces) must be provided as needed to achieve the desired concatenation.
When concatenating dynamics that are stripped of leading and trailing blanks, a
literal space must be inserted to separate them, as shown in the following example:
Alternatively, font attributes can be specified by overriding the style element defaults.
The following specification overrides the settings of the GraphTitleText style element,
which sets the default attributes for ENTRYTITLE text:
entrytitle
halign=left
textattrs=GraphTitleText(color=black style=italic) "Left"
textattrs=GraphTitleText(color=red style=italic) " side"
1140 Chapter 10 • Managing Text Items
halign=center
textattrs=(color=black) "Center"
textattrs=(color=red) " Text"
halign=right
textattrs=GraphTitleText(color=black weight=bold) "Right "
textattrs=GraphTitleText(color=red weight=bold) "side" ;
Dynamics can also be used in the text strings. In the following ENTRYTITLE statement,
assume that _DEPLABEL and _MODELLABEL are dynamics that are specified on
PROC TEMPLATE’s DYNAMIC statement:
• The default style element for ENTRYTITLE is GraphTitleText, so all three text items
(one literal and two dynamics) get these font properties as a starting point.
• The text "Residual by Predicted for " _DEPLABEL is center-aligned by default.
• The prefix options HALIGN= and TEXTATTRS= override the center alignment and
font properties for the text _MODELLABEL.
This could have been coded as follows:
entrytitle halign=left
textattrs=GraphTitleText _MODELLABEL
halign=center textattrs=()
"Residual by Predicted for " _DEPLABEL;
In this example, the second HALIGN= and TEXTATTRS=() are necessary to reset
alignment and font properties to their defaults.
The string length of the resolved dynamic _MODELLABEL does not affect the
placement of the center-aligned text.
The opening and closing braces are required to denote the scope of the command.
The textattrs=() option cancels all style overrides and reverts to the default text
properties.
The default formatting for the UNICODE text is derived from the GraphUnicodeText
style element.
In the following example, if _ALPHAVAL is an existing dynamic that resolves to the
value 0.05, then the following ENTRY specification generates this text:
By combining the TEXTATTRS= prefix option with the {SUB} and {UNICODE} text
commands, you can generate the following text:
1142 Chapter 10 • Managing Text Items
Overview
The tables in this section show some of the reserved keywords and Unicode values that
can be used with the UNICODE text command. For information about rendering
Unicode characters, see “Managing the String on Text Statements” in SAS Graph
Template Language: User's Guide.
Note the following:
• Keywords and Unicode values are not case-sensitive: "03B1"x is the same code point
as "03b1"x.
• The word blank is the keyword for a blank space.
Reserved Keywords and Unicode Values 1143
mu μ 03BC lowercase mu
nu ν 03BD lowercase nu
xi ξ 03BE lowercase xi
pi π 03C0 lowercase pi
Special Characters
Chapter 11
Text Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1147
ENTRY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1147
ENTRYFOOTNOTE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1154
ENTRYTITLE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162
Dictionary
ENTRY Statement
Displays a line of text in the graphical area.
Requirement: An ENTRY statement must be specified within a LAYOUT, HEADER, SIDEBAR, or
CELL statement block.
Syntax
ENTRY text-item <text-item …> </option(s)>;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the text background.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the text.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the text.
OPAQUE=TRUE | FALSE
specifies whether the text background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the entry border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
1148 Chapter 11 • Text Statements
Location options
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the text is automatically aligned within its parent when
nested within an overlay-type layout.
VALIGN=CENTER | TOP | BOTTOM
specifies the vertical alignment of the text.
Required Argument
text-item <…<text-item>>
specifies one or more pieces of text for the entry. Each text-item has the following
form:
<prefix-option <… prefix-option>>"string" | dynamic | character-expression |
{text-command}
Each piece of text can have multiple prefix settings that precede the piece of text. A
piece of text is either a string literal, a dynamic, or a text command. All text-items
with the same HALIGN= setting are concatenated into one string. Up to three strings
can result for each ENTRY statement. Leading and trailing blanks in the
concatenated string are always used.
When a prefix option is used, it applies not only to the text that immediately follows
the prefix option, but also to all subsequent text strings and text commands. If the
same prefix option appears more than once, then that prefix overrides the last used
prefix of the same name for the subsequent text strings and text commands.
Restriction The maximum length for the entry text is 512 characters in SAS 9.4
and earlier releases. Starting with the first maintenance release of
SAS 9.4, this restriction is removed.
Note Leading spaces are preserved, and trailing spaces are stripped.
Optional Arguments
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the text is automatically aligned within its parent when nested
within an overlay-type layout. For more information about how child positions are
determined in an overlay-type layout, see the “LAYOUT OVERLAY Statement” on
page 142.
ENTRY Statement 1149
NONE
does not automatically align the text within the area. Alignment is set with
HALIGN= and VALIGN= options.
AUTO
within the parent layout, attempts to center the text in the area that is farthest
from any surrounding data point markers.
Restriction This option is available only if the parent layout contains a scatter
plot. Otherwise, it is ignored.
(location-list)
within the available area, restricts the text’s possible locations to those locations
in the specified location-list, and uses the location-list position that least collides
with the other graphics features in the area. The location-list is space-separated
and can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,
CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.
Example: (TOPRIGHT TOPLEFT)
Default NONE
Requirement For this option to take effect, the ENTRY statement must be in a
LAYOUT OVERLAY or LAYOUTOVERLAYEQUATED block.
BACKGROUNDCOLOR=style-reference | color
specifies the color of the text background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
Interaction OPAQUE= TRUE must be in effect for the color to be seen. By default,
OPAQUE=FALSE.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the text.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
OPAQUE=TRUE | FALSE
specifies whether the text background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the entry border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
Interaction The bounding box is the determined by the size of the text in the
current font plus any horizontal and vertical padding. See
TEXTATTRS= and PAD= .
Notes This option can be used as both a prefix option and a statement option.
When used as a prefix option, it overrides the statement option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default CENTER
Interaction This option is ignored when AUTOALIGN= is not NONE and the
parent layout is an overlay-type layout.
1152 Chapter 11 • Text Statements
Prefix Options
HALIGN=CENTER | LEFT | RIGHT
prefix-option that specifies the horizontal alignment of a text-item. Each text-item has
a horizontal alignment, and text-items with the same alignment are always grouped
together.
Default CENTER
Interaction This option is ignored when AUTOALIGN= is not NONE and the
parent layout is an overlay-type layout.
Text Commands
{ SUB "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as subscript text.
See “Rules for Unicode and Special Character Specifications” on page 1142
Example entry "y = " b{sub "0"} " + b" {sub "1"} "x";
See “Rules for Unicode and Special Character Specifications” on page 1142
Example entry "R" {sup "2"} " = " {format (6.4) RSQUARED} ;
Details
An ENTRY statement creates one line of text in the plot area. The statement must be
specified within a LAYOUT, HEADER, SIDEBAR, or CELL statement block. It cannot
be specified outside of one of these blocks, where global statements like ENTRYTITLE
and ENTRYFOOTNOTE are used.
The text line specified in an ENTRY statement can be made of several pieces of the text
called text-items. Statement options that are used establish properties for the entire line
of text (that is, all text-items). These properties can be overridden with prefix-options
that are specific to one or more text-items. See “Required Argument” on page 1148 for
more information.
You can specify an ENTRY statement inside or outside of a nested statement block:
• When you specify an ENTRY statement inside a nested LAYOUT, HEADER,
SIDEBAR, or CELL statement block, then, by default, the text is placed inside the
bounding area of the results that the nested statement block creates.
• When you specify an ENTRY statement outside of a nested LAYOUT, HEADER,
SIDEBAR, or CELL statement block, then the text is placed outside of the bounding
area of the results that the nested statement block creates.
The following graph was generated by the “Example Program” on page 1154:
1154 Chapter 11 • Text Statements
Example Program
proc template;
define statgraph entry;
begingraph;
layout overlay;
histogram weight;
endlayout;
endgraph;
end;
run;
ENTRYFOOTNOTE Statement
Displays a footnote.
ENTRYFOOTNOTE Statement 1155
Syntax
ENTRYFOOTNOTE text-item <text-item …> </option(s)>;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the text background.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the text.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the text.
OPAQUE=TRUE | FALSE
specifies whether the text background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the entry border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
TEXTATTRS=style-element | style-element (text-options) | (text-options)
as a statement option, specifies the properties of the text. As a prefix-option,
specifies the properties of individual text-items.
Text options
HALIGNCENTER=AUTO | GRAPH
specifies whether the text is centered automatically by the system or is
always centered in the graph area.
SHORTTEXT=(text-item <...text-item>)
specifies alternate text to use if the specified text is too long for the output
width.
TEXTFITPOLICY=WRAP | SHORT | TRUNCATE
specifies how to handle text that is too long to fit in the output width.
Required Argument
text-item <…text-item>
specifies one or more pieces of text for the footnote. Each text-item has the following
form:
<prefix-option …<prefix-option>>"string" | dynamic | character-expression |
{text-command}
Each piece of text can have multiple prefix options that precede the piece of text. A
piece of text is either a string literal, a dynamic, or a text command. All text-items
with the same HALIGN= setting are concatenated into one string. Up to three strings
can result for each ENTRY statement. Leading and trailing blanks in the
concatenated string are always used.
When a prefix option is used, it applies not only to the text that immediately follows
the prefix option, but also to all subsequent text strings and text commands. If the
same prefix option appears more than once, then that prefix overrides the last used
prefix of the same name for the subsequent text strings and text commands.
1156 Chapter 11 • Text Statements
Restriction The maximum length for the footnote text is 512 characters in SAS
9.4 and earlier releases. Starting with the first maintenance release
of SAS 9.4, this restriction is removed.
Note Leading spaces are preserved, and trailing spaces are stripped.
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the text background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
Interaction OPAQUE= TRUE must be in effect for the color to be seen. By default,
OPAQUE=FALSE.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the text.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
HALIGNCENTER=AUTO | GRAPH
specifies whether the text is centered automatically by the system or is always
centered in the graph area.
AUTO
specifies that the system determines how the text is centered, as follows:
• For LAYOUT GRIDDED, LAYOUT OVERLAY3D, and LAYOUT
REGION layouts, and for LAYOUT LATTICE, LAYOUT DATAPANEL,
and LAYOUT DATALATTICE layouts that have more than one column,
center the text in the graph area.
ENTRYFOOTNOTE Statement 1157
Default AUTO
Interaction The prefix option HALIGN= must specify CENTER for this option to
have any effect.
OPAQUE=TRUE | FALSE
specifies whether the text background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the entry border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
SHORTTEXT=(text-item <...text-item>)
specifies alternate text to use if the specified text is too long for the output width. If
the shortened text is itself too long, then it is truncated.
Notes This option can be used as both a prefix option and a statement option.
When used as a prefix option, it overrides the statement option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
SHORT
specifies that the text indicated by the SHORTTEXT= option be substituted when
the text does not fit.
Requirement You must specify the SHORTTEXT= option for this option to
take effect.
TRUNCATE
specifies that the text is truncated to make it fit.
Default WRAP
Prefix Options
HALIGN=CENTER | LEFT | RIGHT
prefix-option that specifies the horizontal alignment of a text-item. Each text-item has
a horizontal alignment, and text-items with the same alignment are always grouped
together.
Default CENTER
Text Commands
{ SUB "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as subscript text.
See “Rules for Unicode and Special Character Specifications” on page 1142
Example entryfootnote "y = " b{sub "0"} " + b" {sub "1"} "x";
See “Rules for Unicode and Special Character Specifications” on page 1142
1160 Chapter 11 • Text Statements
Details
The ENTRYFOOTNOTE statement places footnote text below the graphical area. More
than one ENTRYFOOTNOTE statement can be used. Footnotes appear in the order of
the ENTRYFOOTNOTE statements within the template.
Footnotes always span the entire width of the output. By default, footnotes are “center-
aligned,” based on the type of the outermost layout. The meaning of “center-aligned”
varies by layout type and the number of columns in the layout:
The following graph was generated by the “Example Program” on page 1162:
1162 Chapter 11 • Text Statements
Example Program
proc template;
define statgraph entryfootnote;
begingraph;
layout overlay;
histogram weight;
endlayout;
endgraph;
end;
run;
ENTRYTITLE Statement
Displays a title.
Syntax
ENTRYTITLE text-item <text-item …> </option(s)>;
Appearance options
BACKGROUNDCOLOR=style-reference | color
specifies the color of the text background.
BORDER=TRUE | FALSE
specifies whether a border is displayed around the text.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the text.
OPAQUE=TRUE | FALSE
specifies whether the text background is opaque (TRUE) or transparent
(FALSE).
OUTERPAD=AUTO | dimension | (pad-options)
specifies the amount of extra space to add outside the entry border.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
TEXTATTRS=style-element | style-element (text-options) | (text-options)
as a statement option, specifies the properties of the text. As a prefix-option,
specifies the properties of individual text-items.
Text options
HALIGNCENTER=AUTO | GRAPH
ENTRYTITLE Statement 1163
Required Argument
text-item <text-item …>
specifies one or more pieces of text for the entry. Each text-item has the following
form:
<prefix-option <…prefix-option>>"string" | dynamic | character-expression |
{text-command}
Each piece of text can have multiple prefix options that precede the piece of text. A
piece of text is either a string literal, a dynamic, or a text command. All text-items
with the same HALIGN= setting are concatenated into one string. Up to three strings
can result for each ENTRY statement. Leading and trailing blanks in the
concatenated string are always used.
When a prefix option is used, it applies not only to the text that immediately follows
the prefix option, but also to all subsequent text strings and text commands. If the
same prefix option appears more than once, then that prefix overrides the last used
prefix of the same name for the subsequent text strings and text commands.
Restriction The maximum length for the title text is 512 characters in SAS 9.4
and earlier releases. Starting with the first maintenance release of
SAS 9.4, this restriction is removed.
Note Leading spaces are preserved, and trailing spaces are stripped.
See Chapter 10, “Managing Text Items,” on page 1137 for more
information and several examples.
Optional Arguments
BACKGROUNDCOLOR=style-reference | color
specifies the color of the text background.
style-reference
specifies a style reference in the form style-element:style-attribute. Only the
style-attribute named COLOR or CONTRASTCOLOR is used.
Interaction OPAQUE= TRUE must be in effect for the color to be seen. By default,
OPAQUE=FALSE.
1164 Chapter 11 • Text Statements
BORDER=TRUE | FALSE
specifies whether a border is displayed around the text.
Default FALSE
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER= TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
HALIGNCENTER=AUTO | GRAPH
specifies whether the text is centered automatically by the system or is always
centered in the graph area.
AUTO
specifies that the system determines how the text is centered, as follows:
• For LAYOUT GRIDDED, LAYOUT OVERLAY3D, and LAYOUT
REGION layouts, and for LAYOUT LATTICE, LAYOUT DATAPANEL,
and LAYOUT DATALATTICE layouts that have more than one column,
center the text in the graph area.
• For LAYOUT OVERLAY and LAYOUT OVERLAYEQUATED layouts, and
for LAYOUT LATTICE, LAYOUT DATAPANEL, and LAYOUT
DATALATTICE layouts that have only one column, center the text in the
graph wall area. If the length of the text exceeds the width of the graph wall
area, then center the text in the graph area instead.
GRAPH
specifies that the text is always centered in the graph area.
Default AUTO
Interaction The prefix option HALIGN= must specify CENTER for this option to
have any effect.
OPAQUE=TRUE | FALSE
specifies whether the text background is opaque (TRUE) or transparent (FALSE).
Default FALSE
Interaction When this option is set to FALSE, the background color is not used.
See “boolean ” on page 1339 for other Boolean values that you can use.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the entry border.
(pad-options)
a space-separated list of one or more of the following name-value pair options,
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
Default AUTO
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the entry border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
SHORTTEXT=(text-item <…text-item>)
specifies alternate text to use if the specified text is too long for the output width. If
the shortened text is itself too long, then it is truncated.
Notes This option can be used as both a prefix option and a statement option.
When used as a prefix option, it overrides the statement option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
SHORT
specifies that the text indicated by the SHORTTEXT= option be substituted when
the title does not fit.
Requirement You must specify the SHORTTEXT= option for this option to
take effect.
TRUNCATE
specifies that the text is truncated to make it fit.
Default WRAP
ENTRYTITLE Statement 1167
Prefix Options
HALIGN=CENTER | LEFT | RIGHT
prefix-option that specifies the horizontal alignment of a text-item. Each text-item has
a horizontal alignment, and text-items with the same alignment are always grouped
together.
Default CENTER
Text Commands
{ SUB "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as subscript text.
See “Rules for Unicode and Special Character Specifications” on page 1142
Example entrytitle "y = " b{sub "0"} " + b" {sub "1"} "x";
See “Rules for Unicode and Special Character Specifications” on page 1142
Details
The ENTRYTITLE statement places title text above the graphical area. More than one
ENTRYTITLE statement can be used. Titles appear in the order of the ENTRYTITLE
statements within the template.
The following graph was generated by the “Example Program” on page 1169:
Example: ENTRYTITLE Statement 1169
Example Program
proc template;
define statgraph entrytitle;
begingraph;
layout overlay;
histogram weight;
endlayout;
endgraph;
end;
run;
Part 8
Chapter 12
Custom Marker Definition Statements . . . . . . . . . . . . . . . . . . . . . . . . . . 1173
1172
1173
Chapter 12
Custom Marker Definition
Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1173
SYMBOLCHAR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1173
SYMBOLIMAGE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1180
Dictionary
SYMBOLCHAR Statement
Defines a marker symbol using a Unicode character so that the symbol can be referenced in other
statements.
Note: This statement is valid in the first maintenance release of SAS 9.4 and later
releases.
Syntax
SYMBOLCHAR NAME=marker-name CHAR="hex-string"x | keyword | dynamic
</ option(s)>;
Required Arguments
NAME=marker-name
specifies a name for the marker symbol. The name can be used in statements that
support marker symbols.
Interaction If the name matches one of the system-provided symbol names such as
CIRCLE, then the system symbol is replaced by the user-defined
symbol. See “Marker Options” on page 1350 for a list of the system-
provided symbols.
"hex-string"x
specifies a four-byte hexadecimal constant that represents a Unicode character in
the current font. You can find a complete listing of the Unicode hexadecimal
constants at the following URL:http://www.unicode.org/charts/charindex.html
keyword
specifies a SAS keyword for a Unicode character. See Appendix 2, “Reserved
Keywords and Unicode Values,” on page 1343.
dynamic
specifies a reference to a dynamic variable that resolves to either a "hex-string"x
constant or a Unicode character keyword.
Tip This statement attempts to access the specified Unicode value in the current
font. Some fonts do not support accessing characters by using their Unicode
value. Other fonts support only a limited set of Unicode values. If the Unicode
value is not accessible, then this statement might be ignored or a nonprintable
character might be substituted.
Optional Arguments
HOFFSET=number
specifies a horizontal offset for the marker symbol.
Range -0.5–+0.5, where 0.5 represents one-half of the original marker size.
Interaction Starting with the third maintenance release of SAS 9.4, the specified
offset is also applied to the marker symbol that is displayed in the
legend.
Notes Prior to the third maintenance release of SAS 9.4, a positive offset
moves the marker symbol bounding box to the right. A negative offset
moves it to the left.
Starting with the third maintenance release of SAS 9.4, a positive offset
moves the marker symbol to the right within its bounding box, and a
negative offset moves it to the left. The bounding box remains centered
on the data point. After the offset, size, and rotation are applied to the
marker symbol, any portion of the symbol that falls outside of the
marker bounding box is clipped.
Tip If clipping occurs, use this option, the VOFFSET= and SCALE=
options, and the suboption SIZE= in the MARKERATTRS= option to
remove the clipping.
ROTATE=number
specifies the angle of rotation for the marker symbol in degrees. Positive angles are
measured in the counter-clockwise direction, and negative angles are measured in the
clockwise direction.
Note An angle that exceeds 360 degrees in absolute value can be specified.
SYMBOLCHAR Statement 1175
SCALE=number
specifies a scale factor for the marker symbol as a percentage. The scale factor is
applied to the character's height and width.
Note The outer edges of the image might be clipped by the bounding box when a
large scale factor is specified.
Restriction Only the text attributes FAMILY=, STYLE=, and WEIGHT= are used.
The COLOR= and SIZE= text attributes are derived from the plot
statement's MARKERATTRS= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
VOFFSET=number
specifies a vertical offset for the marker symbol.
Range -0.5–+0.5, where 0.5 represents one-half of the original marker size.
Interaction Starting with the third maintenance release of SAS 9.4, the specified
offset is also applied to the marker symbol that is displayed in the
legend.
Notes Prior to the third maintenance release of SAS 9.4, a positive offset
moves the marker symbol bounding box up. A negative offset moves it
down.
Starting with the third maintenance release of SAS 9.4, a positive offset
moves the marker symbol up within its bounding box, and a negative
offset moves it down. The bounding box remains centered on the data
point. After the offset, size, and rotation are applied to the marker
symbol, any portion of the symbol that falls outside of the marker
bounding box is clipped.
Tip If clipping occurs, use this option, the HOFFSET= and SCALE=
options, and the suboption SIZE= in the MARKERATTRS= option to
remove the clipping.
Details
The SYMBOLCHAR statement defines a custom marker symbol from a Unicode
character. You can use the marker symbol that is created in the following options:
• the DATASYMBOLS= option in the BEGINGRAPH statement
• the SYMBOL= suboption of the MARKERATTRS= option, which is supported by
the following statements:
1176 Chapter 12 • Custom Marker Definition Statements
This example shows how to create marker symbols from the Unicode ballot X, heavy
character ('2718'x) and check mark, heavy character ('2718'x). It also shows you how to
use the symbols in a scatter plot and how to add them to a legend. In this example, a
grouped bar chart shows the daily failure count for two processes, Process A and Process
B. A scatter plot is overlaid on the bar chart in order to show the total failure count
above each bar. Acceptable counts are indicated by a green Unicode check mark. High
counts are indicated by a red Unicode ballot X. Finally, a legend is used to describe the
custom symbols. The following figure shows the output.
Example: SYMBOLCHAR Statement 1177
Example Program
/* Summarize the data in SASHELP.FAILURE to compute the
failure count by day and process */
proc sort data=sashelp.failure out=temp;
by day process;
run;
Program Description
Here is the SAS code for this example.
Create the graph data. The data in Sashelp.Failure is the source data. To get the daily
counts, the data is summarized by weekday and process. The Stat column is then added
to indicate whether the count is acceptable or high. Acceptable values are values that do
not exceed 120% of the target value. Values over 120% are considered high. Acceptable
values are A-NORM and B-NORM, and high values are A-HIGH and B-HIGH, where A
and B identify the process.
/* Summarize the data in SASHELP.FAILURE to compute the
failure count by day and process */
proc sort data=sashelp.failure out=temp;
by day process;
run;
begingraph;
Define the custom marker symbols. The NAME= option specifies an identifier for the
markers, and the CHAR= option specifies the Unicode value. Unicode value '2714'x
specifies a heavy check mark, and value '2718'x specifies a heavy ballot X.
/* Define the norm/high marker symbols */
symbolchar name=norm char='2714'x;
symbolchar name=high char='2718'x;
Create legend entries for the custom markers. Suboption SYMBOL= in the
MARKERATTRS= option specifies the identifier of the custom markers.
/* Create legend entries for the norm/high markers */
legenditem type=marker name="norm" /
markerattrs=(symbol=norm size=15pt color=green)
label="Normal Failure Count";
legenditem type=marker name="high" /
markerattrs=(symbol=high size=15pt color=red)
label="High Failure Count";
Create a discrete attribute map to map the custom markers to the Stat column
values. Suboption SYMBOL= in the MARKERATTRS= option specifies the identifier
of the custom markers. Suboption COLOR= sets the color of the Unicode marker
character and the associated data label. The DISCRETEATTRVAR statement creates
attribute map variable STATUS.
/* Define an attribute map for the status markers */
discreteattrmap name="statsymmap";
value "A-NORM" / markerattrs=(symbol=norm color=green);
value "B-NORM" / markerattrs=(symbol=norm color=green);
value "A-HIGH" / markerattrs=(symbol=high color=red);
value "B-HIGH" / markerattrs=(symbol=high color=red);
enddiscreteattrmap;
discreteattrvar attrvar=status var=stat attrmap="statsymmap" ;
Define the graph and close the template definition. The SCATTERPLOT statement
GROUP= option references the STATUS attribute map variable. The EVAL statement in
the Y= option positions each character just above the top of its bar. The SIZE= suboption
of the MARKERATTRS= option sets the marker size. The custom markers are included
in the DISCRETELEGEND statement.
/* Define the graph */
entrytitle "Daily Failure Report By Process";
entryfootnote "A failure count that is more than 120% of the
target is considered high.";
layout overlay / yaxisopts=(offsetmax=0.1);
barchartparm category=day response=count / name="barchart"
group=process groupdisplay=cluster;
scatterplot x=day y=eval(count+2) / datalabel=count group=status
groupdisplay=cluster markerattrs=(size=15pt);
referenceline y=&target /
lineattrs=(color=lightred pattern=dot) curvelabel="Target";
discretelegend "barchart" "norm" "high" / down=2
order=columnmajor;
endlayout;
endgraph;
1180 Chapter 12 • Custom Marker Definition Statements
end;
run;
SYMBOLIMAGE Statement
Defines a marker symbol using an image file so that the image can be referenced in other statements.
Note: This statement is valid in the first maintenance release of SAS 9.4 and later
releases.
Syntax
SYMBOLIMAGE NAME=marker-name IMAGE="image-file-spec" </ option(s)>;
Required Arguments
NAME=marker-name
specifies a name for the marker symbol. The name can be used in statements that
support marker symbols.
Interaction If the name matches one of the system-provided symbol names such as
CIRCLE, then the system symbol is replaced by the user-defined
symbol. See “Marker Options” on page 1350 for a list of the system-
provided symbols.
IMAGE="image-file-spec"
specifies the name and location of the image file. The supported image types are GIF,
JPEG, and PNG.
The image file must be located on the local file system. URL access
is not supported.
Example image="c:\temp\saslogo.gif"
Optional Arguments
HOFFSET=number
specifies a horizontal offset for the marker symbol.
Range -0.5–+0.5, where 0.5 represents one-half of the original marker size.
SYMBOLIMAGE Statement 1181
Note A positive offset moves the marker symbol bounding box to the right. A
negative offset moves it to the left.
ROTATE=number
specifies the angle of rotation for the marker symbol in degrees. Positive angles are
measured in the counter-clockwise direction, and negative angles are measured in the
clockwise direction.
Note An angle that exceeds 360 degrees in absolute value can be specified.
SCALE=number
specifies a scale factor for the marker symbol as a percentage. The scale factor is
applied to the character's height and width.
Note The outer edges of the image might be clipped by the bounding box when a
large scale factor is specified.
VOFFSET=number
specifies a vertical offset for the marker symbol.
Range -0.5–+0.5, where 0.5 represents one-half of the original marker size.
Note A positive offset moves the marker symbol bounding box up. A negative
offset moves it down.
Details
The SYMBOLIMAGE statement defines a custom marker symbol from an image that is
stored in an image file. The image file must exist on the local file system. URL access is
not supported. The supported image formats are GIF, JPG, and PNG. The marker symbol
that is created can be used in the following options:
• the DATASYMBOLS= option in the BEGINGRAPH statement
• the SYMBOL= suboption of the MARKERATTRS= option, which is supported by
the following statements:
This example shows how to create marker symbols from GIF icon image files. It also
shows you how to use the symbols in a scatter plot and how to add them to a legend. In
this example, a grouped bar chart shows the daily failure count for two processes,
Process A and Process B. A scatter plot is overlaid on the bar chart to show the total
failure count above each bar. Acceptable counts are indicated by a green check mark
icon. High counts are indicated by a caution icon. Finally, a legend is used to describe
the custom symbols. The following figure shows the output.
Example Program
/* Summarize the data in SASHELP.FAILURE to compute the
failure count by day and process */
proc sort data=sashelp.failure out=temp;
by day process;
run;
endlayout;
endgraph;
end;
run;
Program Description
Here is the SAS code for this example.
Create the graph data. The data in Sashelp.Failure is the source data. To get the daily
counts, the data is summarized by weekday and process. The Stat column is then added
to indicate whether the count is acceptable or high. Acceptable values are values that do
not exceed 120% of the target value. Values over 120% are considered high. Acceptable
values are A-NORM and B-NORM, and high values are A-HIGH and B-HIGH, where A
and B identify the process.
/* Summarize the data in SASHELP.FAILURE to compute the
failure count by day and process */
proc sort data=sashelp.failure out=temp;
by day process;
run;
Define the custom marker symbols. The NAME= option specifies an identifier for the
markers, and the IMAGE= option specifies the image file. The VOFFSET= option raises
the markers 50% from their data points in order to prevent them from overlapping the
bars in the bar chart.
/* Define the norm/high marker symbols */
symbolimage name=norm image="C:\temp\check_green.gif" /
Example: SYMBOLIMAGE Statement 1185
voffset=0.5;
symbolimage name=high image="C:\temp\alert_orange.gif" /
voffset=0.5;
Create legend entries for the custom markers. Suboption SYMBOL= in the
MARKERATTRS= option specifies the identifier of the custom markers.
/* Create legend entries for the norm/high markers */
legenditem type=marker name="norm" /
markerattrs=(symbol=norm size=16px)
label="Normal Failure Count";
legenditem type=marker name="high" /
markerattrs=(symbol=high size=16px)
label="High Failure Count";
Create a discrete attribute map to map the custom markers to the Stat column
values. Suboption SYMBOL= in the MARKERATTRS= option specifies the identifier
of the custom markers. Suboption COLOR= sets the color of the associated data label. It
does not affect the color of the image. The DISCRETEATTRVAR statement creates
attribute map variable STATUS.
/* Define an attribute map for the status markers
Note: COLOR= affects marker labels only in this case. */
discreteattrmap name="statsymmap";
value "A-NORM" / markerattrs=(symbol=norm color=green);
value "B-NORM" / markerattrs=(symbol=norm color=green);
value "A-HIGH" / markerattrs=(symbol=high color=orange);
value "B-HIGH" / markerattrs=(symbol=high color=orange);
enddiscreteattrmap;
discreteattrvar attrvar=status var=stat attrmap="statsymmap";
Define the graph and close the template definition. The SCATTERPLOT statement
GROUP= option references the STATUS attribute map variable. The SIZE= suboption
of the MARKERATTRS= option sets the marker size. The custom markers are included
in the DISCRETELEGEND statement.
/* Define the graph */
entrytitle "Daily Failure Report By Process";
entryfootnote "A failure count that is more than 120% of the
target is considered high.";
layout overlay / yaxisopts=(offsetmax=0.1);
barchartparm category=day response=count / name="barchart"
group=process groupdisplay=cluster;
scatterplot x=day y=count / datalabel=count group=status
groupdisplay=cluster markerattrs=(size=16px);
referenceline y=&target /
lineattrs=(color=lightred pattern=dot) curvelabel="Target";
discretelegend "barchart" "norm" "high" / down=2
order=columnmajor;
endlayout;
endgraph;
end;
run;
Part 9
Draw Statements
Chapter 13
Key Concepts for Using Draw Statements . . . . . . . . . . . . . . . . . . . . . . 1189
Chapter 14
Draw Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1199
1188
1189
Chapter 13
Key Concepts for Using Draw
Statements
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189
Types of Elements That Can Be Drawn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1192
About the Drawing Space and Drawing Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1192
How the Drawn Elements Are Anchored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195
About Drawing Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195
Introduction
The draw statements enable you to customize a graph by drawing visual elements
anywhere within the graph. The following sections provide a comprehensive example
and a brief overview to the major drawing concepts. For more details about the
individual draw statements and a simple example of each, see the discussion for each
individual statement. For complete usage information for the draw statements, consult
the SAS Graph Template Language: User's Guide.
Example
The following example shows a bar chart of the top global automobile makers in 2008.
To focus the graph on the 2008 merger between Chrysler and Fiat, the example uses
DRAWRECTANGLE to highlight the three bars in the chart that correspond to the unit
sales for the two auto makers. The example also uses a DRAWARROW statement and
two BEGINPOLYLINE blocks to point to the sales figures, and it uses a DRAWTEXT
statement to explain the implications of the merger.
All of the draw statements in this example use the data space (see “About the Drawing
Space and Drawing Units” on page 1192 ) to integrate the drawn elements into the
graph’s data area.
1190 Chapter 13 • Key Concepts for Using Draw Statements
/* Create the data and the macro variables for Chrysler, Fiat, and
Chrysler+Fiat widths */
data mydata;
length automaker $30;
input automaker $ 1-30 million_units;
FORMAT million_units 3.1;
select (automaker);
when ("Fiat") do;
colorvar=1;
call symput( "fwidth", million_units);
end;
when ("Chrysler") do;
colorvar=1;
call symput( "cwidth", million_units);
end;
when ("Fiat + Chrysler") do;
colorvar=2;
call symput( "cfwidth", million_units);
end;
otherwise colorvar=3;
end;
datalines;
Toyota 8.7
Example 1191
GM 7.7
Volkswagen 6.0
Renault-Nissan 5.8
Ford 5.4
Fiat + Chrysler 4.5
Hyundai 4.2
Honda 3.8
PSA 3.2
Fiat 2.5
Suzuki 2.4
Chrysler 2.0
Daimler 1.9
BMW 1.4
Mazda 1.4
Mitsubishi 1.1
;
end;
To specify the drawing space for both the X and the Y dimension, you use the
DRAWSPACE= option. To specify the drawing space individually for either the X or the
Y dimension, you use the options XSPACE=, X1SPACE=, X2SPACE=, YSPACE=,
Y1SPACE=, or Y2SPACE=, depending on the draw statement. The value that you set on
any of these options is a single composite value that specifies both the drawing space
and the drawing units in the following format:
<DrawingSpace><Units>
the space and unit setting only to the coordinate(s) for that statement. Thus, for lines and
arrows, the setting applies to both the X1, Y1 coordinate and the X2, Y2 coordinate.
To specify the drawing space and drawing units separately for the X coordinate and for
the Y coordinate, use the XSPACE=, YSPACE=, X1SPACE=, Y1SPACE=, X2SPACE=,
and Y2SPACE= options, as applicable, in each draw statement. These options override
the DRAWSPACE= option.
The default anchor position is CENTER. To change the anchor position, use the draw
statement’s ANCHOR= option.
The following code fragment shows the code that positions the line in the back layer:
layout overlay / walldisplay=(outline)
xaxisopts=(griddisplay=on display=(line ticks tickvalues))
yaxisopts=(griddisplay=on display=(line ticks tickvalues));
seriesplot x=open y=close / datalabel=date;
drawline x1=0 y1=0 x2=100 y2=100 /
x1space=wallpercent y1space=wallpercent
x2space=wallpercent y2space=wallpercent
lineattrs=(color=cyan thickness=6) layer=back ;
endlayout;
The Back Layer is Behind the Background. Although drawing elements in the back
layer prevents them from obstructing other data elements in the graph, it is not always
the right solution to the problem.
If a draw statement uses LAYER=BACK, then it draws the element behind all other
graphics elements, such as the layout background or a discrete legend’s background. To
ensure that the element is visible in the graph, you might have to do one or more of the
following:
• In overlay-type layouts or in a SCATTERPLOTMATRIX, you can use the parent
layout’s WALLDISPLAY= option to turn off the display of the plot wall. In the
example code just shown, WALLDISPLAY=(OUTLINE) displays an outline around
the graph wall but does not display the wall fill. Suppressing the fill ensures that the
drawn line is visible behind the plot wall.
• If a layout container uses OPAQUE=TRUE so that it can set visual attributes for the
background, then the opaque background covers and therefore hides any drawn
element that is behind the background. When assigning visual attributes to a graph
background, therefore, it might be better to use TRANSPARENCY= rather than
LAYER= to prevent drawn elements from covering other graphics elements in the
graph.
• If the results of a plot statement or other GTL-statement covers the drawn element,
then you can use transparency to reveal the drawn element. For example, you could
About Drawing Layers 1197
Chapter 14
Draw Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1199
BEGINPOLYGON Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1199
BEGINPOLYLINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1206
DRAWARROW Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1212
DRAWIMAGE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1219
DRAWLINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1227
DRAWOVAL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1233
DRAWRECTANGLE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1241
DRAWTEXT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1249
Dictionary
BEGINPOLYGON Statement
Defines the starting point for drawing a polygon in the graph.
Syntax
BEGINPOLYGON X=constant | scalar-expression
Y=constant | scalar-expression </option(s)>;
DRAW X=constant | scalar-expression
Y=constant | scalar-expression </option(s)>;
<… more DRAW statements …>
ENDPOLYGON;
Appearance options
DISPLAY=STANDARD | ALL | (display-options)
specifies the features to display for the polygon.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the fill attributes for this BEGINPOLYGON block.
LAYER=FRONT | BACK
specifies the layer on which this BEGINPOLYGON block’s output is drawn.
1200 Chapter 14 • Draw Statements
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Required Arguments
The following options are required in the BEGINPOLYGON statement and the DRAW
statement.
X=constant | scalar-expression
specifies the X value for a point in the polygon. When used in the
BEGINPOLYGON statement, it specifies the X value of the starting point of the
polygon.
Interaction The value that is set for this argument is interpreted using the
XSPACE= option. When XSPACE=DATAVALUE, the value is
interpreted using the XAXIS= option.
BEGINPOLYGON Statement 1201
Y=constant | scalar-expression
specifies the Y value for a point in the polygon. When used in the
BEGINPOLYGON statement, it specifies the Y value of the starting point of the
polygon.
Interaction The value that is set for this argument is interpreted using the
YSPACE= option. When YSPACE=DATAVALUE, the value is
interpreted using the YAXIS= option.
Optional Arguments
The following options can be used in the BEGINPOLYGON statement.
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options XSPACE= or YSPACE= use
DATAVALUE, and when X or Y are values on a discrete axis. For
nondiscrete axes, this option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this BEGINPOLYGON statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the XSPACE= and
YSPACE= options.
See “About the Drawing Space and Drawing Units” on page 1192
Tip The TRANSPARENCY= option sets the transparency for the fill and the
outline. You can combine this option with TRANSPARENCY= to set one
transparency for the outlines but a different transparency for the fill.
Example:
transparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
LAYER=FRONT | BACK
specifies the layer on which this BEGINPOLYGON block’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
Interaction For this option to have any effect, the outline must be enabled by the
DISPLAY= option.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element .
TRANSPARENCY=number
specifies the degree of the transparency of this BEGINPOLYGON block’s output.
Default 0
Tip The FILLATTRS option can be used to set transparency for just the
polygon’s filled area. You can combine this option with FILLATTRS= to
set one transparency for the outlines but a different transparency for the fill.
Example:
transparency=0.2 fillattrs=(transparency=0.6)
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Details
Statement Description
A polygon is built by using the BEGINPOLYGON statement to specify the polygon’s
starting X,Y coordinate, and then specifying the remaining points by nesting a series of
DRAW statements (see “DRAW Statement” on page 1204 ) within the
BEGINPOLYGON block. The block is closed with an ENDPOLYGON statement. To
manage the location and drawing units for the polygon, you can use the XAXIS=,
YAXIS=, XSPACE=, and YSPACE= options.
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
DRAW Statement
The nested DRAW statements within a BEGINPOLYGON block specify a series of
points for a polygon. Each DRAW statement draws a straight line from the previous
point to the endpoint that is specified in the DRAW statement's X and Y arguments. The
first DRAW statement starts its line from the X,Y point that is specified in the
BEGINPOLYGON statement.
Example: BEGINPOLYGON Statement 1205
You can specify as many DRAW statements as needed to complete the polygon. If the
last DRAW statement does not end at the first point in the polygon (specified in
BEGINPOLYGON), then a line is automatically generated to close the polygon shape.
For a specific example, see the “Example Program” on page 1205.
The following graph was generated by the “Example Program” on page 1205. The
example uses a BEGINPOLYGON block to draw a polygon around the Setosa species of
Iris in a plot that shows petal sizes for three Iris species. The DRAWSPACE= option in
the BEGINGRAPH statements specifies that the polygon be drawn in the data space.
The BEGINPOLYGON statement specifies the starting X,Y point. For the
BEGINPOLYGON options, DISPLAY= displays only the fill for the polygon.
TRANSPARENCY= adds a degree of transparency to the fill, and FILLATTRS= sets the
fill color to yellow. The example also uses DRAWARROW and DRAWTEXT
statements to draw an annotation for the polygon.
Example Program
proc template;
define statgraph discretelegend;
begingraph / drawspace=datavalue;
entrytitle "Iris Petal Dimensions";
layout overlayequated / equatetype=equate;
scatterplot x=petallength y=petalwidth / group=species name="s";
ellipse x=petallength y=petalwidth / type=predicted alpha=.2
name="p80" legendlabel="80%" outlineattrs=graphconfidence;
ellipse x=petallength y=petalwidth / type=predicted alpha=.05
name="p95" legendlabel="95%" outlineattrs=graphconfidence2;
1206 Chapter 14 • Draw Statements
BEGINPOLYLINE Statement
Defines the starting point for drawing a polyline in the graph.
Syntax
BEGINPOLYLINE X=constant | scalar-expression
Y=constant | scalar-expression </option(s)>;
DRAW X=constant | scalar-expression
Y=constant | scalar-expression </option(s)>;
<… more DRAW statements …>
ENDPOLYLINE;
Appearance options
LAYER=FRONT | BACK
specifies the layer on which this BEGINPOLYLINE block’s output is drawn.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the line attributes for this BEGINPOLYLINE block.
TRANSPARENCY=number
specifies the degree of the transparency of the BEGINPOLYLINE block’s
output.
BEGINPOLYLINE Statement 1207
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Required Arguments
The following options are required in the BEGINPOLYLINE statement and the DRAW
statement.
X=constant | scalar-expression
specifies the X value for the starting point in the polyline.
Interaction The value that is set for this argument is interpreted using the
XSPACE= option. When XSPACE=DATAVALUE, the value is
interpreted using the XAXIS= option.
Y=constant | scalar-expression
specifies the Y value for the starting point in the polyline.
Interaction The value that is set for this argument is interpreted using the
YSPACE= option. When YSPACE=DATAVALUE, the value is
interpreted using the YAXIS= option.
1208 Chapter 14 • Draw Statements
Optional Arguments
The following options can be used in the BEGINPOLYLINE statement.
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options XSPACE= or YSPACE= use
DATAVALUE, and when X or Y are values on a discrete axis. For
nondiscrete axes, this option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this BEGINPOLYLINE statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the XSPACE= and
YSPACE= options.
See “About the Drawing Space and Drawing Units” on page 1192
LAYER=FRONT | BACK
specifies the layer on which this BEGINPOLYLINE block’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element .
TRANSPARENCY=number
specifies the degree of the transparency of the BEGINPOLYLINE block’s output.
Default 0
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Details
Statement Description
A polyline is built by using the BEGINPOLYLINE statement to specify the polyline’s
starting X,Y coordinate, and then specifying the remaining points by nesting a series of
DRAW statements (see “DRAW Statement” on page 1210 ) within the
BEGINPOLYLINE block. The block is closed with an ENDPOLYLINE statement. To
manage the location and drawing units for the polyline, you can use the XAXIS=,
YAXIS=, XSPACE=, and YSPACE= options.
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
DRAW Statement
The nested DRAW statements within a BEGINPOLYLINE block specify a series of
points for a polyline. Each DRAW statement draws a straight line from the previous
point to the endpoint that is specified in the DRAW statement's X and Y arguments. The
first DRAW statement starts its line from the X,Y point that is specified in the
BEGINPOLYLINE statement. You can specify as many DRAW statements as needed to
complete the polyline.
Example: BEGINPOLYLINE Statement 1211
The following graph was generated by the “Example Program” on page 1211. The
example uses two BEGINPOLYLINE blocks to highlight two student data points. The
DRAWSPACE= option in the BEGINGRAPH statements specifies that the polyline be
drawn in the data space. The BEGINPOLYLINE statements specify the starting X,Y
points for two polyline, and the DRAW statements complete the lines. The example also
uses two DRAWTEXT statements to label the data points of interest.
Example Program
proc template;
define statgraph drawoval;
begingraph / drawspace=datavalue;
entrytitle "Regression Fit Plot";
layout overlay;
modelband "myclm";
scatterplot x=height y=weight;
regressionplot x=height y=weight / alpha=0.01 clm="myclm";
drawtext "Alfred" / x=69 y=112 anchor=top;
drawtext "Barbara" / x=65.4 y=97 anchor=top width=15;
beginpolyline x=69 y=105 ;
draw x=69 y=85 ;
draw x=65.3 y=85 ;
draw x=65.3 y=90 ;
endpolyline ;
beginpolyline x=67 y=85 ;
1212 Chapter 14 • Draw Statements
DRAWARROW Statement
Draws an arrow (a directed line segment) from one point to another point.
Syntax
DRAWARROW X1=constant | scalar-expression
Y1=constant | scalar-expression
X2=constant | scalar-expression
Y2=constant | scalar-expression </option(s)>;
Appearance options
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the line attributes for this draw statement.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Arrow options
ARROWHEADDIRECTION=OUT | IN | BOTH
specifies the direction of the arrowhead(s) at the end(s) of the arrow shaft.
ARROWHEADSCALE=positive-number
specifies an arrowhead scale factor based on the thickness of the arrow shaft.
ARROWHEADSHAPE=OPEN | CLOSED | FILLED | BARBED
specifies the shape of the arrowhead(s).
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Required Arguments
X1=constant | scalar-expression
specifies the X value of one arrow-shaft endpoint.
Interactions This value that is set for this option is interpreted using the
X1SPACE= option.
Y1=constant | scalar-expression
specifies the Y value of one arrow-shaft endpoint.
Interactions This value that is set for this option is interpreted using the
Y1SPACE= option.
X2=constant | scalar-expression
specifies the X value of one arrow-shaft endpoint.
1214 Chapter 14 • Draw Statements
Interactions This value that is set for this option is interpreted using the
X2SPACE= option.
Y2=constant | scalar-expression
specifies the Y value of one arrow-shaft endpoint.
Interactions This value that is set for this option is interpreted using the
Y2SPACE= option.
Optional Arguments
ARROWHEADDIRECTION=OUT | IN | BOTH
specifies the direction of the arrowhead(s) at the end(s) of the arrow shaft.
OUT specifies a single arrowhead drawn at (X2,Y2) and pointing away from
(X1,Y1)
IN specifies a single arrowhead drawn at (X1,Y1) and pointing away from
(X2,Y2)
BOTH specifies two arrowheads, one at the IN position and one at the OUT
position
Default OUT
Default OPEN
DRAWARROW Statement 1215
ARROWHEADSCALE=positive-number
specifies an arrowhead scale factor based on the thickness of the arrow shaft.
Default 1.0
Restriction The minimum size for arrowheads is 8 pixels. If you specify a value for
ARROWHEADSCALE= that scales the arrowhead below 8 pixels, an
8-pixel arrowhead is used instead. There is no restriction on the
maximum size.
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options X1SPACE=, X2SPACE=,
Y1SPACE=, or Y2SPACE= use DATAVALUE, and when X1, X2, Y1,
or Y2 are values on a discrete axis. For nondiscrete axes, this option is
ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this draw statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the options X1SPACE=,
Y1SPACE=, X2SPACE=, or Y2SPACE=.
See “About the Drawing Space and Drawing Units” on page 1192
1216 Chapter 14 • Draw Statements
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Default 0
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
Interaction This option overrides the DRAWSPACE= setting only for the X1 value.
Interaction This option overrides the DRAWSPACE= setting only for the X2 value.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Interaction This option overrides the DRAWSPACE= setting only for the Y1 value.
Interaction This option overrides the DRAWSPACE= setting only for the Y2 value.
Details
A DRAWARROW statement draws a line (arrow shaft) from a specified starting point
(X1,Y1) to a specified ending point (X2,Y2). It also displays an arrowhead at either or
both ends of the line. DRAWARROW is similar to a DRAWLINE statement, using many
of the same options, but it has additional options for controlling the arrowhead(s).
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
1218 Chapter 14 • Draw Statements
The following graph was generated by the “Example Program” on page 1218. The
example shows a common application of a DRAWARROW and DRAWTEXT
statements to identify a specific part of the graph and add explanatory text.
Example Program
proc template;
define statgraph arrow;
begingraph;
entrytitle "Micosoft Stock Prices between 2000 and 2002";
layout overlay;
seriesplot x=date y=close;
drawarrow x1="01NOV2001"d y1=75 x2="01NOV2001"d y2=64.21 /
x1space=datavalue y1space=wallpercent
x2space=datavalue y2space=datavalue
arrowheadshape=filled lineattrs=(color=red) ;
drawtext "Introduction of Windows XP" / width=25 anchor=bottom
border=true borderattrs=(color=red)
x="01NOV2001"d y=75 xspace=datavalue yspace=wallpercent;
endlayout;
endgraph;
end;
DRAWIMAGE Statement
Draws an image in the graph.
Syntax
DRAWIMAGE "image-file-spec" </option(s)>;
Appearance options
BORDER=TRUE | FALSE
specifies whether a border is drawn around the image.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the border line attributes for this draw statement.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
ROTATE=number
specifies the angle of rotation for the image, measured in degrees.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
Location options
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the image.
X=constant | scalar-expression
specifies the anchor point’s X coordinate.
Y=constant | scalar-expression
specifies the anchor point’s Y coordinate.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Size options
HEIGHT=positive-number
specifies the height of the image’s bounding box.
HEIGHTUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the HEIGHT=
option is interpreted as a percentage value, a pixel value, or a value that is in
the units of the data.
SCALE=FIT | FITHEIGHT | FITWIDTH | TILE
specifies how the image is scaled within the bounding box.
SIZEUNIT=PERCENT | PIXEL | DATA
specifies whether the default units for the size of the image’s bounding box
are percentage values, or pixel values, or values that are in the unit of the
data.
WIDTH=positive-number
specifies the width of the image’s bounding box.
WIDTHUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the WIDTH= option
is interpreted as a percentage value, a pixel value, or a value that is in the
units of the data.
Required Argument
image-file-spec
specifies the name, image type, and location of the image. The image-file-spec value
must be enclosed in double quotation marks and must be specified as a local,
physical file path (for example, "c:\temp\saslogo.gif"). The supported image
types are GIF, JPEG, and PNG raster or bitmap format.
Restrictions URL access to image files is not supported. The image file must exist
on the file system.
In SAS 9.4 and in earlier releases, you cannot use a dynamic variable
for the image-file-spec value. This restriction is removed starting with
the first maintenance release of SAS 9.4.
DRAWIMAGE Statement 1221
Optional Arguments
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the image. The anchor point is relative to the unrotated
image. The anchor point can be at the center of the image or at eight points on the
border of the image bounding box. The following figure shows the anchor points for
TOPLEFT and LEFT.
The coordinates of the anchor point are set by the X= and Y= options, and by the
XSPACE= and YSPACE= options. The XAXIS= and YAXIS= option might affect
positioning when the XSPACE= or YSPACE= options are set to DATAPIXEL,
DATAPERCENT, or DATAVALUE.
The image has a fixed height and a fixed width, determined by the HEIGHT=,
HEIGHTUNIT=, WIDTH= and WIDTHUNIT= options. The height of the text
grows in a direction that is related to the anchor point. For example, if
ANCHOR=TOPLEFT, then the image height extends downward from the anchor
point and its width extends to the right. If ANCHOR=CENTER, then half the image
width and half the image height extend equally left and right, as well as top to
bottom from the anchor point. If ANCHOR=BOTTOM, then the image height
extends upward from the anchor point and the image width is centered at the anchor
point.
When the image is rotated, the anchor point remains relative to the unrotated image
while the image is rotated on its anchor point. See ROTATE= on page 1223.
Default CENTER
BORDER=TRUE | FALSE
specifies whether a border is drawn around the image.
Default FALSE
Tip Use the BORDERATTRS= option to control the appearance of the border.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER=TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options XSPACE= or YSPACE= use
DATAVALUE, and when X or Y are values on a discrete axis. For
nondiscrete axes, this option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this draw statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the options XSPACE=,
YSPACE=, HEIGHTUNIT=, or WIDTHUNIT=.
See “About the Drawing Space and Drawing Units” on page 1192
HEIGHT=positive-number
specifies the height of the image’s bounding box.
Default PERCENT
Interaction This setting combines with the YSPACE= setting to interpret the height
that is set in the HEIGHT= option.
DRAWIMAGE Statement 1223
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
ROTATE=number
specifies the angle of rotation for the image, measured in degrees. The image is
rotated around its anchor point. The angle is measured from a horizontal line passing
through the anchor point of the image to the right. The following figure shows the
rotation of an image around a top anchor point.
Positive angles rotate the image counter clockwise, and negative angles rotate the
image clockwise. The angle specification can exceed 360 degrees in absolute value.
Note If you specify the SVG format for your graph and your graph includes a
rotated image, then the graph is rendered as a bitmapped image rather than
an SVG image. In that case, a note is written to the SAS log indicating the
change in format.
FITWIDTH
scales the image to fit the width of the bounding box. The height is computed
from the width and the image's aspect ratio.
TILE
tiles the image as needed to fit the bounding image. The last tile in a row or
column might be clipped by the bounding box.
Default FIT
Default PERCENT
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Default 0
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
WIDTH=positive-number
specifies the width of the image’s bounding box.
Default PERCENT
DRAWIMAGE Statement 1225
Interaction This setting combines with the XSPACE= setting to interpret the width
that is set in the WIDTH= option.
X=constant | scalar-expression
specifies the anchor point’s X coordinate.
Default 50
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
Y=constant | scalar-expression
specifies the anchor point’s Y coordinate.
Default 50
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
1226 Chapter 14 • Draw Statements
Details
A DRAWIMAGE statement draws an image in a graph. By default, the image is drawn
in the center of the graph. You can change the default position with the options
ANCHOR=, X=, Y=, XSPACE=, and YSPACE=. By default, the image is drawn in the
actual image size. You can change the default size with the WIDTH= and HEIGHT=
options.
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
Example Graph
The following graph was generated by the “Example Program” on page 1227. The
example shows how to display an image in the bottom right corner of the graph wall.
DRAWLINE Statement 1227
Example Program
proc template;
define statgraph image;
begingraph;
entrytitle "Regression Fit Plot";
layout overlay;
modelband "myclm";
scatterplot x=height y=weight / primary=true;
regressionplot x=height y=weight / alpha=0.01 clm="myclm";
drawimage "c:\temp\saslogo.gif" /
anchor=bottomright x=98 y=2
drawspace=wallpercent ;
endlayout;
endgraph;
end;
DRAWLINE Statement
Draws a line from one point to another point.
Syntax
DRAWLINE X1=constant | scalar-expression
Y1=constant | scalar-expression
X2=constant | scalar-expression
Y2=constant | scalar-expression </option(s)>;
Appearance options
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the line attributes for this draw statement.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
1228 Chapter 14 • Draw Statements
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Required Arguments
X1=constant | scalar-expression
specifies the X value of the starting point for the line.
Interactions This value that is set for this option is interpreted using the
X1SPACE= option.
Y1=constant | scalar-expression
specifies the Y value of the starting point for the line.
Interactions This value that is set for this option is interpreted using the
Y1SPACE= option.
X2=constant | scalar-expression
specifies the X value of the endpoint for the line.
Interactions This value that is set for this option is interpreted using the
X2SPACE= option.
Y2=constant | scalar-expression
specifies the Y value of the endpoint for the line.
Interactions This value that is set for this option is interpreted using the
Y2SPACE= option.
Optional Arguments
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options X1SPACE=, X2SPACE=,
Y1SPACE=, or Y2SPACE= use DATAVALUE, and when X1, X2, Y1,
or Y2 are values on a discrete axis. For nondiscrete axes, this option is
ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default LAYOUTPERCENT
1230 Chapter 14 • Draw Statements
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this draw statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the options X1SPACE=,
Y1SPACE=, X2SPACE=, or Y2SPACE=.
See “About the Drawing Space and Drawing Units” on page 1192
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Default 0
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
DRAWLINE Statement 1231
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
Interaction This option overrides the DRAWSPACE= setting only for the X1 value.
Interaction This option overrides the DRAWSPACE= setting only for the X2 value.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Interaction This option overrides the DRAWSPACE= setting only for the Y1 value.
Interaction This option overrides the DRAWSPACE= setting only for the Y2 value.
1232 Chapter 14 • Draw Statements
Details
A DRAWLINE statement draws a line from a starting point that is specified with the X1
and Y1 arguments, to an ending point that is specified with the X2 and Y2 arguments.
DRAWLINE is similar to a DRAWARROW statement, using many of the same options,
but without the options for controlling the arrowhead(s).
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
The following graph was generated by the “Example Program” on page 1232. The
example shows how to draw a diagonal reference line. One endpoint is point 0,0 and the
other is point 100,100. Both points are specified in the WALL area with PERCENT
units, making it easy to position the line without regard to the axis data ranges or the axis
offsets. To draw the line behind the series line and grid lines, you can set LAYER=
BACK and use the parent layout statement to turn off the display of the wall.
Example Program
proc template;
define statgraph diagonal;
begingraph;
entrytitle "Open vs. Close Price for Intel Stock 2003";
layout overlay / walldisplay=(outline)
xaxisopts=(griddisplay=on)
DRAWOVAL Statement 1233
yaxisopts=(griddisplay=on);
seriesplot x=open y=close / datalabel=date;
drawline x1=0 y1=0 x2=100 y2=100 /
x1space=wallpercent y1space=wallpercent
x2space=wallpercent y2space=wallpercent
lineattrs=GraphReference layer=back ;
endlayout;
endgraph;
end;
DRAWOVAL Statement
Draws an oval in the graph.
Syntax
DRAWOVAL X=constant | scalar-expression
Y=constant | scalar-expression
WIDTH=constant | scalar-expression
HEIGHT=constant | scalar-expression </option(s)>;
Appearance options
DISPLAY=STANDARD | ALL | (display-options)
specifies the features to display for the oval.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the fill attributes for this draw statement.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the outline attributes for this draw statement.
ROTATE=number
specifies the angle of rotation for the oval, measured in degrees.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
1234 Chapter 14 • Draw Statements
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
Location options
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the oval.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Size options
HEIGHTUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the HEIGHT=
option is interpreted as a percentage value, a pixel value, or a value that is in
the units of the data.
WIDTHUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the WIDTH= option
is interpreted as a percentage value, a pixel value, or a value that is in the
units of the data.
Required Arguments
X=constant | scalar-expression
specifies the X value of the anchor point.
Interactions The value that is set for this argument is interpreted using the
XSPACE= option.
Y=constant | scalar-expression
specifies the Y value of the anchor point.
Interactions The value that is set for this argument is interpreted using the
YSPACE= option.
WIDTH=constant | scalar-expression
specifies the width of the oval.
Interactions The value that is set for this argument is interpreted using the
WIDTHUNIT= and XSPACE= options.
HEIGHT=constant | scalar-expression
specifies the height of the oval.
Interactions The value that is set for this argument is interpreted using the
HEIGHTUNIT= and YSPACE= options.
Optional Arguments
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the oval. The anchor point is relative to the unrotated
oval. The anchor point can be at the center of the oval or at eight points on the
bounding box of the rectangle. The following figure shows the anchor points for
TOPLEFT and CENTER.
The coordinates of the anchor point are set by the statement’s X and Y values, and by
the settings for the XSPACE= and YSPACE= options. The XAXIS= and YAXIS=
option might affect positioning when the XSPACE= or YSPACE= options are set to
DATAPIXEL, DATAPERCENT, or DATAVALUE.
When the oval is rotated, the anchor point remains relative to the unrotated oval
while the oval is rotated on its anchor point. See ROTATE= on page 1238.
Default CENTER
1236 Chapter 14 • Draw Statements
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options XSPACE= or YSPACE= use
DATAVALUE, and when X or Y are values on a discrete axis. For
nondiscrete axes, this option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this draw statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the options XSPACE=,
YSPACE=, HEIGHTUNIT=, or WIDTHUNIT=.
DRAWOVAL Statement 1237
See “About the Drawing Space and Drawing Units” on page 1192
Tip The TRANSPARENCY= option sets the transparency for the fill and the
outline. You can combine this option with TRANSPARENCY= to set one
transparency for the outline but a different transparency for the fill.
Example:
transparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default PERCENT
Interaction This setting combines with the YSPACE= setting to interpret the height
that is set in the HEIGHT= option.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
Interaction For this option to have any effect, the outline must be enabled by the
DISPLAY= option or by the ODS style that is in effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
ROTATE=number
specifies the angle of rotation for the oval, measured in degrees. The angle is
measured as if a horizontal line extended to the right through the oval anchor point as
shown in the following figure.
Positive angles rotate the oval counter clockwise, and negative angles rotate the oval
clockwise. The angle specification can exceed 360 degrees in absolute value.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the filled
area. You can combine this option with FILLATTRS= to set one
transparency for the outline but a different transparency for the fill. Here is
an example:
transparency=0.2 fillattrs=(transparency=0.6)
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
Default PERCENT
Interaction This setting combines with the XSPACE= setting to interpret the width
that is set in the WIDTH= option.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Details
A DRAWOVAL statement draws an oval in a graph. The oval position is determined by
the X and Y anchor points, and the size is determined by the HEIGHT and WIDTH
settings. You can manage the oval position with the options ANCHOR= , XSPACE= ,
and YSPACE= . You can manage the oval size with the HEIGHTUNIT= and
WIDTHUNIT= options.
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
1240 Chapter 14 • Draw Statements
The following graph was generated by the “Example Program” on page 1240. The
example uses DRAWOVAL to highlight a student’s data point. It draws an oval around
the marker symbol that represents the student’s height and weight, and it displays the
student’s name inside the oval. In the BEGINGRAPH statement, the setting for the
DRAWSPACE= option sets the drawing space and drawing units for the DRAWOVAL
and DRAWTEXT statements. In the DRAWOVAL statement, setting
TRANSPARENCY=0.75 ensures that the marker for Alfred is visible behind the oval.
The DRAWTEXT statement draws the text that identifies the student's name, using the
ANCHOR=, X=, and Y= options to position the text within the oval.
Example Program
proc template;
define statgraph drawoval;
begingraph / drawspace=datavalue;
entrytitle "Regression Fit Plot";
layout overlay;
modelband "myclm";
scatterplot x=height y=weight;
regressionplot x=height y=weight / alpha=0.01 clm="myclm";
drawoval x=69 y=112.5 width=15 height=20 /
display=all fillattrs=(color=green)
transparency=0.75 ;
drawtext "Alfred" / x=69 y=112 anchor=top;
endlayout;
endgraph;
DRAWRECTANGLE Statement 1241
end;
DRAWRECTANGLE Statement
Draws a rectangle in the graph.
Syntax
DRAWRECTANGLE X=constant | scalar-expression
Y=constant | scalar-expression
WIDTH=constant | scalar-expression
HEIGHT=constant | scalar-expression </option(s)>;
Appearance options
CORNERRADIUS=number
specifies the radius of the rectangle corners.
DISPLAY=STANDARD | ALL | (display-options)
specifies the features to display for the rectangle.
FILLATTRS=style-element | style-element (fill-options) | (fill-options)
specifies the fill attributes for this draw statement.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
OUTLINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the outline attributes for this draw statement.
ROTATE=number
specifies the angle of rotation for the rectangle, measured in degrees.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
Location options
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the rectangle.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Size options
HEIGHTUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the HEIGHT=
option is interpreted as a percentage value, a pixel value, or a value that is in
the units of the data.
WIDTHUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the WIDTH= option
is interpreted as a percentage value, a pixel value, or a value that is in the
units of the data.
Required Arguments
X=constant | scalar-expression
specifies the X value of the anchor point.
Interactions The value that is set for this argument is interpreted using the
XSPACE= option.
Y=constant | scalar-expression
specifies the Y value of the anchor point.
Interactions The value that is set for this argument is interpreted using the
YSPACE= option.
WIDTH=constant | scalar-expression
specifies the width of the rectangle.
Interactions The value that is set for this argument is interpreted using the
WIDTHUNIT= and XSPACE= options.
HEIGHT=constant | scalar-expression
specifies the height of the rectangle.
Interactions The value that is set for this argument is interpreted using the
HEIGHTUNIT= and YSPACE= options.
Optional Arguments
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the rectangle. The anchor point is relative to the
unrotated rectangle. The anchor point can be at the center of the rectangle or at eight
points on the rectangle border. The following figure shows the anchor points for
TOPLEFT and CENTER.
The coordinates of the anchor point are set by the statement’s X and Y values, and by
the settings for the XSPACE= and YSPACE= options. The XAXIS= and YAXIS=
option might affect positioning when the XSPACE= or YSPACE= options are set to
DATAPIXEL, DATAPERCENT, or DATAVALUE.
When the rectangle is rotated, the anchor point remains relative to the unrotated
rectangle while the rectangle is rotated on its anchor point. See ROTATE= on page
1246.
Default CENTER
CORNERRADIUS=number
specifies the radius of the rectangle corners.
Default 0
Range 0–1, where 0 specifies square corners and 1 specifies the most rounded
corners
1244 Chapter 14 • Draw Statements
Example cornerradius=0.2
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options XSPACE= or YSPACE= use
DATAVALUE, and when X or Y are values on a discrete axis. For
nondiscrete axes, this option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default STANDARD
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this draw statement.
DRAWRECTANGLE Statement 1245
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the options XSPACE=,
YSPACE=, HEIGHTUNIT=, or WIDTHUNIT=.
See “About the Drawing Space and Drawing Units” on page 1192
Tip The TRANSPARENCY= option sets the transparency for the fill and the
outline. You can combine this option with TRANSPARENCY= to set one
transparency for the outline but a different transparency for the fill.
Example:
transparency=0.2 fillattrs=(transparency=0.6)
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Default PERCENT
Interaction This setting combines with the YSPACE= setting to interpret the height
that is set in the HEIGHT= option.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
Interaction For this option to have any effect, the outline must be enabled by the
DISPLAY= option or by the ODS style that is in effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
1246 Chapter 14 • Draw Statements
ROTATE=number
specifies the angle of rotation for the rectangle, measured in degrees. The angle is
measured as if a horizontal line extended to the right through the rectangle anchor
point as shown in the following figure.
Positive angles rotate the rectangle counter clockwise, and negative angles rotate the
rectangle clockwise. The angle specification can exceed 360 degrees in absolute
value.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Default 0
Tip The FILLATTRS= option can be used to set transparency for just the filled
area. You can combine this option with FILLATTRS= to set one
transparency for the outline but a different transparency for the fill. Here is
an example:
transparency=0.2 fillattrs=(transparency=0.6)
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
DRAWRECTANGLE Statement 1247
Default PERCENT
Interaction This setting combines with the XSPACE= setting to interpret the width
that is set in the WIDTH= option.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Details
A DRAWRECTANGLE statement draws a rectangle in a graph. The rectangle position
is determined by the X and Y anchor points, and the size is determined by the HEIGHT
and WIDTH settings. You can manage the rectangle position with the options
ANCHOR= , XSPACE= , and YSPACE= . You can manage the rectangle size with the
HEIGHTUNIT= and WIDTHUNIT= options.
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
1248 Chapter 14 • Draw Statements
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
The following graph was generated by the “Example Program” on page 1248. The
example uses DRAWRECTANGLE to highlight a student’s data point. It draws a
rectangle around the marker symbol that represents the student’s height and weight, and
it displays the student’s name inside the rectangle. In the BEGINGRAPH statement, the
setting for the DRAWSPACE= option sets the drawing space and drawing units for the
DRAWRECTANGLE and DRAWTEXT statements. In the DRAWRECTANGLE
statement, setting TRANSPARENCY=0.75 ensures that the marker for Alfred is visible
behind the rectangle. The DRAWTEXT statement draws the text that identifies the
student's name, using the ANCHOR=, X=, and Y= options to position the text within the
rectangle.
Example Program
proc template;
define statgraph drawrectangle;
begingraph / drawspace=datavalue;
entrytitle "Regression Fit Plot";
layout overlay;
modelband "myclm";
scatterplot x=height y=weight;
regressionplot x=height y=weight / alpha=0.01 clm="myclm";
drawrectangle x=69 y=112.5 width=10 height=15 /
display=all fillattrs=(color=green)
transparency=0.75 ;
DRAWTEXT Statement 1249
DRAWTEXT Statement
Draws and anchors in a graph a text box that contains one or more lines of formatted text.
Syntax
DRAWTEXT text-item <text-item …> </option(s)>;
Appearance options
BORDER=TRUE | FALSE
specifies whether a border is drawn around the text box.
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the border line attributes for this draw statement.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the text box’s
border.
ROTATE=number
specifies the angle of rotation of the text box, measured in degrees.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Axes options
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y
values, or both.
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted
using the primary X axis scale or to the secondary X (X2) axis scale.
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted
using the primary Y axis scale or to the secondary Y (Y2) axis scale.
Location options
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the text box.
JUSTIFY=LEFT | CENTER | RIGHT
specifies the alignment of text that wraps within the text box.
X=constant | scalar-expression
specifies the anchor point’s X coordinate.
Y=constant | scalar-expression
specifies the anchor point’s Y coordinate.
ODS options
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw
statement is selected.
Size options
WIDTH=positive-number
specifies the width of the text box.
WIDTHUNIT=PERCENT | PIXEL | DATA
specifies whether the positive-number that is specified in the WIDTH= option
is interpreted as a percentage value, a pixel value, or a value that is in the
units of the data.
Required Argument
text-item <…text-item>
specifies one or more pieces of text for the text box. Each text-item has the following
form:
<prefix-option> "string" | dynamic | character-expression | {text-command}
Each piece of text can have a prefix setting that precedes the piece of text. A piece of
text is either a string literal, a dynamic, or a text command. All text-items are
concatenated into one string, which might be wrapped, based on the settings for the
WIDTH= and WIDTHUNIT= settings. Leading and trailing blanks in the
concatenated string are always used.
When used, a prefix option applies to the immediately following piece of text and
also to all subsequent text strings and text-commands until another prefix option is
specified.
Optional Arguments
ANCHOR=CENTER | TOPLEFT | TOP | TOPRIGHT | LEFT | RIGHT |
BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies an anchor point for the text box. The anchor point is relative to the
unrotated text. It can be at the center of the text box or at eight points on the border
of the text box bounding box. The following figure shows the anchor points for
TOPLEFT and LEFT.
The coordinates of the anchor point are set by the X= and Y= options, and by the
XSPACE= and YSPACE= options. The XAXIS= and YAXIS= option might affect
positioning when the XSPACE= or YSPACE= options are set to DATAPIXEL,
DATAPERCENT, or DATAVALUE.
The text box has a fixed width, determined by the WIDTH= and WIDTHUNIT=
options. The height of the text box is based on the amount of text specified and the
font size. The height of the text grows in a direction that is related to the anchor
point. For example, if ANCHOR=TOPLEFT, then the text box height extends
downward from the anchor point and its width extends to the right. If
ANCHOR=CENTER, then half the text box width and half the text box height
extend equally left and right, as well as top to bottom from the anchor point. If
ANCHOR=BOTTOM, the text box height extends upward from the anchor point and
the text box width is centered at the anchor point.
When the text is rotated, the anchor point remains relative to the unrotated text box
while the text box is rotated on its anchor point. See ROTATE= on page 1253.
Default CENTER
BORDER=TRUE | FALSE
specifies whether a border is drawn around the text box.
Default FALSE
Tip Use the BORDERATTRS= option to control the appearance of the border.
See “boolean ” on page 1339 for other Boolean values that you can use.
Interaction BORDER=TRUE must be set for this option to have any effect.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
DISCRETEOFFSET=number
specifies an amount to offset from the discrete X values, or the discrete Y values, or
both.
Default 0 (no offset, output is centered on the discrete X values, or the discrete
Y values, or both)
Range –0.5 to +0.5, where 0.5 represents half the distance between discrete
ticks. If the X axis is discrete, then a positive offset is to the right. If the
Y axis is discrete, then a positive offset is up. If REVERSE=TRUE on
the X or Y axis, then the offset direction is also reversed.
Restriction This option applies only when the options XSPACE= or YSPACE= use
DATAVALUE, and when X or Y are values on a discrete axis. For
nondiscrete axes, this option is ignored.
Tip Setting the discrete offset for the plots does not affect the axis
minimum and maximum offsets. In some cases, setting a discrete offset
can cause clipping at each end of the axis. In those cases, use the
OFFSETMIN= and OFFSETMAX= axis options to increase the axis
minimum and maximum offsets to accommodate the discrete offset.
Default LAYOUTPERCENT
Interactions This statement and all of the draw statements inherit the global
DRAWPSACE= setting from the DRAWSPACE= option in the
BEGINGRAPH statement. Setting this option changes the setting for
only this draw statement.
This option sets the default drawing space, but individual settings in
the X or Y dimension can be overridden by the options XSPACE=,
YSPACE=, HEIGHTUNIT=, or WIDTHUNIT=.
See “About the Drawing Space and Drawing Units” on page 1192
RIGHT
forces the last character of each line to appear at the right margin (distance from
the right border minus the right pad amount).
Default LEFT
Interaction Text is wrapped based on the width of the specified text, the font size,
and the setting in the PAD= option.
LAYER=FRONT | BACK
specifies the layer on which this draw statement’s output is drawn.
Default FRONT
Tip For elements that are obstructed because they are in the back layer, you can
suppress the display of filled areas in the graph. You can also use
transparency to manage the element visibility. For more information, see
“About Drawing Layers” on page 1195 .
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the text box’s border.
dimension
specifies a dimension to use for the extra space at the left, right, top, and bottom
of the text box border.
(pad-options)
a space-separated list of one or more of the following name-value-pair options
enclosed in parentheses:
Note Sides that are not assigned padding are padded with the default amount.
ROTATE=number
specifies the angle of rotation of the text box, measured in degrees. The text box is
rotated around its anchor point. The angle is measured from a horizontal line passing
1254 Chapter 14 • Draw Statements
through the anchor point of the text box to the right. The following figure shows the
rotation of text around a top anchor point.
Positive angles rotate the text box counter clockwise, and negative angles rotate the
text box clockwise. The angle specification can exceed 360 degrees in absolute
value.
TRANSPARENCY=number
specifies the degree of the transparency of this draw statement’s output.
Default 0
URL=string | string-expression
specifies an HTML page that is displayed when the output of this draw statement is
selected.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
string | string-expression
specifies a valid HTML page reference (HREF) for the graphical element that is
drawn by this draw statement.
Example http://www.sas.com/technologies/analytics/
index.html
WIDTH=positive-number
specifies the width of the text box.
Default 10
Default PERCENT
Interaction This setting combines with the XSPACE= setting to interpret the width
that is set in the WIDTH= option.
X=constant | scalar-expression
specifies the anchor point’s X coordinate.
Default 50
XAXIS=X | X2
specifies whether the data value for the arguments X1 and X2 are interpreted using
the primary X axis scale or to the secondary X (X2) axis scale.
Default X
Y=constant | scalar-expression
specifies the anchor point’s Y coordinate.
Default 50
YAXIS=Y | Y2
specifies whether the data value for the arguments Y1 and Y2 are interpreted using
the primary Y axis scale or to the secondary Y (Y2) axis scale.
Default Y
Prefix Option
TEXTATTRS=style-element | style-element (text-options) | (text-options)
prefix-option that specifies the color and font properties of the entire text string or
individual text-items.
Interaction When multiple TEXTATTRS= prefix options are used, each one
cancels the last, resetting all text properties to the default set by the
GraphValueText style element. Subsequent text-items to the right are
then assigned the text properties specified in the closest TEXTATTRS=
setting to their left. Thus, to vary the text properties across text-items,
you do not have to override settings from a previous TEXTATTRS=
setting. Each TEXTATTRS= specification resets all text properties to
the default so that only the new settings are applied to subsequent text-
items.
Tip To ensure that all text has the same text properties, use this prefix
option once only and place it before the first text-item.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Text Commands
{ SUB "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as subscript text.
See “Rules for Unicode and Special Character Specifications” on page 1142
Example drawtext "y = " b{sub "0"} " + b" {sub "1"} "x";
See “Rules for Unicode and Special Character Specifications” on page 1142
Example: DRAWTEXT Statement 1257
Example drawtext "R" {sup "2"} " = " {format (6.4) RSQUARED} ;
Example The following statements show how to use the {UNICODE} text
command:
drawtext {unicode alpha} "=" CONF;
Details
A DRAWTEXT statement draws a text box that contains one or more lines of text. The
text can be formatted, using the TEXTATTRS= prefix option. By default, the text box is
drawn in the center of the graph. You can change the default position with the options
ANCHOR= , X= , Y= , XSPACE= , and YSPACE= .
For general information about the types of elements that can be drawn with the draw
statements, the drawing space and drawing units that they use, and how the drawn
elements are anchored, see Chapter 13, “Key Concepts for Using Draw Statements,” on
page 1189 . For detailed usage information, consult the SAS Graph Template Language:
User's Guide.
The following graph was generated by the “Example Program” on page 1258. The first
DRAWTEXT statement shows how to draw multiple lines of text in a specific position
within the graph. The second DRAWTEXT statement shows how to create a watermark,
which is achieved by applying transparency to text that is rotated within the graph.
1258 Chapter 14 • Draw Statements
Example Program
proc template;
define statgraph modelfit;
begingraph;
entrytitle "Regression Fit Plot";
layout lattice;
layout overlay / xaxisopts=(offsetmin=0.1);
drawtext textattrs=(style=italic size=8pt)
"Band shows 99% Confidence Limit of Mean" /
anchor=bottomleft width=15 widthunit=percent
xspace=wallpercent yspace=wallpercent
x=0 y=10 justify=center ;
modelband "myclm";
scatterplot x=height y=weight / primary=true;
regressionplot x=height y=weight / alpha=0.01 clm="myclm";
endlayout;
endlayout;
drawtext textattrs=(color=gray size=52pt) "CONFIDENTIAL" /
transparency=0.75 rotate=-35
width=110 widthunit=percent justify=center ;
endgraph;
end;
Part 10
Chapter 15
About the GTL Annotation Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1261
Chapter 16
The ANNOTATE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267
1260
1261
Chapter 15
About the GTL Annotation Facility
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1261
The Annotation Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1262
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1262
Annotation Data Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1262
About the Coordinate Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1264
About the Drawing Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1264
Using the SGANNO Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1265
The ANNOTATE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1266
The SGRENDER Statement SGANNO Option . . . . . . . . . . . . . . . . . . . . . . . . . . . 1266
Overview
The GTL supports data-set-driven annotations, which enables you to add the following
graphics elements to your graphs:
• text
• lines and arrows
• circles and ovals
• squares and rectangles
• polygons and polylines
• images
Unlike graphics elements that are drawn using GTL draw statements in a GTL template,
data-set-driven annotations are drawn from graphics instructions that are stored in a SAS
data set. The GTL annotation facility is similar to the SAS/GRAPH Annotate facility.
The GTL annotation facility enables you to separate your annotation instructions from
your template statements. To change your annotations, you can specify a different
annotation data set or modify the instructions in the original data set. You do not have to
modify your template code.
The following items are required in order to use the GTL annotation facility:
• a SAS data set that contains the annotation instructions
• at least one ANNOTATE statement in your GTL template
1262 Chapter 15 • About the GTL Annotation Facility
Overview
The annotation data set contains the instructions for drawing annotations. Each
observation in the data set contains columns for an annotation instruction. The following
information is typically stored in these columns:
• the annotation function name
• the coordinates of the annotation location
• the drawing space
• the attributes of the annotation, such as color, font, and so on
The information that is required for each instruction is function-dependent. See
“Annotation Data Requirements” on page 1262.
To create the annotation data set, you can use the same methods that you would use to
create any SAS data set. The most common method is to use a DATA step. For more
information about the DATA step, see SAS Language Reference: Concepts. Macros are
available that you can run in your DATA step to create the observations for your
annotations. See “Using the SGANNO Macros” on page 1265.
Additional Columns
FUNCTION Required* Description
IMAGE Image This column stores the path to the image file
(character).
For the remaining information such as LINECOLOR, TEXTFONT, and so on, default
values are used. To change the default values, you can add the necessary columns to
your instruction observations. For information about other columns that you can add for
each function, see “SG Annotation Function Dictionary” in SAS ODS Graphics:
Procedures Guide
1264 Chapter 15 • About the GTL Annotation Facility
DrawSpace Specifies the drawing space for all coordinates. This value cannot be used
with the POLYCONT function.
X1Space Specifies the drawing space for the X1 coordinate. This value cannot be
used with the TEXTCONT function.
X2Space Specifies the drawing space for the ending X2 coordinate. This value can be
used with the ARROW and LINE functions only.
Y1Space Specifies the drawing space for the Y1 coordinate. This value cannot be
used with the TEXTCONT function.
Y2Space Specifies the drawing space for the ending Y2 coordinate. This value can be
used with the ARROW and LINE functions only.
For information about these columns, see “SG Annotation Function Dictionary” in SAS
ODS Graphics: Procedures Guide
The Annotation Data Set 1265
%SGANNO Compiles the available macros and makes them available for
you to use.
Note: You must run the %SGANNO macro in your SAS
session before you can use any of the other annotation macros
that are listed in this table.
For more information about these macros, see SAS ODS Graphics: Procedures Guide.
1266 Chapter 15 • About the GTL Annotation Facility
Chapter 16
The ANNOTATE Statement
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267
ANNOTATE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267
Dictionary
ANNOTATE Statement
Draws annotations from annotation instructions that are stored in a SAS data set.
Requirements: The annotation instructions must be stored in a SAS data set.
The annotation data set must be specified by the SGANNO= option in the
SGRENDER statement.
Tips: When the ANNOTATE statement is placed inside a LAYOUT container, the layout
container is used as the context when DRAWSPACE for an annotation is specified
as LAYOUT, WALL, or DATA.
When the DRAWSPACE for an annotation object is GRAPH, the context for drawing
the object is the graph area regardless of where the ANNOTATE statement is
located.
The LAYER option determines whether the annotations are drawn in front of the
graph elements or behind them.
See: “The Annotation Data Set” on page 1262
“SG Annotation Function Dictionary” in SAS ODS Graphics: Procedures Guide
SGRENDER statement SGANNO= option
“Adding Data-Driven Annotations to Your Graph” in SAS Graph Template Language:
User's Guide
Syntax
ANNOTATE </ID="annotation-ID">
1268 Chapter 16 • The ANNOTATE Statement
Optional Argument
ID="annotation-identifier"
specifies the ID column value of the annotations that are to be drawn. The ID column
of the annotation data set contains a unique character value that identifies the subset
to which each annotation belongs. All annotations in the annotation data set with an
ID column value that matches the specified annotation identifier are drawn. If the
annotation data set does not contain an ID column or if no ID column value matches
the specified identifier, then no annotations are drawn.
Default All of the annotations in the annotation data set are drawn.
Requirement The annotation data set must contain an ID column, and at least one
ID column value must match the specified identifier value.
Tips The ID= option can be used with the annotation data set ID column to
subset the annotations that are stored in an annotation data set.
Details
You can use the ANNOTATE statement anywhere in a GTL template to render
annotation objects in the current context. The annotation objects are read from an
annotation data set that is specified by the SGANNO= option in the SGRENDER
statement. You must use at least one ANNOTATE statement in the template to draw the
annotations. By default, all of the annotations in the annotation data set are drawn. You
can use the ID column in the annotation data set with the ID= option in the ANNOTATE
statement to draw only a subset of the annotations in the data set, if you want to. See
“Subsetting Annotations” in SAS Graph Template Language: User's Guide.
Examples
Example Program
/* Create the annotation data set */
data anno;
length label $30 id $5 anchor $12;
drawspace="wallpercent";
Program Description
Create the annotation data set Anno. The annotation data set contains two
observations, one for each label. The DRAWSPACE is set to WALLPERCENT for both
labels. The ID column specifies an identifier for each label. The bar chart label is
identified as BAR. It is rotated 90 degrees, anchored on TOP, and is placed at 0% of the
wall space along the X axis. The default value 50% percent is used along the Y axis to
center the label vertically. This places the label on inside left edge of the bar chart wall.
This histogram label is identified as HIST. It is rotated 90 degrees, anchored on
BOTTOM, and is placed at 100% of the wall space along the X axis. Like the bar chart
label, the default 50% percent is used along the Y axis. This places the label on the right
inside edge of the histogram plot wall.
/* Create the annotation data set */
data anno;
length label $30 id $5 anchor $12;
drawspace="wallpercent";
Define the graph template. The template defines a two-column, one-row lattice for the
two plots. For both plots, the DISPLAY= Y axis option suppresses the default axis label.
For the bar chart, the OFFSETMIN= and OFFSETMAX= X axis options reserve space
for the Y-axis label. The ANNOTATE statement draws the axis label. The ID="BAR"
option in the ANNOTATE statement draws the bar chart Y-axis label in the context of
Example 2: Using the SG Annotation Macros to Generate Your Annotation Data 1271
the bar chart’s overlay layout. For the histogram, the ANNOTATE statement draws the
histogram Y-axis label (ID="HIST") in the context of the histogram’s overlay layout.
/* Define the template */
proc template;
define statgraph anno;
begingraph;
entrytitle "Vehicle Statistics";
layout lattice / columns=2 columngutter=10;
layout overlay /
xaxisopts=(offsetmin=0.2 offsetmax=0.2)
yaxisopts=(display=(ticks tickvalues));
Render the graph with the annotations. The SGANNO=ANNO option is included in
the SGRENDER statement to specify the name of the annotation data set. When the
graph is rendered, the ANNOTATE statements in the graph template cause the
annotations to be drawn.
/* Render the graph with the annotation */
proc sgrender data=sashelp.cars template=anno sganno=anno;
where type in ("Sedan" "Sports" "SUV");
run;
Example Program
/* Create the annotation data set */
data anno;
/* Compile the annotation macros */
%sganno;
%sgtext(
reset=all,
id=BAR,
drawspace=wallpercent,
x1=0,
label="MPG (City)",
textweight=bold,
anchor=top,
rotate=90,
width=1000,
widthunit=pixel);
Program Description
Here is the SAS code.
Open the DATA step and run the %SGANNO macro. After you open the DATA step,
you must run the %SGANNO macro to compile the SG annotation macros and make
them available for your use. You need to compile the macros only once during a SAS
session.
/* Create the annotation data set */
data anno;
/* Compile the annotation macros */
%sganno;
Create the observation for the bar chart Y-axis label. Use the %SGTEXT macro to
generate the observation for the bar chart Y-axis label.
/* Create the bar chart Y-axis label. */
%sgtext(
reset=all,
id=BAR,
drawspace=wallpercent,
x1=0,
label="MPG (City)",
textweight=bold,
anchor=top,
rotate=90,
width=1000,
widthunit=pixel);
Create the histogram Y-axis label, and close the DATA step. Specify the new values
for the ID, X1, Label, and Anchor columns. To carry over the remaining column values
from the previous macro call, do not specify RESET=ALL.
/* Create the histogram Y-axis label. */
%sgtext(
id=HIST,
x1=100,
Example 2: Using the SG Annotation Macros to Generate Your Annotation Data 1273
See Also
• Chapter 15, “About the GTL Annotation Facility,” on page 1261
• “Adding Data-Driven Annotations to Your Graph” in SAS Graph Template
Language: User's Guide
1274 Chapter 16 • The ANNOTATE Statement
1275
Part 11
Attribute Maps
Chapter 17
Key Concepts for Using Attribute Maps . . . . . . . . . . . . . . . . . . . . . . . . 1277
Chapter 18
Discrete Attribute Map Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1287
Chapter 19
Range Attribute Map Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1301
1276
1277
Chapter 17
Key Concepts for Using Attribute
Maps
Use the attribute map variable to reference the attribute map in plot statements.
Note: Do not use the attribute variable in an expression. Doing so might produce
unexpected results.
Note: The values and graphical attributes that are defined in a discrete attribute map
cannot be displayed by a CONTINUOUSLEGEND statement.
For for more information, see “Defining a Discrete Attribute Map in a
DISCRETEATTRMAP Block” on page 1292.
The following table lists the columns that you can use to specify the graphical properties
for each classification value. Properties that you do not specify default to the properties
that are normally used when an attribute map is not specified.
FillColor Character Specifies the color for the filled areas for this
classification value. When FillStyleElement is also
specified, this column overrides the specified style
element’s color attribute.
FillTransparency Numeric Specifies the transparency of the fill color for this
classification value. Values are in the range 0 (opaque)
to 1 (completely transparent).
LineColor Character Specifies the line color for this classification value.
When LineStyleElement is also specified, this column
overrides the specified style element’s contrast color
attribute.
LinePattern Character Specifies the line pattern for this classification value.
or Numeric You can specify the pattern name or number. See
“Available Line Patterns” on page 1352.
MarkerColor Character Specifies the color of the marker symbol for this
classification value. When MarkerStyleElement is also
specified, this column overrides the specified style
element’s contrast color attribute.
MarkerSize Numeric Specifies the size of the marker, in pixels, for this
classification value. The values must be integers.
MarkerSymbol Character Specifies the marker symbol to use for this classification
value. See SYMBOL= in “Marker Options” on page
1350. When MarkerStyleElement is also specified, this
column overrides the specified style element’s marker
symbol attribute.
TextColor Character Specifies the text color for this classification value.
TextFont Character Specifies the text font by name for this classification
value.
Defining a Range Attribute Map 1281
TextSize Numeric Specifies the text font size in points for this
classification value. The values must be integers.
TextStyle Character Specifies the text style for this classification value. Valid
values are NORMAL and ITALIC.
TextWeight Character Specifies the text weight for this classification value.
Valid values are NORMAL and BOLD.
Show Character Specifies whether the legend displays only the attribute
map values that appear in the data or always displays all
of the values in the attribute map. Valid values are
DATA and ATTRMAP. The default is DATA.
Note: This column is valid starting with the third
maintenance release of SAS 9.4.
The ID column provides the name of the attribute map, which is specified in the
ATTRMAP= option in the DISCRETEATTRVAR statement or in a DATTRVAR
statement. When the graph is rendered, the name of the attribute map data set must be
specified in the DATTRMAP= option in the SGRENDER statement. For information
about how to reference the attribute map in your plot statements, see “Referencing a
Discrete Attribute Map in Plot Statements” on page 1282.
• The VAR= option specifies the name of the numeric column in the plot data set
with which the range attribute map is to be associated.
Note: A RANGEATTRMAP can be used with a numeric column only.
• The attribute map variable is used to reference the discrete attribute map in plot
statements.
Note: The values and graphical attributes defined in a range attribute map cannot be
displayed by a DISCRETELEGEND statement.
For information about how to reference a range attribute map, see “Referencing a
Discrete Attribute Map in Plot Statements” on page 1282.
The RANGE statements in the RANGEATTRMAP block can associate a range of values
or a single value with a single color or a color ramp. The syntax of the RANGE
statement is as follows:
RANGE low-value< < > – < < >high-value / options
The optional exclusion operator (<) can be placed after the low value or before the high
value to exclude that value from the range endpoint. The low value and high value can
be an unformatted numeric value or a range keyword. For the low value, keyword MIN,
NEGMAX, or NEGMAXABS can be used instead of numeric value. For the high value,
keyword MAX or MAXABS can be used. For information about the range keywords,
see SAS Graph Template Language: Reference.
Note: If two ranges share a common endpoint, such as 10–20 and 20–30, and no
exclusion operator ( < ) is used, then the common endpoint belongs to the lower
range, which is 10–20 in this case.
For for more information about how to create a range attribute map, see “Creating and
Using a Range Attribute Map” on page 1305.
Statement Options
Statement Options
In a DISCRETELEGEND statement, reference the plot statement that uses the attribute
map. The plot statement must have a NAME= option that assigns a name to the plot,
because the DISCRETELEGEND statement references that name. Because the attribute
map is referenced in the plot statement, the legend uses the attribute map to represent the
group values that exist in the data.
TIP If the discrete attribute map is defined in a DISCRETEATTRMAP block, then
you can use the DISCRETELEGENDENTRYPOLICY=ATTRMAP option in the
DISCRETEATTRMAP statement to display all of the items that are defined in the
attribute map regardless of whether the values appear in the data. See
DISCRETELEGENDENTRYPOLICY= on page 1288.
For an example of how to reference an attribute map variable that is created with the
DISCRETEATTRVAR statement, see “Example: DISCRETEATTRVAR Statement with
an Attribute Map Data Set” on page 1298.
The following code shows you how to reference an attribute map when a DATTRVAR
statement is used in the SGRENDER statement to associate discrete attribute map
SYMBOLS with classification column Sex. The SYMBOLS attribute map is defined in
a SAS data set, and the column Sex is referenced in a SCATTERPLOT statement.
/* Create the attribute map data set */
data attrds;
input ID $1-7 VALUE $9 MARKERSYMBOL $11-23 MARKERCOLOR $25-30;
datalines;
symbols M diamondfilled blue
symbols F circlefilled red
;
run;
Table 17.4 Statement Options That Support a Range Attribute Map Variable Reference
Statement Options
BUBBLEPLOT COLORRESPONSE=
HEATMAP COLORRESPONSE=
HEATMAPPARM COLORRESPONSE=
MOSAICPLOTPARM COLORRESPONSE=
POLYGONPLOT COLORRESPONSE=
WATERFALLCHART COLORRESPONSE=
Chapter 18
Discrete Attribute Map
Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1287
DISCRETEATTRMAP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1287
DISCRETEATTRVAR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1297
Dictionary
DISCRETEATTRMAP Statement
Defines a set of graphical properties that can be associated with user-defined sets of values.
Restriction: The DISCRETEATTRMAP block cannot be nested within any other block.
Requirements: The DISCRETEATTRMAP block and the DISCRETEATTRVAR statement must
appear in the global definition area of the template between the BEGINGRAPH
statement and the first LAYOUT statement.
The DISCRETEATTRMAP block must contain at lease one VALUE statement.
The DISCRETEATTRVAR statement must be used to associate the discrete attribute
map with a data column.
Notes: The graphical properties for a discrete attribute map can also be defined in a SAS
data set. See “Defining a Discrete Attribute Map” on page 1278.
Prior to the third release of SAS 9.4, when a discrete attribute map is used for group
values in a plot that contributes to a discrete legend and attributes are overridden in
the plot statement, the attributes of some plot features and their corresponding
legend items might not match. Starting with the third maintenance release of SAS
9.4, the attributes of the legend items always match the attributes of the
corresponding plot features.
See: “DISCRETEATTRVAR Statement” on page 1297
Syntax
DISCRETEATTRMAP NAME="string" </option(s)>;
VALUE value-spec </option(s)>;
<… more VALUE statements …>
ENDDISCRETEATTRMAP;
1288 Chapter 18 • Discrete Attribute Map Statements
Required Argument
NAME="string "
assigns a name to the attribute definition. The name can be referenced in a
DISCRETEATTRVAR statement, which is used to associate the attribute map with
an input data column. The name can also be referenced in a DISCRETELEGEND
statement to map the specified graphical properties directly to a discrete legend.
Restriction The string is case sensitive, must be enclosed in quotation marks, and
must define a unique name within the template.
Optional Arguments
DISCRETELEGENDENTRYPOLICY=DATA | ATTRMAP
specifies whether the items that are contributed to a discrete legend by the plot
associated with this attribute map are only items that appear in the data or only items
that are defined in the attribute map.
Note: This option is valid in the first maintenance release of SAS 9.4 and later
releases.
DATA
the associated plot contributes to a discrete legend only items that appear in the
data.
ATTRMAP
the associated plot contributes to a discrete legend only items that are defined in
the discrete attribute map.
Interaction If this option is set to ATTRMAP, then data skins, overrides from
the DATATRANSPARENCY= option, and overrides from the
TRANSPARENCY= suboption in the FILLATTRS= and
MARKERATTRS= options are displayed in the discrete legend.
Overrides from other options such as the COLOR= suboption in the
FILLATTRS= option are not displayed.
Default DATA
IGNORECASE=TRUE | FALSE
specifies whether case is ignored when comparing the values that are specified in the
attribute map with values from an input data column.
Tip The effect of this option can be achieved by applying a function like
UPCASE to the data column and using only uppercase strings in each
VALUE statement.
See “boolean ” on page 1339 for other Boolean values that you can use.
TRIMLEADING=TRUE | FALSE
specifies whether leading blanks are trimmed (removed) from both the attribute map
values and the input data values before those values are compared. Trailing blanks
are always trimmed.
See “boolean ” on page 1339 for other Boolean values that you can use.
DISCRETEATTRMAP Statement 1289
Note If OTHER is not specified, then data values that are not explicitly
assigned with VALUE statements are mapped to attributes as if a discrete
attribute map is not in effect.
Note When the specified value strings are compared with the data values,
leading blanks are honored and trailing blanks are ignored.
1290 Chapter 18 • Discrete Attribute Map Statements
Tip In the first maintenance release of SAS 9.4 and earlier releases, if you
create and use a format to display a special value for missing character
values, in some cases, " " is returned instead of the formatted value. If
your attribute map assigns attributes to the formatted missing value in
that case, the attributes are not assigned to the missing values. To
correct this problem, specify both " " and your formatted missing value
in the VALUE statement for your missing-value attributes. This issue is
resolved staring with the second maintenance release of SAS 9.4.
Restriction In SAS 9.4 and earlier releases, the TRANSPARENCY= fill option is
ignored. Starting with the first maintenance release of SAS 9.4, the
TRANSPARENCY= fill option is supported.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
Restriction In SAS 9.4 and earlier releases, the THICKNESS= line option is
ignored. Starting with the first maintenance release of SAS 9.4, the
THICKNESS= line option is supported.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style-element.
When DISCRETELEGENDENTRYPOLICY=ATTRMAP,
unspecified attributes derive attributes from the GraphDataDefault
style element.
See “General Syntax for Attribute Options” on page 1347 for the syntax
on using a style-element.
See “General Syntax for Attribute Options” on page 1347 for the syntax on
using a style element.
Details
• a case-sensitive comparison is performed between the column string and the VALUE
string.
To change the default behavior for the comparison, you can use the
DISCRETEATTRMAP statement’s TRIMLEADING= and IGNORECASE= options.
Displaying Legend Entries for Group Values That Are Not in the
Data
To display legend entries for the values in a grouped plot, you typically use the plot
statement’s NAME= option to assign a name to the plot, and then reference that name in
the DISCRETELEGEND statement. In this usage case, the legend displays entries for
the group values that exist in the data.
To represent all of the group values in the legend, regardless of whether they exist in the
data, you can specify DISCRETELEGENDENTRYPOLICY=ATTRMAP in the
DISCRETEATTRMAP statement for the attribute map. When the
DISCRETELEGENDENTRYPOLICY=ATTRMAP option is in effect, the associated
plot contributes all of the items in the attribute map to the discrete legend regardless of
whether they exist in the data.
Displaying all of the items in a discrete attribute map in the legend can be useful for
flagging data in the graph. For example, assume you have weight and height values for
all students in an analysis group and you want to create a scatter plot of the data.
However, some of the observations are incomplete and do not record the student’s sex.
You want to include the incomplete observations in your plot, but you want to visually
distinguish them from the others. In that case, you can do the following:
• Represent the unknown values in your data by entering the value U for sex.
• Define the discrete attribute map for the plot in a DISCRETEATTRMAP block.
Include the DISCRETELEGENDENTRYPOLICY=ATTRMAP option in the
DISCRETEATTRMAP statement. Include VALUE statements that specify the
properties for the M, F, and U values.
• Use the DISCRETEATTRVAR statement to create a discrete attribute map variable
that associates the attribute map with column Sex in the input data.
• In the SCATTERPLOT statement, specify the discrete attribute map variable name in
the GROUP= option.
• In the DISCRETELEGEND statement, reference the scatter plot.
As a result, the legend displays the attribute-map definitions, and observations with the
value U in column Sex are displayed as incomplete observations.
1294 Chapter 18 • Discrete Attribute Map Statements
Here is an example of a template that uses a discrete attribute map to uniquely display
observations with the value U in column Sex.
proc template;
define statgraph discreteattrmapdatapresent;
begingraph;
entrytitle "Height and Weight by Sex";
/* Define the attribute map and assign the name "symbols" */
discreteattrmap name="symbols" / trimleading=true ignorecase=true
discretelegendentrypolicy=attrmap;
value "M" / markerattrs=(color=blue symbol=diamondfilled);
value "F" / markerattrs=(color=green symbol=circlefilled);
value "U" / markerattrs=(color=red symbol=starfilled);
enddiscreteattrmap;
To test the template, you can generate test data set Testclass from Sashelp.Class by
changing the value of column Sex to U for John and Carol as shown in the following
code.
data testclass;
set sashelp.class;
if (name="John") then sex="U";
if (name="Carol") then sex="U";
run;
The following figure shows the output of this template when it is run with the test data
set Testclass.
The two red stars in the plot indicate the observations with the value U in column Sex.
The next figure shows the output of this template when it is run with the complete data
in data set Sashelp.Class.
Example: DISCRETEATTRMAP and DISCRETEATTRVAR Statements 1295
The absence of the red stars in the plot indicates that the value U is no longer present in
the data. All of the observations are now complete. When
DISCRETELEGENDENTRYPOLICY=ATTRMAP is specified for an attribute map, be
aware that the legend entries that are contributed by an associated plot are defined
entirely by the attribute map and are independent of the data.
The following graph was generated by the “Example Program” on page 1296. The
example defines graphical properties to associate with classification values in an input
column that is used in a scatter plot. The DISCRETEATTRMAP statement starts the
attribute map definition, assigns a name to it, and ensures that the data mapping is not
case sensitive. The VALUE statements define the colors and marker symbols to associate
with the values M and F. The DISCRETEATTRVAR statement associates the attribute
map with the data column Sex and assigns the name GROUPMARKERS to the
association. The SCATTERPLOT statement references the named association in its
GROUP= option.
1296 Chapter 18 • Discrete Attribute Map Statements
Example Program
proc template;
define statgraph scatterplot;
begingraph;
entrytitle "Height and Weight by Sex";
/* associate the attribute map with input data column Sex and assign
* the name GROUPMARKERS to the named association */
discreteattrvar attrvar=groupmarkers var=sex attrmap="symbols" ;
DISCRETEATTRVAR Statement
Creates a named association between a user-defined discrete attribute map and an input data column.
Restriction: The DISCRETEATTRVAR statement cannot appear within a DISCRETEATTRMAP
or RANGEATTRMAP block.
Requirement: A discrete attribute map must be created using the DISCRETEATTRMAP statement.
See: “Example: DISCRETEATTRMAP and DISCRETEATTRVAR Statements” for an
example.
Syntax
DISCRETEATTRVAR ATTRVAR=attrvar-name
VAR=data-column | expression | dynamic
ATTRMAP="attrmap-name";
Required Arguments
ATTRVAR=attrvar-name
specifies a SAS name for this association between the attribute map and the input
column. This name must be unique within the template and can be referenced by
other statements that can be associated with the attribute map. The attribute map
variable name should not be used in an expression. If it is, then the results are
unpredictable.
Note The assigned SAS name can be the same as the name of the data input
column, but it is not recommended. If an assigned attrvar-name
matches the name of an input data column, then the attrvar-name takes
precedence.
Interaction If the column is not found or the column is of the wrong type for the
attribute map, then the DISCRETEATTRVAR statement is ignored.
Tip The input data column can be character or numeric, but the values must
match the type of the values that are specified in the attribute map. For
numeric columns, all values are treated as discrete values.
1298 Chapter 18 • Discrete Attribute Map Statements
ATTRMAP="attrmap-name "
specifies the name of an existing discrete attribute map.
Details
The DISCRETEATTRVAR statement creates and names an association between
graphical properties that are specified in a DISCRETEATTRMAP block and a
classification column that is in the data. The name that is assigned to the association in
the DISCRETEATTRVAR statement is the name that plot statements must reference to
use the attribute map.
Defining and using a discrete attribute map requires you to coordinate settings on several
statements. For more information, see the DISCRETEATTRMAP statement’s “Defining
a Discrete Attribute Map in a DISCRETEATTRMAP Block” on page 1292 .
The DISCRETEATTRVAR statement must be located within the BEGINGRAPH block
but outside of the outermost layout block. It cannot be nested in a
DISCRETEATTRMAP statement.
Starting with the first maintenance release of SAS 9.4, you can define an attribute map in
a SAS data set. This example shows you how to use the DISCRETEATTRVAR
statement with an attribute map that is defined in a SAS data set. It is the example in
“Example: DISCRETEATTRMAP and DISCRETEATTRVAR Statements” on page
1295 modified to use a SAS data set instead of a DISCRETEATTRMAP block.
Example: DISCRETEATTRVAR Statement with an Attribute Map Data Set 1299
Example Program
Here is the SAS code for this example.
/* Create the attribute map data set */
data attrds;
input ID $1-7 VALUE $9 MARKERSYMBOL $11-23 MARKERCOLOR $25-30;
datalines;
symbols M diamondfilled blue
symbols F circlefilled red
;
run;
/* Associate the attribute map with input data column Sex and assign
* the name GROUPMARKERS to the named association */
discreteattrvar attrvar=groupmarkers var=sex attrmap="symbols";
Details
The attribute map is defined in data set Attrds. The data set includes the required
columns ID and VALUE, which specify a name for this attribute map and the value of
the classification variable that is to be mapped. The MarkerSymbol and MarkerColor
columns specify the graphical properties that are mapped to each value. The values
specified in the Value column are case-sensitive. Unlike the DISCRETEATTRMAP
statement, when you define your attribute map in a data set, there is no option that you
can specify to ignore case. You must ensure that the case of the values in your attribute
map matches the case in the actual data.
The DISCRETEATTRVAR statement associates the attribute map with the data column
Sex and assigns the name GROUPMARKERS to the attribute map variable. The
ATTRMAP= option specifies the name in the ID column of the attribute map data set.
The value is case-sensitive. The attribute map variable name is specified in the GROUP=
option in the SCATTERPLOT statement.
Finally, in the SGRENDER statement, the DATTRMAP= option specifies the name of
the attribute map data set. When your attribute map is defined in a SAS data set, you
must specify the name of the data set in the DATTRMAP= option in the SGRENDER
statement that renders the graph.
You can also use the DATTRVAR= statement with the SGRENDER statement to
associate the attribute map with the data column Sex. See “Referencing an Attribute
Map in Your Plot Statements” on page 1282.
1301
Chapter 19
Range Attribute Map Statements
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1301
RANGEATTRMAP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1301
RANGEATTRVAR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1308
Dictionary
RANGEATTRMAP Statement
Creates an attribute map that matches colors to numeric values or numeric ranges so that the colors can
be associated with the values of an input data column.
Restriction: A RANGEATTRMAP cannot be directly referenced in a legend statement.
Requirements: The RANGEATTRMAP block must appear in the global definition area of the
template between the BEGINGRAPH statement and the first LAYOUT statement. It
cannot be nested within a RANGEATTRMAP or DISCRETEATTRMAP block.
The RANGEATTRMAP block must contain at lease one RANGE statement.
The RANGEATTRVAR statement must be used to associate the range attribute map
with a data column.
Note: The RANGEATTRMAP statement defines a set of graphical properties for ranges of
data values.
See: “RANGEATTRVAR Statement” on page 1308
Syntax
RANGEATTRMAP NAME="string";
RANGE range-spec </option(s)>;
<… more-RANGE statements …>
ENDRANGEATTRMAP;
Required Argument
NAME="string "
assigns a name to the attribute definition for reference in a RANGEATTRVAR
statement.
1302 Chapter 19 • Range Attribute Map Statements
Restriction The string is case sensitive, must be enclosed in quotation marks, and
must define a name that is unique among RANGEATTRMAP names
within the template.
If a value at the high end of one range also appears at the low end of another range
and you do not use the < exclusion notation, then the value is assigned to the first
range.
If two or more RANGE statements define colors to associate with the same numeric
values or ranges, then the first RANGE statement's settings are used. If any RANGE
statement's range overlaps another RANGE statement's range (for example, 10 - 20
and 15 - 25), then the entire attribute map is ignored and default coloring is used.
If two ranges share a common endpoint (for example, 10 - 20 and 20 - 30) and no
exclusion operator is used, then the common endpoint belongs to the lower
encountered range (10 - 20 in this case). The order of the specification does not
matter.
To set a single numeric value, specify the same value for both the low value and the
high value.
If the low value is not less than or equal to the high value, then the range
specification is invalid, and the RANGE statement is ignored in the attribute map
definition.
Note: If a range is not defined for keyword OTHER, then gaps within the attribute
map ranges are assigned the default color that is defined by the
GraphOther:ContrastColor style reference.
Rather than using a numeric value, you can specify one of the following keywords as
the low value or the high value:
Rather than specifying a low-value-to-high-value range, you can use one of the
following keywords for the range specification:
MISSING
indicates a mapping for missing values. The visual attributes for this setting are
obtained from the GraphMissing style element. If one RANGE statement
specifies this value and another RANGE statement specifies keyword OTHER,
then the OTHER range does not include missing values.
UNDER
creates a range for all data values between the lowest mapped value and the
lowest actual data value. The visual attributes for this setting are obtained from
the GraphUnderflow style element. If one RANGE statement specifies this value
and another RANGE statement specifies keyword OTHER, then the OTHER
range does not include underflow values.
OVER
creates a range for all data between the highest mapped value and the highest
actual data value. The visual attributes for this setting are obtained from the
GraphOverflow style element. If one RANGE statement specifies this value and
another RANGE statement specifies keyword OTHER, then the OTHER range
does not include overflow values.
OTHER
creates a category for all other column values not explicitly assigned to a range.
The OTHER values can be composed of several non-contiguous ranges. The
visual attributes for this setting are obtained from the GraphOther style element.
RANGEALTCOLORMODEL=style-element | (list-of-colors)
specifies either a style element or a list of one or more specific contrast colors to
represent the defined value range in this argument.
style-element
specifies the name of a style element. To display the range as a gradient ramp,
choose a style element such as TwoColorRamp, TwoColorAltRamp,
ThreeColorRamp, or ThreeColorAltRamp. The style element should contain the
following style attributes:
MISSING GraphMissing:ContrastColor
OTHER GraphOther:ContrastColor
UNDER GraphUnderflow:ContrastColor
OVER GraphOverflow:ContrastColor
(list-of-colors)
a space-separated list of two or more color keywords that is enclosed in
parentheses.
Two colors create the endpoints of a ramp. The first color is assigned to the low
value in the range specification, and the second color is assigned to the high
RANGEATTRMAP Statement 1305
value. Three or more colors partition the range specification into n-1 equal-sized
intervals where each adjacent color pair defines a two-color ramp.
RANGECOLORMODEL=style-element | (list-of-colors)
specifies either a style element or a list of one or more specific colors to represent the
defined value range in this range-spec argument.
style-element
specifies the name of a style element. To display the range as a gradient ramp,
choose a style element such as TwoColorRamp, TwoColorAltRamp,
ThreeColorRamp, or ThreeColorAltRamp. The style element should contain the
following style attributes:
MISSING GraphMissing:ContrastColor
OTHER GraphOther:ContrastColor
UNDER GraphUnderflow:ContrastColor
OVER GraphOverflow:ContrastColor
(list-of-colors)
a space-separated list of two or more color keywords that is enclosed in
parentheses.
Two colors create the endpoints of a ramp. The first color is assigned to the low
value in the range specification, and the second color is assigned to the high
value. Three or more colors partition the range specification into n–1 equal-sized
intervals, where each adjacent color pair defines a two-color ramp.
Details
enable you to map color to data values, independent of the actual data that is used in the
graph. For example, for temperature data, you can set Blue for 0 and Red for 100, even if
the values 0 and 100 are not in the data.
Defining and using the attribute map requires you to coordinate settings on several
statements:
• Use the RANGEATTRMAP statement to start the attribute definition and assign a
name to it.
• Nest within the RANGEATTRMAP block at least one RANGE statement that
specifies a numeric value or numeric range and the color to associate with that value
or range. Use one RANGE statement for each value range that you want to map. You
can use keywords like MIN and MAX in the range specification. For complete
details about the range specifications, see the RANGE statement.
• Use the RANGEATTRVAR statement to create a named association between the
defined attribute map and the input column that contains the numeric values. The
ATTRMAP= argument identifies the attribute map and the VAR= argument identifies
the input column. Use the ATTRVAR= argument to assign a name that can be used to
reference the named association in plot statements within the template.
• Reference the attribute map where needed. See “Referencing a Range Attribute Map
in Plot Statements” on page 1285.
The RANGEATTRMAP statement must be located within the BEGINGRAPH block but
outside of the outermost layout block. It cannot be nested in another RANGEATTRMAP
statement or in a RANGEATTRMAP statement. The RANGEATTRMAP block must
contain at least one RANGE statement. All values that are referenced in the attribute
map must be numeric. Data values that are not accounted for in the attribute map receive
the default color from the GraphOther, GraphOverflow, or GraphUnderflow style
element, depending on where the unassigned values are relative to the specified data
ranges.
Note: Unlike a DISCRETEATTRMAP statement, a RANGEATTRMAP statement
cannot be directly referenced in a legend. This is because the RANGE statements can
specify keywords like MIN and MAX that require a data association for
interpretation.
The following graph was generated by the “Example Program” on page 1307. The
example defines colors to associate with data ranges in an input column that is used in a
grouped scatter plot. The RANGEATTRMAP statement starts the attribute map
definition and assigns a name to it. The RANGE statements define the value ranges and
the colors to associate with those ranges. Because the SCATTERPLOT statement uses
the ContrastColor style attribute for the marker colors in a grouped plot, the
RANGEALTCOLOR= and RANGEALTCOLORMODEL= options are used in the
RANGE statement to define the range colors.
The highest range value specified, which is 0.002 in this example, does not have to be an
actual value in the data. The RANGEATTRVAR statement associates the attribute map
with the data column Density and assigns the name RANGEVAR to the association. The
SCATTERPLOT statement references the named association in its
MARKERCOLORGRADIENT= option.
Example Program
proc template;
define statgraph attrmap;
1308 Chapter 19 • Range Attribute Map Statements
begingraph;
entrytitle "Height and Weight Distribution" ;
/* associate the attribute map with input data column Density and
* assign variable name RANGEVAR to the named association */
rangeattrvar attrvar=rangevar var=density attrmap="densityrange" ;
RANGEATTRVAR Statement
Creates a named association between a range attribute map of numeric values or value ranges and an
input data column.
Requirement: A range attribute map must be created using the RANGEATTRMAP statement.
See: “Example: RANGEATTRMAP and RANGEATTRVAR Statements” on page 1307 for
an example.
Syntax
RANGEATTRVAR ATTRVAR=attrvar-name
VAR=data-column | expression | dynamic
ATTRMAP="attrmap-name";
Required Arguments
ATTRVAR=attrvar-name
specifies a SAS name for the map. This name must be unique among the
RANGEATTRVAR statements within the template. The assigned name can be
referenced by other statements that can be associated with the range attribute map.the
attrvar-name
RANGEATTRVAR Statement 1309
Interaction If the column is not found or the column is of the wrong type for the
attribute map, then the RANGEATTRVAR statement is ignored.
ATTRMAP="attrmap-name "
specifies the name of an existing range attribute map.
Details
The RANGEATTRVAR statement creates and names an association between colors that
are specified in a RANGEATTRMAP block and a numeric column that is in the data.
Attribute maps can be useful for controlling the application of gradient color in a graph
or specifying data values that are independent of the actual data. The name that is
assigned to the association in the RANGEATTRVAR statement is the name that plot
statements must reference to use the attribute map.
Defining and using a numeric-range attribute map requires you to coordinate settings on
several statements. For more information, see the RANGEATTRMAP statement’s
“Creating and Using a Range Attribute Map” on page 1305 .
The RANGEATTRVAR statement must be located within the BEGINGRAPH block but
outside of the outermost layout block. It cannot be nested in a RANGEATTRMAP
statement.
1310 Chapter 19 • Range Attribute Map Statements
1311
Part 12
Chapter 20
Dynamics and Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1313
Chapter 21
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1317
Chapter 22
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1321
Chapter 23
Conditional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1333
1312
1313
Chapter 20
Dynamics and Macro Variables
PROC TEMPLATE;
DEFINE STATGRAPH template-name ;
BEGINGRAPH;
GTL statements;
ENDGRAPH;
END;
RUN;
Note: For template readability, it is helpful to adopt a naming convention for these
variables to distinguish them from actual option values or column names. Common
conventions include capitalization, or adding leading or trailing underscores to their
names.
Dynamics and macro variables can be referenced within the template definition as
• argument or option values. For example:
Dynamics and run-time macro variable references cannot resolve to statement or option
keywords.
Note that macro variable references should not be prefaced with an ampersand (&) if
you want them to resolve at run time.
Macro variables defined by MVAR are strings when they resolve, as with SYMGET() in
the DATA step.
Macro variables defined by NMVAR are converted to numeric tokens when they resolve,
as with SYMGETN() in the DATA step.
The values for a dynamic variable do not have to be provided by the data source. Rather,
you can provide the values in the DYNAMIC statement in PROC SGRENDER,
specifying the values as a space delimited list, enclosed in quotation marks. Do not use
parentheses in the specification.
In the following example, the graph template specifies a dynamic variable named
TICKS, which is referenced on the XAXISOPTS= option in LAYOUT OVERLAY. The
DYNAMIC statement in PROC SGRENDER provides values for TICKS:
proc template;
define statgraph regress;
dynamic TICKS ;
begingraph;
layout overlay /xaxisopts=(linearopts=(tickvaluelist=TICKS));
scatterplot x=age y=weight;
endlayout;
endgraph;
end;
run;
final graph. A graph is produced, but it might be a blank graph, or it might show the
results of all statements except those that are in error.
For more information about using dynamics and macro variables in your templates, see
SAS Graph Template Language: User's Guide.
Values for dynamics that resolve to column names or strings should be quoted. Numeric
values should not be quoted.
For macro variables, use the current symbol table (local or global) to look up the macro
variable values at run time. For example,
%let locate=inside;
%let trans=0.3;
Chapter 21
Expressions
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1317
GTL Expressions Compared to WHERE Expressions . . . . . . . . . . . . . . . . . . . . . 1318
An Expression in Statement Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318
Overview
In Graph Template Language (GTL), as in Base SAS, an expression is an arithmetic or
logical expression that consists of a sequence of operators, operands, and functions. An
operand is a dynamic, a macro variable, a column, a function, or a constant. An operator
is a symbol that requests a comparison, logical operation, or arithmetic calculation. In
GTL, the expression must be enclosed in an EVAL function.
Expressions can be used to set the following types of option values:
• a constant
• a column
• part of the text for ENTRYTITLE, ENTRYFOOTNOTE, and ENTRY statements
Here is an example of computing constants:
When you are building a text string, you can use the || operator to concatenate the
substrings if none of the substrings are a numeric character value. If one or more of the
substrings are a numeric character value such as “1.5”, then the || operator might
produce unexpected results. In that case, use the CATS function to concatenate the
strings instead. Here is an example of using the CATS function to build a footnote text
string that includes the value of dynamic variable maxWeight, which stores a numeric
character value:
/* indicate the maximum weight in a footnote */
entryfootnote eval(cats("Maximum weight: ", maxWeight," lbs"));
Instead, the computed numeric column for the Y= argument consists of 0s and 1s, based
on whether each observation’s Height column value is between 40 and 60. Whenever
expressions are used to create new columns, a new column name is internally
manufactured so that it does not collide with other columns in use.
Automatic Type Conversion. Although expressions that are used in a DATA step
perform automatic type conversion, GTL expression evaluation does not. Thus, you
must use function(s) to perform required type conversions in an expression. Otherwise,
the expression generates an error condition without warning when the template is
executed.
For example, consider the following GTL expression:
if(substr(value, 1, 2) = "11")
This expression uses the SUBSTR function to determine whether the first two characters
from VALUE evaluate to the string value "11". If VALUE is a string, then the expression
works properly. However, if VALUE is numeric, then the expression generates an error
condition. For a numeric, you must convert the value to a string before passing it to the
SUBSTR function. The following modification uses the CATS function to perform the
type conversion when necessary:
Chapter 22
Functions
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1321
SAS Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1321
SAS Functions That Can Be Used in a GTL Template . . . . . . . . . . . . . . . . . . . . 1321
SAS Functions That Can Be Used to Create Flexible Templates . . . . . . . . . . . . . 1322
Examples of Using the IFC and IFN SAS Functions . . . . . . . . . . . . . . . . . . . . . . 1322
Functions Defined Only in GTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1324
GTL Functions Used with the EVAL Function . . . . . . . . . . . . . . . . . . . . . . . . . . 1324
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1326
Using the TYPEOF SAS Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1326
GTL Summary Statistic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1328
Commonly Used Summary Statistic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 1328
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1329
Overview
GTL supports a large number of functions, including:
• SAS functions that can be used in the context of a WHERE expression
• functions that are defined only in GTL
• summary statistic functions
SAS Functions
Not all SAS functions are available in WHERE expressions. Call routines and other
DATA-step-only functions (for example, LAG, VNAME, OPEN) are some examples of
functions that cannot be used. Not all functions that are available in WHERE
expressions are supported in GTL templates in all cases. The following form of the PUT
function is an example:
markercharacter = eval(put(amount, dollar7.2 -L))
This form results in an error when the template is compiled. However, the following
form is supported.
markercharacter = eval(put(amount, dollar7.2))
If you want to justify a string that is generated by the PUT function, use the LEFT or
RIGHT function with the PUT function as shown in the following example:
markercharacter = eval(left(put(amount, dollar7.2)))
Functions that accept null parameter values also might not be supported when you
specify a null parameter value.
For more information about SAS functions, see “Dictionary of SAS Functions and
CALL Routines” in SAS Functions and CALL Routines: Reference.
employee ID, total sales, and sales unit code for each member of the sales group. Here is
the data.
data sales;
input empID totalSales salesUnit $18;
format totalSales dollar9.;
datalines;
112876 129489.44 P
112421 169842.97 S
115331 108763.51 S
110765 181009.22 P
113722 147688.78 P
;
The TotalSales column contains the total sales for each employee. The SalesUnit column
contains a code that identifies the sales unit in which each employee works. The codes
are P for the Products unit and S for the Services unit.
Here is the output for this example.
The two bar charts show the total sales and earned commission for each employee. The
IFN function is used to compute commission for each employee based on his or her total
sales. Employees that achieved a sales total of $120,000 or more earn a commission of
5% of their total sales. All other employees earn a commission of 2.5% of their total
sales.
An axis table along the X axis shows the sales unit for each employee. The IFC function
is used to convert the P and S SalesUnit codes into more descriptive values in the axis
table. Because only two sales unit codes are used in this case, we can use the IFC
function for this purpose. This saves us from having to add a new column to the data in a
DATA step or having to create and apply a custom format to the SalesUnit column.
Here is the SAS code that defines the template and generates the graph.
proc template;
1324 Chapter 22 • Functions
/* Add an axis table that shows the sales unit for each
employee. */
innermargin / align=bottom;
axistable x=empID
/* Use IFC to convert the codes to meaningful
values. */
value=eval(ifc(salesUnit = 'P',"Products",
"Services")) / display=(values);
endinnermargin;
discretelegend "Sales" "Commission";
endlayout;
endgraph;
end;
run;
Examples
Here is the output for the third case, a numeric X column and a character Y column.
Note: See “Functions Defined Only in GTL” on page 1324 for information about the
COLLABEL function.
1328 Chapter 22 • Functions
number = EVAL(function-name(numeric-column))
CV Coefficient of variation
KURTOSIS Kurtosis
MEAN Mean
P1 1st percentile
P5 5th percentile
number = EVAL(function-name(numeric-column))
Q1 First quartile
Q3 Third quartile
RANGE Range
SKEWNESS Skewness
SUM Sum
T Student’s t statistic
VAR Variance
Example
The following example uses GTL summary statistic functions to dynamically construct
reference lines and a table of statistics for a numeric variable, which is supplied at run
time.
1330 Chapter 22 • Functions
/* create inset */
layout gridded / columns=2 order=rowmajor
autoalign=(topleft topright) border=true;
entry halign=left "N";
entry halign=left eval(strip(put(n(NUMVAR),12.0)));
entry halign=left "Mean";
entry halign=left eval(strip(put(mean(NUMVAR),12.2)));
entry halign=left "Std Dev";
entry halign=left eval(strip(put(stddev(NUMVAR),12.2)));
endlayout;
endlayout;
endgraph;
end;
run;
GTL Summary Statistic Functions 1331
Chapter 23
Conditional Logic
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1333
Conditional Logic Determines Statement Rendering . . . . . . . . . . . . . . . . . . . . . . 1334
GTL Does Not Provide ELSE IF Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1335
Overview
GTL supports conditional logic that enables you to include or exclude one or more GTL
statements at run time:
IF (condition)
GTL-statement(s);
ELSE
GTL-statement(s);
ENDIF;
The IF statement requires an ENDIF statement. The IF block can be placed anywhere
within the BEGINGRAPH / ENDGRAPH block.
The condition is an expression that evaluates to a numeric constant, where all numeric
constants other than 0 and MISSING are true. There is an implied EVAL(condition), so
it is not necessary to include an EVAL as part of the condition.
Examples:
/* test a computed value */
if (weekday(today()) in (1 7))
entrytitle "Run during the work week";
else
entrytitle "Run during the weekend";
endif;
if (LOGFLAG)
scatterplot x=date y=amount;
else
scatterplot x=date y=log(amount);
endif;
Also, it is seldom necessary to test for the existence of option values set by columns or
dynamics. Consider the following statement:
if (exists(GROUPVAR))
scatterplot x=date y=amount / group=GROUPVAR;
else
scatterplot x=date y=amount;
endif;
The GTL code that is conditional must be complete statements, or complete blocks of
statements, or both. The following IF block produces a compile error because there are
more LAYOUT statements than ENDLAYOUT statements:
if (exists(SQUAREPLOT))
layout overlayequated / equatetype=square;
scatterplot x=XVAR y=YVAR;
endlayout;
else
layout overlay;
scatterplot x=XVAR y=YVAR;
endlayout;
endif;
Part 13
Appendixes
Appendix 1
Syntax Conventions and Argument Value Types . . . . . . . . . . . . . . . . 1339
Appendix 2
Reserved Keywords and Unicode Values . . . . . . . . . . . . . . . . . . . . . . . 1343
Appendix 3
Display Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1347
Appendix 4
SAS Formats Not Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1353
Appendix 5
Generalized Macro for BOXPLOTPARM Data . . . . . . . . . . . . . . . . . . . 1357
Appendix 6
Memory Management for ODS Graphics . . . . . . . . . . . . . . . . . . . . . . . . 1363
1338
1339
Appendix 1
Syntax Conventions and
Argument Value Types
Syntax Conventions
< > ==> optional
a | b ==> either a or b
ON OFF
_ON_ _OFF_
TRUE FALSE
YES NO
1340 Appendix 1 • Syntax Conventions and Argument Value Types
_YES_ _NO_
1 0
color
specifies a string that identifies a color. A color can be one of the following:
• any of the color names that are supported by SAS. See “Color-Naming Schemes”
in SAS Graph Template Language: User's Guide.
• one of the colors that exists in the SAS session when the style template is used,
such as DMSBLACK or DMSCYAN. (Use these color specifications only if you
are running SAS in the windowing environment.)
• an English description of an Hue/Light/Saturation (HLS) value. Such
descriptions use a combination of words to describe the lightness, the saturation,
and the hue (in that order). You can use the Color Naming System to form a color
by doing one of the following:
• combining a chromatic hue with a lightness, a saturation, or both
• combining the achromatic hue gray with a lightness
• combining the achromatic hue black or white without qualifiers.
• combining words to form a wide variety of colors, such as light vivid green,
dark vivid orange, or light yellow.
• specify hues that are intermediate between two neighboring colors. To do so,
combine one of the following adjectives with one of its neighboring colors:
brownish, greenish, purplish, or yellowish (for example, bluish purple or reddish
orange).
column
specifies a column variable that contains either double-precision values or string
values, or a dynamic variable that refers to such a column.
See also: integer-column, numeric-column, and string-column.
dimension
specifies a nonnegative number. The number can be followed by one of the
following optional units of measure:
Unit Description
CM centimeters
IN inches
MM millimeters
PCT or % percentage
Unit Description
PX pixels
expression
specifies a selective, relational, or logical program structure that calculates values
when those values are not stored in the data. The expression must be specified as an
EVAL() argument. The following shows the structure of an EVAL() argument:
x = EVAL(expression)
The expression returns a number and can be formed with consonants, data columns,
dynamic variables, functions, or other expressions. The following example uses the
data column Time and the SGE functions MEAN and ACF:
For more information about expressions, see Chapter 21, “Expressions,” on page
1317.
format
specifies a SAS format or a user-defined format.
integer, integer-column
specifies a member of the set of positive whole numbers, negative whole numbers,
and zero.
An integer column specifies a column that contains integer values, or a dynamic
variable that refers to such a column.
line-pattern-name, line-pattern-number
specifies a string value of a line pattern, a numeric value of a line pattern, a dynamic
variable that contains such a string or number, or a style reference to a line pattern.
Line patterns are chosen for discriminability. Because of different densities, equal
weighting is impossible for lines of the same thickness. Instead, line patterns are
ordered to provide a continuum of weights, which is useful when displaying
confidence bands.
For details about line attributes, see “Line Options” on page 1349.
marker-name
specifies a string value of a maker symbol, a dynamic variable that contains a marker
symbol, or a style reference to a marker symbol.
For details about marker attributes, see “Marker Options” on page 1350.
number, numeric-column
specifies a value, a dynamic variable that contains a double-precision value, an
expression that resolves to a double-precision value, or a style reference to a double-
precision value.
A numeric-column specifies a column that contains double-precision values, or a
dynamic variable that refers to such a column.
string, string-column
specifies a quoted character string.
A string-column specifies a column that contains string values, or a dynamic variable
that refers to such a column.
1342 Appendix 1 • Syntax Conventions and Argument Value Types
Note: For quoted character string options in the GTL, a space enclosed in quotation
marks (" " or ' ') and empty quotation marks ("" or '') are not equivalent. A space
enclosed in quotation marks specifies a blank space or a missing string value.
Empty quotation marks has the same effect as not setting the option. To specify a
blank space or missing value in a quoted string option, use a space enclosed in
quotation marks (" " or ' ').
style-reference
specifies a reference to an attribute that is defined in a style element.
In the ODS Graphics templates that SAS provides, options for plot features are
specified with a style reference in the form style-element:attribute, rather than a
specific value. For example, the symbol, color, and size of markers for a basic scatter
plot is specified in a SCATTERPLOT statement as follows:
The above style references guarantee a common appearance for markers used in all
basic scatter plots. For non-grouped data, the marker appearance is controlled by the
GraphDataDefault style element in the style template that you specify.
In order to create your own style template, or to modify a style template to use with
ODS Graphics, you need to understand the relationship between style elements and
graph features. For more information, see the usage guide.
1343
Appendix 2
Reserved Keywords and Unicode
Values
Overview
The tables in this section show some of the reserved keywords and Unicode values that
can be used with the UNICODE text command. For information about rendering
Unicode characters, see “Managing the String on Text Statements” in SAS Graph
Template Language: User's Guide.
Note the following:
• Keywords and Unicode values are not case-sensitive: "03B1"x is the same code point
as "03b1"x.
• The word blank is the keyword for a blank space.
mu μ 03BC lowercase mu
nu ν 03BD lowercase nu
xi ξ 03BE lowercase xi
pi π 03C0 lowercase pi
Special Characters
Appendix 3
Display Attributes
Example
ATTRSOPTIONNAME=GRAPHVALUETEXT
style-element (options)
Name of a style element, plus individual options to be used as style overrides. Any
options not specified are derived from the specified style element.
Example
ATTRSOPTIONNAME=GRAPHVALUETEXT(SIZE=10pt)
(options)
Individual options. Any options not specified are derived from the default style
element.
1348 Appendix 3 • Display Attributes
Example
ATTRSOPTIONNAME=(FAMILY="Arial" SIZE=10pt)
ATTRSOPTIONNAME=(FAMILY=GraphValueText:FontFamily)
Depending on the attribute option used, the options might be fill options , line options ,
marker options , or text options .
In general, any relevant attribute that is not specified defaults to an internal value, which
is typically derived from the style element that you specify for the attributes. When
choosing a style element, you should use an element of the correct type. See “Graph
Style Elements Used by ODS Graphics” in SAS Graph Template Language: User's
Guide for a list of style elements and their types.
Fill Options
When specifying the attributes for an area fill, the fill options can be one or more of the
following settings. The option must be enclosed in parentheses and specified as a
name=value pair. The value can be a style reference in the form style-element:style-
attribute.
COLOR=style-reference | color
specifies the fill color . If you use a style reference, then the style attribute should be
a valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR,
NEUTRAL, ENDCOLOR. The convention is to use the COLOR attribute for fill
areas.
If you use a color, then SAS accepts color names, such as RED, or color codes, such
as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Color codes
must not exceed 8 characters and must be in a valid SAS color-naming scheme, such
as RGB, CMYK, HLS, or HSV (HSB).
TRANSPARENCY=number
specifies the degree of the transparency of the filled area. This setting enables you to
set the transparency for the filled elements of some graph types. You can set just this
fill transparency, or set the fill independently of the other transparent elements in the
graph. For example, you can use this setting to set the transparency level for the
filled bars of a bar chart, and use the bar chart’s DATATRANSPARENCY= option to
set a different transparency level for the bar outlines.
Example fillattrs=(transparency=0.5)
Attributes Available for the Attribute Options 1349
Line Options
When specifying the attributes for a line, the available line options can be any one or
more of the following settings. The options must be enclosed in parentheses, and each
option is specified as a name=value pair. In all cases, the value can be a style reference
in the form style-element:style-attribute.
COLOR=style-reference | color
specifies the line color. If you use a style reference, then the style attribute should be
a valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR,
NEUTRAL, ENDCOLOR. The convention is to use CONTRASTCOLOR for lines.
If you specify a style element that does not have a CONTRASTCOLOR attribute,
then the element’s COLOR attribute is used.
If you use a color, then SAS accepts color names, such as RED, or color codes, such
as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Color codes
must not exceed 8 characters and must be in a valid SAS color-naming scheme, such
as RGB, CMYK, HLS, or HSV (HSB).
PATTERN=style-reference | line-pattern-name | line-pattern-number
specifies the line pattern. If you use a style reference, then the style attribute should
be LINESTYLE.
Line patterns can be specified as a pattern name or pattern number.
Valid pattern numbers range from 1 to 46. Not all pattern numbers have names. See
“Available Line Patterns” on page 1352 for a list of all possible line patterns. We
recommend that you use the named patterns because they have been optimized to
provide good discriminability when used in the same plot.
Note Anti-aliasing might alter the appearance of some line patterns that have fine
detail such as line patterns 33 through 46. For example, if you specify the
color black and the pattern 33 for a line, and anti-aliasing is enabled, then the
line might appear gray. In that case, you can use the following command to
disable anti-aliasing in order to show the line detail:
ods graphics / antialias=off;
THICKNESS=style-reference | dimension
specifies the line thickness. If you use a style reference, then the style attribute
should be LINETHICKNESS.
1350 Appendix 3 • Display Attributes
Marker Options
When you specify the attributes for a data marker, the available marker options can be
any one or more of the following settings. You must enclose the options in parentheses,
and you specify each option as a name=value pair. In all cases, the value can be a style
reference in the form style-element:style-attribute.
COLOR=style-reference | color
specifies the color of the marker. If you use a style reference, then the style attribute
should be a valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR,
NEUTRAL, or ENDCOLOR. The convention is to use CONTRASTCOLOR for
markers. For grouped data, this option keeps all markers the same color and the
marker symbol alone distinguishes the group values.
If you use a color, then SAS accepts color names, such as RED, or color codes, such
as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Color codes
must not exceed 8 characters and must be in a valid SAS color-naming scheme, such
as RGB, CMYK, HLS, or HSV (HSB).
Restriction This option has no effect on marker symbols that are created with the
SYMBOLIMAGE statement.
SIZE=style-reference | dimension
specifies the marker size (both width and height). If you use a style reference, then
the style attribute should be MARKERSIZE.
SYMBOL=style-reference | marker-name
specifies the name of the marker. If you use a style reference, then the style attribute
should be MARKERSYMBOL. The following SAS symbols are supported:
You can also specify the names of symbols that are created by the SYMBOLCHAR
and SYMBOLIMAGE statements.
TRANSPARENCY=number
specifies the degree of transparency for the plot markers.
WEIGHT=NORMAL | BOLD
specifies the marker weight.
Restriction This option has no effect on marker symbols that are created with the
SYMBOLCHAR and SYMBOLIMAGE statements.
Text Options
When specifying the attributes for text, the available text options can be any one or more
of the following settings. The options must be enclosed in parentheses, and each option
is specified as a name=value pair. In all cases, the value can be a style reference in the
form style-element:style-attribute.
COLOR=style-reference | color
specifies the color of the text. If you use a style reference, then the style attribute
should be a valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR,
NEUTRAL, ENDCOLOR. The convention is to use COLOR for text.
If you use a color, then SAS accepts color names, such as RED, or color codes, such
as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Color codes
must not exceed 8 characters and must be in a valid SAS color-naming scheme, such
as RGB, CMYK, HLS, or HSV (HSB).
FAMILY=style-reference | "string"
specifies the font family of the text. If you use a style reference, then the style
attribute should be FONTFAMILY.
SIZE=style-reference | dimension
specifies the font size of the text. If you use a style reference, then the style attribute
should be FONTSIZE.
Restriction The font size cannot be less than the minimum font size in SAS, which
is determined by the SAS system. If you specify a font size that is less
than the minimum font size, the minimum size is used instead.
Appendix 4
SAS Formats Not Supported
Z ZD
ODS Graphics does not support the use of a user-defined ODS escape character to
escape Unicode values in user-defined formats.
For an example of how to use Unicode values in user-defined formats with ODS
Graphics, see “Formatting the Tick Values on a Discrete Axis” in SAS Graph Template
Language: User's Guide.
1356 Appendix 4 • SAS Formats Not Supported
1357
Appendix 5
Generalized Macro for
BOXPLOTPARM Data
The following SAS code is a generalized macro for computing input data for
BOXPLOTPARM.
%macro boxcompute(indsn=,x=,y=,outdsn=boxdata,datalabel=,
qntldef=5,table=no);
/* NOTE: INDSN, X and Y are required parameters, where
INDSN = input SAS data set
X = categorical variable (num or char)
Y = response variable (num)
OUTDSN = output dataset. It contains these variables:
STAT: Statistic names for BOXPLOTPARM
VALUE: values for STAT type
X: X variable values
DATALABEL: outlier labels from the DATALABEL= variable
N, Mean, Median, Std if TABLE=YES
DATALABEL= variable used to label outliers (num or char)
QNTLDEF = 1|2|3|4|5
(how to compute quantiles - see PROC SUMMARY)
TABLE = YES | NO
(add additional data to build table of statistics)
*/
%macro varinfo(dsid,varname,role,rc);
/* utility macro for obtaining variable info */
%local varnum;
%if %length(&varname)=0 %then %do;
%let &rc=0; %return;
%end;
%let varnum=%sysfunc(varnum(&dsid,&varname));
%if &varnum > 0 %then %do;
%let &role.label=%sysfunc(varlabel(&dsid,&varnum));
%if %length(&&&role.label)=0 %then
%let &role.label=%sysfunc(varname(&dsid,&varnum));
%let &role.fmt=%sysfunc(varfmt(&dsid,&varnum));
%let &rc=0;
%end;
%else %do;
%put ERROR: %upcase(&role) variable &varname not found.;
%let &rc=1;
%end;
%mend varinfo;
%let dsid=%sysfunc(open(&indsn));
%if &dsid %then %do;
%varinfo(&dsid,&y,Y,rc_y)
%varinfo(&dsid,&x,X,rc_x)
%if %length(&datalabel) %then
%varinfo(&dsid,&datalabel,DATALABEL,rc_d);
%else %let rc_d=0;
%let dsid=%sysfunc(close(&dsid));
%if &rc_y or &rc_x or &rc_d %then %return;
%end;
%else %do;
%put ERROR: Input dataset &indsn not found.;
%return;
%end;
Here is the macro invocation to produce the data for the graph shown in the section
“Example: BOXPLOTPARM Statement” on page 366 .
%boxcompute(indsn=sashelp.cars,x=type,y=mpg_city,
datalabel=make);
proc template;
1360 Appendix 5 • Generalized Macro for BOXPLOTPARM Data
The following figure and code show an example of a “table” of statistics with
BLOCKPLOT statements.
%boxcompute(indsn=sashelp.cars,x=type,y=mpg_highway,
outdsn=boxdata2,table=yes);
proc template;
define statgraph boxplotparm2;
begingraph;
entrytitle "Highway Mileage for Vehicle Types";
layout overlay / xaxisOpts=(offsetMin=0.08 offsetMax=0.08);
innerMargin / align=top;
blockplot x=x block=n /
display=(values label outline) valuehalign=center
labelattrs=graphdatatext valueattrs=graphdatatext;
blockplot x=x block=std /
display=(values label outline) valuehalign=center
labelattrs=graphdatatext valueattrs=graphdatatext;
blockplot x=x block=mean /
Generalized Macro for BOXPLOTPARM Data 1361
Appendix 6
Memory Management for ODS
Graphics
To determine what the current Java memory settings are, you can submit a PROC
OPTIONS statement that shows the value of the JREOPTIONS option:
After you submit this procedure code, a list of JREOPTIONS settings is written to the
SAS log. The JREOPTIONS option has many suboptions that configure the SAS Java
environment. Many of the suboptions are installation and host specific and should not be
modified, especially the ones that provide installed file locations. For managing memory,
look for the -Xmx and -Xms suboptions:
-Xms
Use this option to set the minimum Java memory (heap) size, in bytes. Set this value
to a multiple of 1024 greater than 1MB. Append the letter k or K to indicate
kilobytes, or m or M to indicate megabytes. The default is 2MB. Examples:
-Xms6291456
-Xms6144k
-Xms6m
-Xmx
Use this option to set the maximum size, in bytes, of the memory allocation pool. Set
this value to a multiple of 1024 greater than 2MB. Append the letter k or K to
indicate kilobytes, or m or M to indicate megabytes. The default is 64MB. Examples:
-Xmx83886080
-Xmx81920k
-Xmx80m
As a general rule, you should set the minimum heap size (-Xms) equal to the maximum
heap size (-Xmx) to minimize garbage collections.
Typically, SAS sets both -Xms and -Xmx to be about 1/4 of the total available memory
or a maximum of 128M. However, you can set a more aggressive maximum memory
(heap) size, but it should never be more than 1/2 of physical memory.
You should be aware of the maximum amount of physical memory your computer has
available. Let us assume that doubling the Java memory allocation is feasible. So when
you start SAS from a system prompt, you can add the following option:
The exact syntax varies for specifying Java options, depending on your operating
system, and the amount of memory that you can allocate varies from system to system.
The set of JRE options must be enclosed in parentheses. If you specify multiple
JREOPTIONS system options, then SAS appends JRE options to JRE options that are
currently defined. Incorrect JRE options are ignored.
Managing a Java Out of Memory Error 1365
If you choose to create a custom configuration file, then you would simply replace the
existing -Xms and -Xmx suboption values in the JREOPTIONS=(all Java options)
portion of the configuration file.
For more information, see the SAS Companion for your operating system.
1366 Appendix 6 • Memory Management for ODS Graphics
1367
Recommended Reading
Glossary
anti-aliasing
a rendering technique for improving the appearance of text and curved lines in a
graph by blurring the jagged edges normally present. The degree of improvement is
relative to the nature of the graphical content (for example, vertical and horizontal
lines do not benefit from anti-aliasing). Extra processing is required to perform anti-
aliasing.
attribute bundle
a common collection of visual properties associated with a graphical primitive such
as a line, marker, or text. For example, all lines have visual properties of pattern,
thickness, and color. All markers have visual properties of symbol, size, weight, and
color. Attribute bundles can be associated with style elements in order to indirectly
assign visual properties.
axis
a line that represents the midpoints (for a discrete axis) or the scale (for a continuous
or interval axis) for graphing variable or data values. An axis typically consists of an
axis line with tick marks, tick values (or midpoint values), and a label.
axis offset
the gaps that normally appear at the ends of an axis line. The gaps enable markers,
bars, and other graphic primitives that are drawn at extreme data values to be
rendered without clipping. An offset can also be used to add extra space between an
axis line and visual elements in the graph.
axis threshold
a numerical bias from 0 to 1 that determines whether an extra tick is added at either
end of a non-discrete, interval axis. If the minimum and maximum thresholds are set
to 0, then no ticks are added beyond the actual data range. If both minimum and
maximum thresholds are set to 1, then the data range is completely bounded by the
first and last ticks.
axis type
a keyword that denotes axis functionality. For example, the axis type of interval axes
can be LINEAR, TIME, or LOG. The axis type of a discrete axis is DISCRETE.
band plot
a plot that draws a horizontal band with two Y values for each X value, or that draws
a vertical band with two X values for each Y value. A band plot is typically used to
show confidence, error, prediction, or control limits. The points on the upper and
lower band boundaries can be joined to create two outlines, or the area between the
boundaries can be filled.
bin
one of multiple numeric intervals into which continuous numeric data can be
categorized.
binned data
data that has been summarized or transformed in some way to facilitate its rendering
by a parameterized plot. Continuous numeric data is typically binned by setting a bin
width (interval size) and then computing the number of bins, or by setting the
number of bins and computing the bin width.
block
See statement block.
block plot
a plot that displays one or more rectangles (blocks) along an axis, where each
rectangle identifies a block of consecutive observations having the same value for a
specified block variable.
category variable
a classification variable with a finite number of distinct (discrete) values. These
variables are typically used to split data into subsets. For example, in a bar chart,
each unique value is displayed as a bar on a DISCRETE axis. In another example,
the variable payment mode can have two values, prepaid and postpaid. Customers
can be classified based on this variable as prepaid customers and postpaid customers.
cell
See graph cell.
cell block
a block beginning with a CELL statement and ending with an ENDCELL statement
that defines the graphical content of a cell. The cell block is available only within a
LATTICE layout.
child block
a block that is contained within another block when two or more blocks are nested.
For example, a CELLHEADER block is always a child of a CELL block.
class variable
See classification variable.
classification level
for a single classification variable, each unique value is regarded as a classification
level. For two or more variables, a classification level is one of the unique
combinations (crossings) of the unique values of each variable. For example, if three
variables have four, two, and three distinct values, there are 24 classification levels.
Glossary 1371
classification panel
a multi-cell graph in which the cell data is driven by the values of one or more
classification variables. The number of the cells is determined by the unique values
of the classification variables. Each cell of the panel has the same types of plots.
clip
to truncate a plot or graphical element (such as a line, marker, or band) when it
reaches a boundary such as a plot wall.
column axis
an external axis appearing above or below a column of cells and serving as a
common reference for the column of a multi-cell layout, such as a LATTICE,
DATAPANEL, or DATALATTICE layout.
column gutter
the space between columns of cells in a multi-cell layout.
column header
text that labels the column contents in a multi-cell layout. This text can be aligned
above or below the cells in a column. In a LATTICE layout, the column header is not
restricted to text (it can contain a plot or a legend, for example).
column weight
in a LATTICE layout, the proportion of width allotted to a specific column of the
layout. The sum of all column weights is 1.
computed plot
a plot in which input data is internally summarized or otherwise transformed to
create new data that is actually rendered by the plot. Examples of computed plot
statements are BARCHART, BOXPLOT, HISTOGRAM, ELLIPSE, and
REGRESSIONPLOT.
conditional logic
syntax that enables one set of statements or an optional alternate set of statements to
execute at run time.
continuous legend
a legend that shows a mapping between a color ramp or color segments and
corresponding numeric values. Plots that support a COLORMODEL= option can use
this type of legend.
1372 Glossary
crossing
a combination of the unique values of one or more classification variables.
cube
in three-dimensional graphics, the outlines formed by the intersection of three pairs
of parallel planes; each pair is orthogonal to the primary X, Y, and Z axes. The
display of the cube is optional.
data object
a transient version of a SAS data set created by ODS. When an input SAS data set is
bound to a compiled graph template, an ODS data object is created, based on all the
columns requested in the template definition and any new columns that have been
directly or indirectly computed. A data object can persist when used with the ODS
OUTPUT statement.
data tip
data or other detailed information that is displayed when a user positions a mouse
pointer over an element in a graph. For example, a data tip typically displays the data
value that is represented by a bar, a plot point, or some other element.
define block
in the TEMPLATE procedure, a define block (beginning with a DEFINE statement
and ending with an END statement) creates various types of templates, including
STATGRAPH, STYLE, and TABLE.
dependent plot
a plot that cannot be rendered by itself. Dependent plots must be overlaid with a
stand-alone plot. Dependent plots do not provide data ranges to establish axes.
REFERENCELINE, DROPLINE, and LINEPARM statements produce dependent
plots.
design size
the intended size of a graph that is specified in the graph template definition. The
DESIGNHEIGHT and DESIGNWIDTH options of the BEGINGRAPH statement
set the intended height and width, which are used to determine the scale factors when
the graph is resized. The intended height and width are used unless overridden by the
ODS Graphics statement HEIGHT or WIDTH options when the template is
executed.
device-based graphic
a graph created with SAS/GRAPH software for which a user-specified or default
device (DEVICE= option) controls certain aspects of the graphical output.
discrete axis
an axis for categorical data values. The distance between ticks has no significance. A
bar chart always has a discrete axis.
discrete legend
a legend that provides values or descriptive information about graphical elements in
a grouped or overlaid plot.
DPI
See dots per inch.
Glossary 1373
drop line
a line drawn from a point in the plot area perpendicular to an axis.
dynamic variable
a variable defined in a template with the DYNAMIC statement that can be initialized
at template run time.
equated axes
in two-dimensional plots, axes that use the same drawing scale (ratio of display
distance to data interval) on both axes. For example, an interval of 2 on the X axis
maps to the same display distance as an interval of 2 on the Y axis. The aspect ratio
of the plot display equals the aspect ratio of the plot data. In other words, a 45-degree
slope in data will be represented by a 45-degree slope in the display. Equated axes
are always of TYPE=LINEAR. The number of intervals displayed on each axis does
not have to be the same.
external axis
an axis that is outside all cells of a layout. An external axis represents a common
scale for all plots in a row or column of a multi-cell layout.
fill
to apply a color within a bounded area. Many plots, such bar charts and band plots,
have bounded areas that can be filled or unfilled. When filled, a color is applied.
When unfilled, the areas are transparent.
fit policy
one of several algorithms for avoiding tick-value collision when space allotted to a
predefined area does not permit all the text to fit. For example, an axis might have a
THIN policy that eliminates the display of tick values for alternate ticks. A ROTATE
policy would turn the tick values at a 45-degree angle. A TRUNCATE policy would
truncate all long tick values to a fixed length and add an ellipsis (. . .) at the end to
imply truncation. A STAGGER policy would create two rows of tick values with
consecutive tick values alternating between rows. A compound policy such as
STAGGERROTATE could be used to automatically choose the best fit policy for the
situation.
footnote area
the region below the graph area where text produced by ENTRYFOOTNOTE
statements appears.
frequency variable
in an input data set, a non-negative and non-zero integer variable that represents the
frequency of occurrence of the current observation, essentially treating the data set as
if each observation appeared n times, where n is the value of the FREQ variable for
the observation.
fringe plot
a plot consisting of short, equal-length line segments drawn from and perpendicular
to an axis. Each observation of a numeric variable corresponds to the location for a
line segment.
function
See SAS function.
1374 Glossary
glyph
the most basic element (a grapheme or combination of graphemes) of a typeface or
font that carries meaning in the text of a writing system. For example, the Z character
can be represented by a number of different glyphs--boldface, italic, or in varying
font styles, all of which represent the the letter "Z."
graph panel
a graph with multiple cells.
graphics template
See ODS template.
grid
a uniform arrangement of the rows and columns of a multi-cell layout.
gridded data
input that contains at least three numeric variables. Two of the variables are treated
as X and Y variables and the third variable Z is treated as if it were a function of X
and Y. The X and Y variable values occur at uniformly spaced intervals (although the
size and number of intervals might be different for X and Y). All X,Y pairs are
unique, and Z values are interpolated so that every X,Y pair has a Z value. Raw data
that has at least three numeric variables can be converted to gridded data with the
G3GRID procedure (in SAS/GRAPH). The procedure offers both bivariate and
spline interpolation methods for computing Z values.
group index
a numeric variable with positive integer values that correspond to values of a group
variable. The index values are used to associate GraphData1 GraphDataN style
elements with group values.
group variable
a variable in the input data set that is used to categorize chart variable values into
groups. A group variable enables the data for each distinct group value to be
rendered in a visually different manner. For example, a grouped scatter plot displays
a distinct marker and color for each group value.
image format
a file format that displays a graphical representation. PNG, GIF, TIFF, and JPEG are
examples of image formats, each with different characteristics.
inset
a graphical element such as a legend, line of text, or a table of text that is embedded
inside of a graph's plot area.
interval axis
an axis where the distance between tick marks represents monotonically increasing
or decreasing numeric units of some scale (like a ruler). The standard interval axis is
called a LINEAR axis. Specialized interval axes include a TIME axis and a LOG
axis.
layout
a generic term for a rectangular container that lays out the positions and sizes of its
child components.
Glossary 1375
layout block
a block beginning with a LAYOUT statement and ending with an ENDLAYOUT
statement.
layout grid
a multi-cell layout arranged as a grid of cells in rows and columns.
layout type
a keyword indicating the functionality of the layout. For example OVERLAY,
LATTICE, and DATAPANEL are layout types.
legend entry
a combination of a graphical element such as a marker or line along with text
describing the value or use of the graphical element. A discrete legend can have
several legend entries.
legend title
text that explains how to interpret the legend.
line property
a value that defines the pattern, thickness, or color of a line. By default, the value for
a line property is derived from a style element in the current style.
linear axis
an interval axis with ticks placed on a linear scale.
loess plot
a curved line showing a loess fit for a set of points.
log axis
an axis displaying a logarithmic scale. A log axis is useful when data values span
orders of magnitude.
marker
a symbol such as a diamond, a circle, or a triangle that is used to indicate the location
of, or annotate, a data point in a plot or graph.
marker property
a value that defines the symbol used as a marker, or its size, weight, or color. By
default, the value for a marker property is derived from a style element in the current
style.
multi-cell layout
a layout that supports a rectangular grid of cells, each of which can contain a
graphical element, such as a plot, a legend, a nested layout, and so on.
nested layout
a layout block that appears within the scope of another layout block.
1376 Glossary
ODS
See Output Delivery System.
ODS Graphics
an extension to ODS that is used to create analytical graphs using the Graph
Template Language.
opaque
a property of a background. Opaque backgrounds are filled with a color. Non-opaque
backgrounds are transparent.
outlier
a data point that differs from the general trend of the data by more than is expected
by chance alone. An outlier might be an erroneous data point or one that is not from
the same sampling model as the rest of the data.
overlay
a plot that can be superimposed on another plot when specified within an overlay-
type layout. A common overlay combination is a fit line on a scatter plot.
overlay layout
a type of layout that supports the superimposition of graphical components, such as
plots, legends, and nested layouts.
parameterized plot
a non-computed plot that requires parameterized data. The Graph Template
Language offers several plots in both computed and parameterized versions, for
example, BARCHART and BARCHARTPARM. Some computed plots such as
REGRESSIONPLOT can be emulated with a SERIESPLOT if the input data
represented points on a fit line.
parent block
when two or more blocks are nested, any layout block that contains one or more
layout blocks is a parent of the contained blocks.
plot
a visual representation of data such as a scatter plot, needle plot, or contour plot.
Glossary 1377
plot area
the space, bounded by the axes, where a visual representation of data, such as a
scatter plot, a series line, or a histogram, is drawn.
plot type
a plot family such as bar chart (which would include horizontal, vertical, and
grouped bar charts), or a classification scheme for plots based on some useful
criteria, such as whether the plots are computed or parameterized.
primary axis
the X or Y axis contrasted to the X2 or Y2 secondary axis.
primary plot
the plot in an overlay that determines axis features, such as axis type and axis label.
prototype layout
an overlay plot composite that appears in each cell of a classification panel. Each
instance of the prototype represents a different subset (classification level) of the
data.
regression plot
a straight or curved line showing a linear or higher order regression fit for a set of
points.
required argument
a variable or constant that must be specified in order to evaluate an expression or
render a plot, legend, text, or a layout. For example, a scatter plot has two required
arguments: X=column and Y=column.
role
a description of the purpose that a variable serves in a plot. For example, a series plot
has predefined roles named for X , Y, GROUP, and CURVELABEL.
row
See layout row.
row axis
an external axis appearing on the left or right of a row of cells in a multi-cell layout.
row gutter
space between rows of cells of a multi-cell layout.
row header
typically, the text that identifies the row contents in a multi-cell layout. This text can
be aligned to the right or left of the cells in a row. The row header is not restricted to
text (it can contain a plot or a legend, for example).
row weight
in a LATTICE layout, the proportion of height allotted to a specific row of the
layout. The sum of all row weights is 1.
secondary axis
an X2 or Y2 axis, as contrasted with the primary axes X or Y.
SGE file
a file created in the ODS Graphics environment that contains an editable graph. Such
files have a .sge file extension and can be edited only with the ODS Graphics Editor.
You can edit SGE files from the SAS Results window or by opening the SGE file
from within the ODS Graphics Editor.
sidebar
an area of certain multi-cell layouts external to the grid of cells where text or other
graphical elements can appear. The LATTICE, DATAPANEL, and DATALATTICE
layout support four sidebar areas (TOP, BOTTOM, LEFT, and RIGHT).
single-cell layout
a layout type that supports only one cell. The OVERLAY, OVERLAY3D, and
OVERLAYEQUATED layouts are examples of single-cell layouts.
sparse data
in classification panels with two or more classifiers, some crossings of the
classification values might not be present in the input data. Such input data is called
sparse data. By default, a DATAPANEL layout does not generate cells for sparse
data, but if requested, it can produce empty cells as place holders for the non-existent
crossings.
stand-alone plot
a plot that has its own data range and can therefore appear by itself in a layout.
style
See ODS style.
style attribute
a visual property, such as color, font properties, and line characteristics, that is
defined in ODS with a reserved name and value. Style attributes are collectively
referenced by a style element within a style template.
style element
a named collection of style attributes that affects specific parts of ODS output. For
example, a style element might specify the color and font properties of title text or
other text in in a table or graph.
Glossary 1379
style reference
a part of the Graph Template Language syntax that indicates the current value of a
specific attribute of a specific style element. For example,
SIZE=GraphTitleText:FontSize means to assign to SIZE the value of the FontSize
attribute of the GraphTitleText style element from the current style.
surface plot
a three-dimensional graph that displays values of a vertical Z variable based on
gridded X and Y variables.
template source
See template definition.
template store
an item store that contains definitions that were created by the TEMPLATE
procedure. Definitions that SAS provides are in the item store Sashelp.Tmplmst. You
can store definitions that you create in any template store to which you have Write
access.
template-based graphic
graphical output produced by a compiled ODS template of the type STATGRAPH.
That is, a graph that is produced within the ODS graphics environment rather than in
the traditional device-based environment.
text property
any of a common set of characteristics that can be specified for any text string: color,
family, size, weight, and style. By default, values for these properties are derived
from a style element in the current style.
threshold range
a lower and upper value that specifies the first and last tick mark values for a
continuous, linear axis.
time axis
an axis type that displays only SAS date, time, or datetime values. Axis tick value
increments can be specified as time or date intervals, such as MINUTE, HOUR,
DAY, WEEK, MONTH, QUARTER, or YEAR.
title area
the region above the graph area where text produced by ENTRYTITLE statements
appears.
1380 Glossary
transparency
the degree to which a graphic element (such as a marker or filled area) is opaque or
transparent. Transparency is indicated with a number from 0 (completely opaque) to
1 (completely transparent).
Unicode
a 16-bit encoding that is the industry standard for supporting the interchange,
processing, and display of characters and symbols from most of the world's writing
systems.
wall
the area bounded by orthogonal axis pairs. In two-dimensional graphs, there is one
wall bounded by the XY axes. In three-dimensional graphs, there are three walls,
bounded by the XY, YZ, and XZ axes. A wall has an optional outline and can be
opaque or transparent.
weight variable
a numeric variable that represents a weight (for example, costs) to be applied to
observations.
1381
Index
N NEEDLEPLOT statement
N function 1328 TEMPLATE procedure 584
NAME= argument NHINT= option
DISCRETEATTRMAP statement 1288 CONTOURPLOTPARM statement 392
LEGENDITEM statement 1127 NKNOTS= regression option
LEGENDTEXTITEMS statement 1131 PBSPLINEPLOT statement 611
RANGEATTRMAP statement 1301 NLEVELS= option
SYMBOLCHAR statement 1173 CONTOURPLOTPARM statement 392
SYMBOLIMAGE statement 1180 NMISS function 1328
NAME= option NMVAR statement
AXISTABLE statement 198 TEMPLATE procedure 13, 1313
BANDPLOT statement 213 NODEID= argument
BARCHART statement 237 DENDROGRAM statement 396
BARCHARTPARM statement 273 non-grouped data
BIHISTOGRAM3DPARM statement lines, colors, and marker symbols 177
287 NORMAL distribution option
BLOCKPLOT statement 296 DENSITYPLOT statement 413
BOXPLOT statement 322 NOTES statement
BOXPLOTPARM statement 355 TEMPLATE procedure 13, 1313
BUBBLEPLOT statement 379 number value type 1341
CONTOURPLOTPARM statement 392 NUMERATE function 1325
datalattice, datapanel axis options 1043 numeric-column value type 1341
DENDROGRAM statement 398 NXBINS= option
DENSITYPLOT statement 410 HEATMAP statement 451
DROPLINE statement 420 NYBINS= option
ELLIPSE statement 427 HEATMAP statement 451
ELLIPSEPARM statement 436
FRINGEPLOT statement 443
HEATMAP statement 451 O
HEATMAPPARM statement 464 ODS Graphics
HIGHLOWPLOT statement 486 managing java memory 1363
HISTOGRAM statement 502 ODS GRAPHICS statement
HISTOGRAMPARM statement 516 BORDER= option 16
lattice axis options 899, 972 DISCRETEMAX= option 396
LINECHART statement 533 HEIGHT= option 16, 176, 706
LINEPARM statement 551 IMAGENAME= option 176
LOESSPLOT statement 561 overview 15, 176
MODELBAND statement 570 sizing a graph 16, 176
MOSAICPLOTPARM statement 579 specifying a graph border 16
NEEDLEPLOT statement 596 WIDTH= option 16, 176
PBSPLINEPLOT statement 608 ODS styles
PIECHART statement 622 customizing a style 180
POLYGONPLOT statement 642 defining a style for box plots 330
REFERENCELINE statement 662 GraphBox style element 330
REGRESSIONPLOT statement 675 GraphBoxMean style element 330
SCATTERPLOT statement 704 GraphBoxMedian style element 330
SCATTERPLOTMATRIX statement GraphBoxOutlier style element 330
735 GraphBoxWhisker style element 331
SERIESPLOT statement 768 overriding style element defaults 1139
STEPPLOT statement 798 use in templates 16
SURFACEPLOTPARM statement 806 OFFSETMAX= option
TEXTPLOT statement 821 datalattice, datapanel axis options 1043
VECTORPLOT statement 850 lattice axis options 972
WATERFALLCHART statement 867 overlay axis options 899
NBINS= option overlay3d axis options 948
HISTOGRAM statement 503
1400 Index
X
W X= argument
WALLCOLOR= option AXISTABLE statement 192
LAYOUT OVERLAY statement 140 BANDPLOT statement 206
LAYOUT OVERLAY3D statement 156 BARCHART statement 221
LAYOUT OVERLAYEQUATED BARCHARTPARM statement 253
statement 149 BEGINPOLYGON statement 1200
LAYOUT PROTOTYPE statement 161 BEGINPOLYLINE statement 1207
SCATTERPLOTMATRIX statement BIHISTOGRAM3DPARM statement
738 285
WALLDISPLAY= option BLOCKPLOT statement 290
and draw statements 1196 BOXPLOT statement 308
LAYOUT OVERLAY statement 140 BOXPLOTPARM statement 339
LAYOUT OVERLAY3D statement 157 BUBBLEPLOT statement 370
LAYOUT OVERLAYEQUATED CONTOURPLOTPARM statement 388
statement 149 DRAW statement 1200, 1207
LAYOUT PROTOTYPE statement 161 DRAWOVAL statement 1234
SCATTERPLOTMATRIX statement DRAWRECTANGLE statement 1242
738 DROPLINE statement 417
WATERFALLCHART statement ELLIPSE statement 424
TEMPLATE procedure 854 HEATMAP statement 448
WEIGHT= attribute HEATMAPPARM statement 461
for markers 1351 HIGHLOWPLOT statement 474
for text 1352 LINEPARM statement 543
WEIGHT= option LOESSPLOT statement 555
HEATMAP statement 454 NEEDLEPLOT statement 586
HISTOGRAM statement 325, 411, 505 PBSPLINEPLOT statement 602
WEIGHT= regression option POLYGONPLOT statement 631
LOESSPLOT statement 564 REFERENCELINE statement 655
PBSPLINEPLOT statement 611 REGRESSIONPLOT statement 668
REGRESSIONPLOT statement 677 SCATTERPLOT statement 682
WEIGHTS= option SERIESPLOT statement 744
LAYOUT GLOBALLEGEND STEPPLOT statement 778
statement 100 SURFACEPLOTPARM statement 804
WHISKERATTRS= option TEXTPLOT statement 814
BOXPLOT statement 325 VECTORPLOT statement 840
BOXPLOTPARM statement 360 X= option
WHISKERPERCENTILE= option DRAWIMAGE statement 1225
BOXPLOT statement 326 DRAWTEXT statement 1255
width, specifying on a graph 16, 176 X1= argument
WIDTH= argument DRAWARROW statement 1213
DRAWOVAL statement 1235 DRAWLINE statement 1228
DRAWRECTANGLE statement 1243 X1SPACE= option
WIDTH= option DRAWARROW statement 1217
DRAWIMAGE statement 1224 DRAWLINE statement 1231
DRAWTEXT statement 1254 X2= argument
1412 Index