For situations that
require highly customized displays that are not available with the
ODS Graphics procedures, you can write your own graph templates. You
write templates using the Graph Template Language (GTL). A graph template
is a program that specifies the layout and details of a graph. You
can then apply the template to your data and render graphs using either
the SGRENDER procedure or a DATA step.
The GTL is a powerful
language that includes statements for specifying the following graphics
items:
-
plot layouts, such as lattices
and overlays
-
plot types, such as scatter plots
and histograms
-
text elements, such as titles,
footnotes, and insets
The GTL also provides support for built-in computations
(such as histogram binning and loess smoothing) and the evaluation
of expressions. The GTL supports dynamic variable assignment and conditional
logic. Options are available for specifying colors, marker symbols,
and other attributes of plot features.
In addition, the GTL
has two features that enable you to customize a graph:
-
Draw statements enable you to draw
visual elements anywhere within the graph. For example, you can add
text, lines, shapes, and images to a graph.
-
Discrete and range attribute maps
enable you to map visual attributes to input data values.
Procedure writers use
the GTL to define graphs that procedures generate automatically in
the process of an analysis. SAS analytical users can create very sophisticated
graphs using terminology familiar to statisticians and analysts. However,
with its robust capabilities and flexibility, the GTL requires an
investment of time in order to learn how to best use it.
Here are two common
uses for the GTL:
-
create highly customized displays
by writing your own graph templates and applying them directly to
data with the SGRENDER procedure.
-
modify the default SAS templates
to make changes that are permanently in effect each time a particular
procedure is executed. SAS provides a default template for every graph
produced by statistical procedures.
The default graph templates
provided by SAS are usually long and complex because they specify
a complete description of how the graph is to be produced. You can
edit graph templates to make simple modifications such as changing
titles and axis labels or adding footnotes. Advanced users can make
more substantive changes. This getting-started guide does not cover
changes to the default graph templates.