SAS Graph
SAS Graph
1 Reference
®
Volume 1
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS/GRAPH® 9.1 Reference,
Volumes 1 and 2. Cary, NC: SAS Institute Inc.
SAS/Graph® 9.1 Reference, Volumes 1 and 2
SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.
SAS Publishing provides a complete selection of books and electronic products to help customers use SAS software
to its fullest potential. For more information about our e-books, e-learning products, CDs, and hard-copy books, visit
the SAS Publishing Web site at support.sas.com/pubs or call 1-800-727-3228.
®
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS
Institute Inc. in the USA and other countries. ® indicates USA registration.
Other brand and product names are trademarks of their respective companies.
Contents
Chapter 21 Macro Arguments for the DS2CONST, DS2TREE, DS2CSF, and META2HTM
Macros 535
Macro Arguments 535
Examples 768
Examples 1228
Overview 1401
GASK Routines 1404
GDRAW Functions 1446
GRAPH Functions 1457
GSET Functions 1462
Return Codes for DSGI Routines and Functions 1501
See Also 1502
References 1503
Glossary 1549
Index 1561
xii
xiii
What’s New
Overview
It’s easier than ever to produce enhanced and detailed, informative graphics for your
Web presentations. New features in SAS/GRAPH include:
3 three new procedures: GAREABAR, GBARLINE, and MAPIMPORT
3 new options in the GCHART procedure for producing standard pie or donut charts
with a detailed, inner pie overlay
3 new options in the GRADAR procedure for adjusting how a chart looks and for
specifying annotation
3 support for the new DOCUMENT procedure for the Output Delivery System (ODS)
3 the new SAS Maps Online application
3 server-side rendering using the ACTXIMG and JAVAIMG devices
3 client support for annotation
3 client support for ODS styles
3 ActiveX support for creating graphs interactively
3 ActiveX support for radar charts produced with the GRADAR procedure
3 the new Java Constellation Applet
3 user interface enhancements for the client graphs, such as redesigned dialogs.
Note:
3 This section describes the features of SAS/GRAPH that are new or enhanced since
SAS 8.2.
3 z/OS is the successor to the OS/390 operating system. SAS/GRAPH 9.1 is
supported on both OS/390 and z/OS operating systems and, throughout this
document, any reference to z/OS also applies to OS/390, unless otherwise stated.
4
xiv What’s New
Details
Procedures
The following procedures are new or enhanced:
3 The GAREABAR procedure generates bar graphs in which the width of the bars
are proportional to a characteristic of the data element that is represented by the
bars. Area bar charts are supported only when you specify device=activex or
device=actximg. For more information, see Chapter 27, “The GAREABAR
Procedure,” on page 725.
3 The new GBARLINE procedure enables you to create vertical bar charts that have
line plot overlays.
Note: The GBARLINE procedure is not supported for Java. 4
For more information, see Chapter 28, “The GBARLINE Procedure,” on page 739.
3 The new MAPIMPORT procedure enables you to import ESRI Shapefiles into SAS/
GRAPH map data sets. For more information, see Chapter 48, “The MAPIMPORT
Procedure,” on page 1347.
3 The new DOCUMENT procedure for ODS enables you to re-arrange or to
duplicate reports—including graphs—without having to rerun your analysis. You
can display output to any ODS output format without executing your SAS
programs again. For more information, see the DOCUMENT procedure in SAS
Output Delivery System: User’s Guide.
3 New options in the PIE statement in the GCHART procedure enable you to create
detail pie charts that have an inner pie overlay. The slices in the overlay align
with the slices in the outer pie and show detailed information about the major
components that comprise the outer slice. The new options are DETAIL=,
DETAIL_PERCENT=, DETAIL_RADIUS=, DETAIL_SLICE=,
DETAIL_THRESHOLD=, and DETAIL_VALUE=. For more information, see
Chapter 29, “The GCHART Procedure,” on page 773.
3 The GRADAR procedure has the following new options:
3 ANNOTATE= specifies an annotate data set.
3 INBORDER requests a border around plots.
3 INHEIGHT= specifies the height in percent screen units of text used inside
the frame of the chart.
3 LAST= specifies that the spoke that corresponds to the category is displayed
to the left of the start angle.
3 MAXNVERT= specifies the maximum number of vertices.
3 MISSING accepts a missing value as a valid midpoint for the chart variable.
3 NOFRAME suppresses the frame that is drawn around the chart by default.
3 NOZEROREF turns off the zero reference line when negative values are
plotted.
3 OTHER= specifies a new category that merges all categories that are not
selected because of the MAXNVERT= option.
3 ORDERACROSS= specifies the display order for the values of the ACROSS=
variable.
3 SPIDER draws lines on a radar chart that connect the spokes instead of the
default tick marks. The resulting lines look similar to a “spider web.”
What’s New xv
SYMBOL Statement
The SINGULAR= option tunes the algorithm that is used to check for singularities.
Graphics Options
The following graphics options are new:
USERINPUT
determines whether user input is enabled for the device. For more information,
see “USERINPUT” on page 359.
SWFONTRENDER
specifies the method used to render software fonts. For more information, see
“SWFONTRENDER ”on page 353.
Server-Side Rendering
The ACTXIMG and JAVAIMG devices generate images on the server that match the
look of the client graphs. These devices are especially useful when you do not need the
xvi What’s New
interactivity that is provided by the client graphs. ACTXIMG is only available for
Windows. For more information, see “ACTXIMG and JAVAIMG Device Drivers
Compared to GIF, JPEG, and PNG Device Drivers” on page 440.
ActiveX Control
The following are enhancements for the ActiveX Control:
3 The ActiveX control now supports creating graphs interactively. You can import
data from SAS data sets, Microsoft Excel files, or Microsoft Access files.
Note: To create graphs interactively, you must have Enterprise Guide 2.0 HotFix
11 or higher installed.
3 The ActiveX control now supports radar charts that are produced by using the
GRADAR procedure.
3 The ActiveX control menus now enable the following additional languages:
Chinese, Japanese, Korean, and Russian. (The following languages were also
available in SAS 8.2: French, German, Hebrew, Hungarian, Italian, Polish, and
Spanish.
User-Defined Formats
The Java and ActiveX devices now support user-defined formats, except for nested
user-defined formats. For information about defining formats, see the documentation
for the FORMAT procedure in the Base SAS Procedures Guide.
Colors
Color names can now be a maximum of 64 characters in length.
Fonts
The following fonts have been added:
3 Davidb (Hebraic)
3 Fsong (Chinese)
3 Hebrewb
xviii What’s New
3 Hei (Chinese)
3 Mincho (Japanese)
1
P A R T
SAS/GRAPH Concepts
CHAPTER
1
Introduction to SAS/GRAPH
Software
Overview 4
Generating Graphs 4
Charts 4
Block charts 4
Horizontal bar charts 5
Vertical bar charts 5
Pie charts, 3-D Pie charts, and Donut charts 6
Star charts 6
Two-Dimensional Plots 6
Two-dimensional scatter plots 7
Simple line plots 7
Regression plots 7
High-low plots 8
Bubble plots 8
Three-Dimensional Plots 9
Surface plots 9
Scatter plots 9
Contour plots 10
Maps 11
Block maps 11
Choropleth maps 11
Prism maps 11
Surface maps 12
Creating Text Slide and Presentation Graphics 12
Text Slides 13
Combining Output into One Slide 13
Enhancing Graphics Output (graphs and text slides) 14
SAS/GRAPH Statements 14
The Annotate Facility 14
Creating Custom Graphics 15
The DATA Step Graphics Interface 15
Graph-N-Go 15
About this Book 16
Audience 16
Prerequisites 16
Conventions Used in This Book 16
Syntax Conventions 17
Conventions for Examples and Output 19
Information You Should Know 20
Support Personnel 20
Sample Programs 21
4 Overview Chapter 1
Overview
SAS/GRAPH software is the data visualization and presentation (graphics)
component of the SAS System. As such, SAS/GRAPH software:
3 organizes the presentation of your data and visually represents the relationship
between data values as two- and three-dimensional graphs, including charts, plots,
and maps.
3 enhances the appearance of your output by allowing you to select text fonts, colors,
patterns, and line styles, and control the size and position of many graphics
elements.
3 creates presentation graphics. SAS/GRAPH software can create text slides, display
several graphs at one time, combine graphs and text in one display, and create
automated presentations.
3 generates a variety of graphics output that you can display on your screen or in a
Web browser, store in catalogs, review, or send to a hardcopy graphics output
device such as a laser printer, plotter, or slide camera.
3 provides utility procedures and statements to manage the output.
This chapter describes the graphs that are produced by SAS/GRAPH software and
explains some of the parts and features of SAS/GRAPH programs.
Generating Graphs
SAS/GRAPH software produces many kinds of charts, plots, and maps in both two-
and three-dimensional versions. In addition to helping you understand the variety of
graphs that are available to you, these descriptions will also help you choose the correct
type of graph for your data and point you to the appropriate chapter.
Charts
SAS/GRAPH software uses the GCHART procedure to produce charts that
graphically represent the value of a statistic for one or more variables in a SAS data
set. See Chapter 29, “The GCHART Procedure,” on page 773 for a complete description.
Block charts
Block charts use three-dimensional blocks to graphically represent values of
statistics. Block charts are useful for emphasizing relative magnitudes and differences
among data values.
Introduction to SAS/GRAPH Software Charts 5
Star charts
Star charts use the length of spines to graphically represent the value of a statistic
for a data range. Star charts are useful for analyzing where data are out of balance.
Two-Dimensional Plots
SAS/GRAPH software uses the GPLOT procedure to produce two-dimensional
graphs that plot one or more dependent variables against an independent variable
within a set of coordinate axes. GPLOT can display the data points as individual
symbols (as in a scatter plot), or use interpolation methods specified by the SYMBOL
statement to join the points, request spline interpolation or regression analysis, produce
various high-low plots, or generate several other types of plots.
GPLOT can also display data as bubble plots in which circles of different sizes
represent the values of a third variable.
Plots are useful for demonstrating the relationship between two or more variables and
frequently compare trends or data values or depict movements of data values over time.
See Chapter 37, “The GPLOT Procedure,” on page 1081 for a complete description.
Introduction to SAS/GRAPH Software Two-Dimensional Plots 7
Regression plots
Regression plots specify that the plot is a regression analysis. You can specify one of
three types of regression equation – linear, quadratic, or cubic – and optionally display
confidence limits for mean predicted values or individual predicted values.
8 Two-Dimensional Plots Chapter 1
High-low plots
High-low plots show how several values of one variable relate to one value of another
variable. Typically, each variable value on the horizontal axis has several corresponding
values on the vertical axis. High-low plots include box, needle, and stock market plots.
Bubble plots
Bubble plots show the relative magnitude of one variable in relation to two other
variables. The values of two variables determine the position of the bubble on the plot,
and the value of a third variable determines the size of the bubble.
Introduction to SAS/GRAPH Software Three-Dimensional Plots 9
Three-Dimensional Plots
SAS/GRAPH software uses the G3D procedure to produce three-dimensional surface
and scatter plots that examine the relationship among three variables. Variable values
are plotted on a set of three coordinate axes.
See Chapter 46, “The G3D Procedure,” on page 1295 for a complete description.
Surface plots
Surface plots are three-dimensional plots that display the relationship of three
variables as a continuous surface. Surface plots examine the three-dimensional shape
of data.
Scatter plots
Scatter plots enable you to examine three-dimensional data points instead of surfaces
and to classify your data using size, color, shape, or a combination of these features.
10 Three-Dimensional Plots Chapter 1
Contour plots
SAS/GRAPH software uses the GCONTOUR procedure to examine
three-dimensional data in two dimensions. Lines or areas in a contour plot represent
levels of magnitude (z) corresponding to a position on a plane (x,y).
See Chapter 30, “The GCONTOUR Procedure,” on page 885 for a complete
description.
Contour plots are two-dimensional plots that show three-dimensional relationships.
These plots use contour lines or patterns to represent levels of magnitude of a contour
variable plotted on the horizontal and vertical axes.
When you need to interpolate or smooth data values that are used by the G3D and
GCONTOUR procedures, use the G3GRID procedure. The G3GRID procedure does not
produce graphics output but processes existing data sets to create data sets that the
G3D or GCONTOUR procedure can use to produce three-dimensional surface or contour
plots. See Chapter 47, “The G3GRID Procedure,” on page 1327 for a complete
description.
Introduction to SAS/GRAPH Software Maps 11
Maps
SAS/GRAPH software uses the GMAP procedure to produce two- and
three-dimensional maps that can show an area or represent values of response
variables for subareas.
SAS/GRAPH software includes data sets to produce geographic maps. In addition,
you can create your own map data sets.
See Chapter 35, “The GMAP Procedure,” on page 995 for a complete description.
Block maps
Block maps are three-dimensional maps that represent data values as blocks of
varying height rising from the middle of the map areas.
Choropleth maps
Choropleth maps are two-dimensional maps that display data values by filling map
areas with combinations of patterns and color that represent the data values.
Prism maps
Prism maps are three-dimensional maps that display data by raising the map areas
and filling them with combinations of patterns and colors.
12 Creating Text Slide and Presentation Graphics Chapter 1
Surface maps
Surface maps are three-dimensional maps that represent data values as spikes of
varying heights.
SAS/GRAPH software also provides several utility procedures for handling map data.
The GPROJECT procedure lets you choose how geographic maps are projected. This
is particularly important for large areas because producing a map of any large area on
the Earth involves distorting some areas in the process of projecting the spherical
surface of the Earth onto a flat plane. You can use the procedure to select the projection
method that least distorts your map.
Map areas are constructed of joined data points. Each data point represents an
observation in a SAS data set. For large maps, the amount of data can be prohibitively
expensive (in terms of computing resources or time to process); the GREDUCE
procedure enables you to reduce the number of points in the data set. The GREMOVE
procedure enables you to remove boundary lines within a map.
3 automatically or manually replay your graphs and text slides with the GREPLAY
procedure.
Text Slides
Use the GSLIDE procedure to create text slides in which you can specify a variety of
colors, fonts, sizes, angles, overlays, and other modifications as well as drawing lines
and boxes on the output.
See Chapter 44, “The GSLIDE Procedure,” on page 1277 for a complete description.
Text slides display text as graphics output. Text slides can be used as title slides for
presentations, or to produce certificates, signs, or other display text.
Use the GPRINT procedure to display as a graphic SAS procedure output that has
been saved in a text file. With GPRINT, you bring the text file into SAS/GRAPH and
then add titles, notes, and footnotes, and select colors for the output.
See Chapter 38, “The GPRINT Procedure,” on page 1147 for a complete description.
SAS/GRAPH Statements
You also can use global statements and graphics options in SAS/GRAPH programs.
With global statements, you can add titles and footnotes and control the appearance of
axes, symbols, patterns, and legends. With graphics options, you can control the
appearance of graphics elements by specifying default colors, fill patterns, fonts, text
height, and so on.
Graph-N-Go
To generate presentation graphs without writing any SAS/GRAPH code, you can use
Graph-N-Go (not available on mainframes). You can start Graph-N-Go in several ways:
3 from the menus in any SAS window, select
Solutions Reporting Graph-N-Go
graphngo
Audience
This book is written for users who are experienced in using SAS System software.
You should understand the concepts of programming in the SAS language, and you
should have an idea of the tasks you want to perform with SAS/GRAPH software.
Prerequisites
The following table summarizes the SAS System concepts that you need to
understand in order to use SAS/GRAPH software:
Syntax Conventions
Type styles have special meanings when used in the presentation of SAS/GRAPH
software syntax in this book. The following list explains the style conventions for the
syntax sections:
UPPERCASE identifies SAS keywords such as the names of statements and
procedures (for example, PROC GCHART). Also identifies
arguments and values that are literals, (for example, NOLEGEND
and LABEL=NONE).
italic identifies arguments or values that you supply. Items in italic can
represent user-supplied values that are either
3 nonliteral values assigned to an argument (for example,
axis-color in COLOR=axis-color)
3 nonliteral arguments (for example, VBAR chart-variable. . . ; ).
In addition, an item in italics can be the generic name for a list of
arguments or parameters from which the user can choose (for
example, appearance-options).
The following symbols are used to indicate other syntax conventions:
< > (angle identify optional arguments. Any argument not enclosed in angle
brackets) brackets is required.
| (vertical bar) indicates that you can choose one value from a group. Values
separated by bars are mutually exclusive.
. . . (ellipsis) indicates that the argument following the ellipsis can be repeated
any number of times (plot-request <. . . plot-request-n>, for
example). If the ellipsis and the following argument are enclosed in
angle brackets, they are optional. In SAS/GRAPH software, an
ellipsis also indicates a range from which a value is selected
(LINE=1 . . . 46, for example).
The following examples illustrate the syntax conventions described in this section.
These examples contain selected syntax elements, not complete syntax.
PROC GANNO ANNOTATE=Annotate-data-set
<DATASYS>;
18 Syntax Conventions Chapter 1
font names, color names, and variable names. Consider the following four syntax
samples:
FONT=font
COLOR=color
COLOR=text-color
3 Font must be a valid SAS font name. (See Chapter 5, “SAS/GRAPH Fonts,” on
page 75 for details.)
3 Color and text-color must be valid SAS/GRAPH colors. (See Chapter 6, “SAS/
GRAPH Colors and Images,” on page 91 for details.)
3 Chart-variable must be a valid SAS variable name. (See SAS Language Reference:
Dictionary for details.)
These HSIZE= and VSIZE= settings are not shown in the example code and are not
necessary for generating the output, but you may want to use similar settings if your
output looks different from the output that is shown in the book.
The examples use explicit color specifications, and the example code contains the
names of colors that approximate the colors you see in this book. The colors displayed
on your device may differ from those shown in the examples because of differences in
device capabilities.
20 Information You Should Know Chapter 1
The examples in this book do not specify actual names for the file structures used for
SAS data libraries or for external files. This is because different operating environments
and different computing installations use different conventions for naming files and
directories. Instead, the examples refer to storage locations generically. For example, a
LIBNAME statement to assign the libref STORE is shown as
libname store ’SAS-data-library’;
For SAS-data-library, you should supply the complete specification for the storage
location (for example, directory or z/OS data set) of the data library, using the form
required by your operating environment.
Similarly, a FILENAME statement to assign the fileref MYFILE is shown as
filename myfile ’external-file’;
For external-file, you should supply a fully qualified filename, using the form required
for your operating environment.
If you are unsure of the requirements at your site, see your SAS Software Consultant
for more information.
Some examples explicitly specify the font and height for text, the units, and border in
procedure statements. For those examples that do not include explicit specifications,
the following graphics options were used to produce uniform output:
RESET=GLOBAL cancels all currently defined AXIS, LEGEND, FOOTNOTE, TITLE,
PATTERN, and SYMBOL definitions.
GUNIT=PCT specifies the unit specification for options is in percent, unless
explicitly specified in another SAS statement.
FTEXT=SWISSB specifies that all text uses the SWISSB font, unless explicitly
specified in another SAS statement.
HTITLE=6 specifies that the first title line is 6 percent of the height of the
graphics output area, unless explicitly specified in another SAS
statement.
HTEXT=3 specifies that text is 3 percent of the height of the graphics output
area, unless explicitly specified.
BORDER causes a border to be drawn around the graphics output area. The
border, which appears in most output, represents the boundaries of
the graphics output area, whether or not a border is drawn by the
program.
Note: The way that output is presented on your device depends on the environment
in which you are running SAS/GRAPH software. 4
Support Personnel
Most sites have personnel available to help users learn to run SAS System software.
Record the name of the SAS Software Consultant, SAS Software Representative, and
Introduction to SAS/GRAPH Software Sample Programs 21
system administrator at your site. Also record the names of anyone else you regularly
turn to for help with running SAS/GRAPH software.
Sample Programs
Most of the chapters in this book provide examples that demonstrate some of the
major features of SAS/GRAPH software. To minimize the typing you must do to run the
sample code yourself, the code is delivered to you through the SAS Sample Library.
Depending on your operating environment, there are up to three ways that you can
access the code that is in the sample library:
3 if you are viewing the sample code in SAS OnlineDoc, you can copy the code out of
the OnlineDoc and paste it into the Program Editor in your SAS session. This
alternative is not available if you do not have access to a Web browser in the
operating environment where you are running your SAS session.
3 in most operating environments (excluding mainframe environments), you can
access the sample code through the SAS Help facility. For example, from a SAS
window’s Help menu, you can choose SAS System Help to enter the help system.
You can then choose the link for Sample SAS Programs and Applications, which
takes you to the help page for the SAS Sample Library.
3 in most operating environments (excluding Windows), the SAS Sample Library
may have been installed in your file system. If the SAS Sample Library has been
installed at your site, ask your SAS Software Consultant where it is located.
To access the sample programs through SAS System Help or through your file
system, you must understand the naming convention used for the samples. The naming
convention for SAS/GRAPH samples is Gpcxxxxx, where pc is the product code and
xxxxx is an abbreviation of the example title. For example, the code for the first
example in the GMAP Procedure chapter, Example 1 on page 1045, is stored in sample
member GMPSIMPL. The sample-library member name is sometimes displayed as a
footnote in the output’s lower-right corner.
3 In SAS System Help, the sample programs are organized by product. Within each
product category, the samples are sorted alphabetically by title. Thus, to access
the code for the first example in the GMAP Procedure chapter, navigate in the
help system to the SAS Sample Library page, choose SAS/GRAPH from the list of
products, and then scroll to the listing "GMPSIMPL-Producing a Simple Block
Map."
3 In your file system, the files that contain the sample code have file names that
match the sample member names. For example, in a directory-based system, the
code for sample member GMPSIMPL is located in a file named GMPSIMPL.SAS.
Note: For WebGraph samples the naming convention is GWBxxxxx. 4
Note: Some of the examples include LIBNAME and FILENAME statements. You
must provide the name of the SAS data library or external file before running the
example. 4
22 Sample Programs Chapter 1
Procedure Code
dsgi DS
ganno AN
gchart CH
gradar GD
gcontour CT
gfont FO
gimport IP
gkeymap KY
gmap MP
goptions OP
gplot PL
gprint PR
gproject PJ
greduce RD
gremove RM
greplay RE
gslide SL
gtestit IT
g3d TD
g3grid TG
Statement Code
axis AX
by BY
footnote FO
goptions ON
legend LG
note NO
pattern PN
Introduction to SAS/GRAPH Software Annotate Macros Data Set 23
Statement Code
symbol SY
title TI
Statement Code
WebGraph WB
CHAPTER
2
SAS/GRAPH Programs
Overview 25
Language Elements 26
SAS/GRAPH Procedures 26
SAS/GRAPH Global Statements 27
Annotate DATA Step 27
Other SAS Language Statements 27
FILENAME Statement 28
LIBNAME Statement 29
SAS Data Sets 29
Temporary and Permanent SAS Data Sets 29
Using a Library Reference to Specify a Data Set 30
Using a File Specification to Specify a Data Set 30
Data Set Requirements 31
Automatic Data Set Locking 31
Using Engines with SAS/GRAPH Software 31
Running SAS/GRAPH Programs 31
Modes of Operation 31
Running in Batch Mode 32
RUN-Group Processing 33
With global and local statements 33
With BY statements 33
With the WHERE Statement 33
Procedure Output and the Graphics Output Area 34
About the Graphics Output Area 34
External Dimensions 34
Device Resolution 35
Cells 36
Units 38
Placement of Graphic Elements in the Graphics Output Area 39
How Errors in Sizing Are Handled 40
Making Programs Portable 40
Overview
In general, SAS/GRAPH programs work like other SAS programs: the SAS/GRAPH
procedures use data from SAS data sets to produce output – in this case, graphics
output. In addition, SAS/GRAPH programs define the output environment and control
the format and destination of the graphics output. This chapter discusses SAS/GRAPH
programs and explains how they produce graphics output. It describes
3 the language elements used by SAS/GRAPH programs
26 Language Elements Chapter 2
Language Elements
The language elements used by SAS/GRAPH programs include SAS/GRAPH
procedures, SAS/GRAPH statements, and Annotate data sets. In addition to
SAS/GRAPH language elements, your SAS/GRAPH program may include Base SAS
statements and procedures that you use to process your data or control the destination
or format of your program output.
SAS/GRAPH Procedures
SAS/GRAPH procedures create graphics output, process data for other SAS/GRAPH
procedures to use, or manage graphics output that has been stored in a catalog. A
SAS/GRAPH procedure step typically contains these statements:
PROC statement
starts the procedure. Typically it identifies input and output data sets, and assigns
a destination for graphics output. For information on data sets and data
requirements, see “SAS Data Sets” on page 29. For information on assigning
graphics catalogs, see “Storing Graphics Output in SAS Catalogs” on page 53.
Subordinate statements
perform the work of the procedure; subordinate statements that generate graphs
are called action statements. For example, the HBAR statement in the GCHART
procedure is an action statement.
RUN statement
executes the statements in the procedure step. Use the QUIT statement to end the
procedure. See also “RUN-Group Processing” on page 33.
In addition, many SAS/GRAPH procedures can use the following statements:
BY statement
causes the procedure to produce multiple graphs, each corresponding to a BY
variable value. Each graph that is produced for a value of a BY variable is stored
as a separate catalog entry in either the default catalog, WORK.GSEG, or in the
catalog you specify with a GOUT= option in the PROC statement. See “BY
Statement” on page 141 for a complete description.
NOTE statement
adds text to the graphics output. See “TITLE, FOOTNOTE, and NOTE
Statements” on page 210 for a complete description.
You can also use other SAS language statements with SAS/GRAPH procedures. See
“Other SAS Language Statements” on page 27.
SAS/GRAPH Programs Other SAS Language Statements 27
LABEL statement
assigns a descriptive text string to a variable. Unless other text is specified in the
SAS/GRAPH program, the label appears in place of the variable name.
LIBNAME statements
identify SAS libraries that contain SAS data sets or catalogs that you want to use
with your SAS/GRAPH programs. See “LIBNAME Statement” on page 29 for more
information.
ODS statements
direct the output from certain SAS/GRAPH procedures to the Output Delivery
System.
The ODS LISTING statement directs PROC GDEVICE output to the SAS
listing file.
The ODS HTML statement is used with the GIF driver to direct graphics
output to one or more GIF files and create a variety of HTML files that can display
the GIF files in a Web browser. See “ODS HTML Statement” on page 164 for
information on using the ODS HTML statement with SAS/GRAPH procedures.
OPTIONS statement
changes the value of one or more SAS system options.
QUIT statement
executes any statements that have not executed and ends the procedure.
WHERE statement
specifies observations from SAS data sets that meet a particular condition. Using
a WHERE statement provides an easy way to graph a subset of your data.
For a complete description of these statements, see SAS Language Reference:
Dictionary.
FILENAME Statement
The FILENAME statement associates a SAS fileref with an external text file or
output device. With SAS/GRAPH software, you can use a FILENAME statement to
3 point to a text file that you want to use for data input or output.
3 assign the destination of a graphics stream file (GSF). This destination can be
either a single, specific file or an aggregate file storage location, such as directory
or PDS. See “About Exporting SAS/GRAPH Output” on page 59 for information on
creating graphics stream files.
You can also use the FILENAME statement to route input to and from other devices.
For details, see the SAS documentation for your operating environment.
A FILENAME statement that points to an external file has this general form:
FILENAME fileref ’external-file’;
fileref
is any SAS name.
external-file
is the physical name of the external file or aggregate file storage location you want
to reference. For details on specifying the physical names of external files, see the
SAS documentation for your operating environment.
For a complete description of the FILENAME statement, see SAS Language
Reference: Dictionary.
SAS/GRAPH Programs Temporary and Permanent SAS Data Sets 29
LIBNAME Statement
The LIBNAME statement associates a libref with a SAS data library. A SAS data
library can be either temporary or permanent. Typically, SAS data libraries used with
SAS/GRAPH software contain
3 SAS files for data input and output.
3 SAS catalogs that contain maps, fonts, or device entries.
3 SAS catalogs that contain graphics output. These catalogs are often stored in
permanent libraries. See “Storing Graphics Output in SAS Catalogs” on page 53
for information on storing graphics output in a permanent catalog.
The LIBNAME statement has this general form:
LIBNAME libref ’SAS-data-library’;
libref
is any SAS name.
SAS-data-library
is the physical name for the SAS data library on your host system. For details on
specifying SAS-data-library, see the SAS documentation for your operating
environment.
The libref WORK is reserved; it always points to an area where temporary data sets
and catalogs are kept. The contents of WORK are deleted when you exit a SAS session.
For a complete description of the LIBNAME statement, see SAS Language Reference:
Dictionary.
If you omit the DATA= option, the procedure uses the value of the SAS system option
_LAST_=. The default for _LAST_= is the most recently created SAS data set (either
permanent or temporary) in the current SAS job or session.
If you do not specify a data set and no data set has been created in the current SAS
session, an error occurs and the procedure stops.
Most of the procedures that read data sets or create output data sets accept data set
options. SAS data set options appear in parentheses after the data set specification, as
shown in this example:
proc gplot data=reflib.stocks(where=(year=1997));
For more information on SAS data sets and other data processing details, see SAS
Language Reference: Concepts. For a complete discussion of SAS data set options and
SAS system options, see SAS Language Reference: Dictionary.
Typically, permanent SAS data sets have a two-level name of the form
libref.SAS-data-set-name in which libref identifies a storage location on your host
system. A LIBNAME statement associates a libref with the storage location. See also
“LIBNAME Statement” on page 29. For example, these statements specify a permanent
data set:
libname reflib ’my-SAS-library’;
proc gplot data=reflib.stocks;
You can use a one-level name for permanent SAS data sets if you specify a USER
data library. In this case, the procedure assumes that data sets with one-level names
are in the USER data library instead of in the WORK data library. You can assign a
USER data library with a LIBNAME statement or the USER= SAS system option. For
example, these statements use a single-level name to specify a permanent data set that
is stored in the library identified as the USER library:
options user=’my-SAS-library’;
proc gplot data=stocks;
The quotes are required for a file specification; if omitted, SAS treats the specification
as a library reference. In the above example, if the quotes are omitted, SAS creates the
data set in the temporary WORK catalog and identifies it by the name WORK.MYDATA.
To create the file in a location other than the default location, the quoted file
specification must include the full path to the desired location.
You cannot use quoted file specifications for
3 SAS catalog names
3 MDDB and FDB references
3 PROC SQL
3 the _LAST_= system option.
SAS/GRAPH Programs Modes of Operation 31
Note: The default engine for Versions 7 and 8 do not work with the GREDUCE
procedure if the input data set is compressed. 4
For more information about SAS engines, see SAS Language Reference: Concepts.
Modes of Operation
There are several ways to run a SAS program. You can use
3 SAS windowing environment that gives you a text editor from which to submit
programs, windows for the SAS log and SAS output, and many other facilities
3 interactive line mode, in which you submit programs one line at a time
3 noninteractive mode, which executes a SAS program (stored in a file) in your
current terminal session
32 Running in Batch Mode Chapter 2
3 batch mode, which executes a SAS program (stored in a file) in a separate session.
The mode you use determines whether the graphics output displays on your monitor.
If you use the SAS windowing environment, interactive line mode, or noninteractive
mode, the SAS/GRAPH program can display graphics output on your monitor as well as
store the output in a catalog.
If you use batch mode, the graphics output is not displayed on your monitor. In this
case, your program must send the graphics output to a hardcopy device, permanent
catalog, or a graphics stream file. See Chapter 4, “SAS/GRAPH Output,” on page 47 for
more information on the destination of graphics output.
Regardless of how you run your programs, SAS/GRAPH software uses the values
stored in the device entry or specified by graphics options in a GOPTIONSChapter 36,
“The GOPTIONS Procedure,” on page 1075 statement to determine how to handle the
graphics output.
SAS Monospace is available on all hosts and other fonts can be made available by
running PROC FONTREG.
proc fontreg fontpath ’directory_containing_TT_or_Type1_fonts’;run;
FreeType font support is also available with the Universal GIF driver.
options dev=sasprtc printerpath=gif;
proc gtestit pic=1;run;
SAS/GRAPH Programs RUN-Group Processing 33
RUN-Group Processing
You can use RUN-group processing with the GCHART, GMAP, GPLOT, GREPLAY,
and GSLIDE procedures to produce multiple graphs without restarting the procedure
every time.
To use RUN-group processing, you start the procedure and then submit multiple
RUN-groups. A RUN-group is a group of statements that contains at least one action
statement and ends with a RUN statement. It can contain other SAS statements such
as AXIS, BY, GOPTIONS, LEGEND, TITLE, or WHERE. As long as you do not end the
procedure, it remains active and you do not need to resubmit the PROC statement.
To end RUN-group processing, submit a QUIT or RUN CANCEL statement, or start
a new procedure.
Note: When using SAS/GRAPH with the ODS statement, it is best to use a QUIT
statement after each procedure that uses RUN-group processing, rather than relying on
a new procedure to end the processing. Running too many procedures without an
intervening QUIT statement can use up so much memory as to crash the system
(depending, of course, on how many other processes are running). Also, note that failing
to do a QUIT before doing an ODS CLOSE results in the process memory not being
freed at all. 4
With BY statements
BY statements persist in exactly the same way. Therefore, if you submit a BY
statement within a RUN-group, the BY-group processing produces a separate graph for
each value of the BY variable for the RUN-group in which you submit it and for all
subsequent RUN-groups until you cancel the BY statement or exit the procedure. Thus,
as you submit subsequent action statements, you continue to get multiple graphs (one
for each value of the BY variable). For more information, see “BY Statement” on page
141.
Using a WHERE statement with RUN-group processing follows most of the same
rules as using the WHERE statement outside of RUN-group processing with these
exceptions:
3 With the GMAP procedure, the WHERE variable must be in the input data set.
3 With a procedure that is using an Annotate data set, the following requirements
must be met:
3 The ANNOTATE= option must be included in the action statement.
3 The WHERE statement must be executed before the action statement.
3 The WHERE variable must occur in the Annotate data set.
External Dimensions
The graphics output area is contained within the device’s display area. The external
dimensions of the device’s display area are controlled by the values of the XMAX and
YMAX device parameters. XMAX sets the maximum horizontal dimension; YMAX sets
the maximum vertical dimension. The orientation of the graphics output area, that is,
whether it is landscape or portrait, is determined by whether the larger value is XMAX
(orientation is landscape) or YMAX (orientation is portrait).
SAS/GRAPH Programs About the Graphics Output Area 35
The external dimensions of the graphics output area are controlled by the values of
the HSIZE and VSIZE device parameters.
Typically, the default dimensions of the graphics output area are the same as the
dimensions of the device. This is usually true for display devices. For those devices, the
default value of HSIZE and VSIZE is 0. However, for hardcopy devices, the XMAX,
YMAX values represent the external boundaries of the output medium (such as a sheet
of paper). If these devices need a margin, HSIZE, VSIZE and HORIGIN, VORIGIN are
assigned default values and the default graphics output area is somewhat smaller than
the device’s display area. Figure 2.1 on page 35 illustrates such a device.
HSIZE=8.0in
YMAX=11.00in
YPIXELS=3300
VSIZE=8.5in
display area
HORIGIN=0.218in
VORIGIN=1.496in
Note that HORIGIN and VORIGIN define the left margin and bottom margin,
respectively. The right margin and top margin are calculated by the device driver as
follows:
right-margin = XMAX − (HSIZE + HORIGIN)
top-margin = YMAX −(VSIZE + VORIGIN)
You cannot specify values for right-margin and top-margin.
You can change the dimensions of the graphics output area for a SAS session or for a
single graph with the HSIZE= and VSIZE= graphics options. Changing the size of the
graphics output area does not change the dimensions of the device’s display area or
affect the resolution. The values of HSIZE= and VSIZE= cannot exceed the maximum
dimensions for the device as specified by XMAX and YMAX. Furthermore, you cannot
specify values for graphics options HSIZE= and VSIZE= that exceed the HSIZE and
VSIZE values in the device entry.
Device Resolution
The resolution of a device is the number of pixels per inch. It is determined by the
values of the device parameters XMAX, YMAX, and XPIXELS, YPIXELS, and is
calculated by dividing the number of pixels by the corresponding external dimension.
For example,
x-resolution = XPIXELS / XMAX
Therefore, the X resolution of the PSCOLOR device illustrated in Figure 2.1 on page
35 is 300dpi (dots per inch).
Ordinarily, you do not want to change the device resolution because changing it may
distort your image. However, you may want to change the size of the display area. To
36 About the Graphics Output Area Chapter 2
do so without changing the resolution, use the GOPTIONS statement to change the
values of only XPIXELS= and YPIXELS=, or the values of only XMAX= and YMAX=.
Then SAS/GRAPH will automatically calculate the correct value for the unspecified
parameters so that the device retains the default resolution.
If you do want to change the device resolution (usually for image files or graphs that
are displayed online), specify values for both XMAX= and XPIXELS= (horizontal
resolution) or both YMAX= and YPIXELS= (vertical resolution), or all four. In these
cases, SAS/GRAPH changes the dimensions and recalculates the device resolution.
Table 2.1 on page 36 summarizes the interaction of these options.
XMAX= and YMAX= not XPIXELS= and YPIXELS= changes the dimensions and
recalculates the value of
XPIXELS= and YPIXELS= in
order to retain the resolution
Cells
Within the graphics output area, SAS/GRAPH software defines an invisible grid of
rows and columns. This grid is made up of character cells as shown in Figure 2.2 on
page 37.
The size and proportion of these cells affects the size and appearance of graphic
elements that are drawn using units of CELLS. The attributes of the cells are
determined by both the external dimensions of the graphics output area (controlled by
HSIZE and VSIZE) and the number of rows and columns. The number of rows is
controlled by the LROWS (if orientation is landscape) or PROWS (if orientation is
portrait) device parameter. Similarly, the number of columns is controlled by the
LCOLS (landscape) or PCOLS (portrait) device parameter.
You can change the number of rows and columns in the grid with the HPOS= and
VPOS= graphics options. HPOS= overrides the value of LCOLS or PCOLS and sets the
number of columns in the graphics output area. VPOS= overrides the value of LROWS
or PROWS and sets the number of rows in the graphics output area.
Figure 2.2 on page 37 illustrates the relationship between the graphics options or
device parameters that determine the dimensions of the graphics output area and those
that determine the number of character cells within the graphics output area.
SAS/GRAPH Programs About the Graphics Output Area 37
Figure 2.2 Rows, Columns, and Cells in the Graphics Output Area
HPOS=8
(columns in graphics output area; can also be
defined by LCOLS or PCOLS device parameter)
character
cell
VPOS=6 VSIZE=6 in
(rows in (can also be
graphics output defined by
area; can also YMAX device
be defined by parameter)
LROWS or
PROWS device
parameter)
HSIZE=8 in
(can also be defined by XMAX device parameter)
Changing only the external dimensions of the graphics output area (HSIZE= and
VSIZE=) retains the cell size but causes SAS/GRAPH to automatically recalculate the
number of rows and columns, as illustrated in Figure 2.3 on page 37.
HPOS=8
VPOS=18 VSIZE=9IN
(recalculated) (specified)
VPOS=12 VSIZE=6IN
HSIZE=4IN HSIZE=6IN
(specified)
Changing only the number of rows and columns (HPOS and VPOS) changes the size
of the cells without altering the overall size of the output. Figure 2.4 on page 37 shows
how increasing the number of rows and columns reduces the size of the individual cells.
VPOS=10 VSIZE=6IN
(specified) (no change)
VPOS=12 VSIZE=6IN
HSIZE=4IN HSIZE=4IN
(no change)
38 About the Graphics Output Area Chapter 2
Usually, you should not change the number of rows and columns from the default for
your device. However, if you must change them to make a graph fit, note that the size
of text in the graphics output will change if you specified text size using units of
CELLS. If the cells are large (that is, HPOS= and VPOS= have small values), the text
may not fit. If the cells are too small, the text may be too small to read. In this case,
you can adjust the size of the text with the HEIGHT= statement option or the HTEXT=
graphics option.
To change all the attributes of the graphics output area, specify values for all four
options, as shown in Figure 2.5 on page 38.
Figure 2.5 Changing HSIZE=, VSIZE= and HPOS=, VPOS= Changes Dimensions
and Number and Size of Cells
HPOS=6
(specified)
HPOS=8
VPOS=10 VSIZE=7.5IN
(specified) (specified)
VPOS=12 VSIZE=6IN
HSIZE=4IN HSIZE=6IN
(specified)
Table 2.2 on page 38 summarizes the interaction of the HSIZE=, VSIZE=, HPOS=,
and VPOS= graphics options.
HPOS= and VPOS= not HSIZE= and keeps the external dimensions but changes the
VSIZE= cell size according to the number of rows and
columns.
HSIZE= and VSIZE= HPOS= and VPOS= changes the dimensions of the graphics output
area, the number of rows and columns, and
recalculates the cell size.
Units
By default, most graphic elements are drawn using units of CELLS to determine
their size. For example, the default character height for the TITLE1 definition is two
cells; for all other text the default height is one cell.
Changing the cell size to control the size of one element, such as text, may distort
other parts of your graph. Instead, you may want to change the type of units that
SAS/GRAPH uses to control the size of the graphic elements. In addition to CELLS and
other absolute units such as inches (IN), centimeters (CM), and points (PT), you can
often use units of percent of the graphics output area (PCT). This unit specification
SAS/GRAPH Programs Placement of Graphic Elements in the Graphics Output Area 39
allows the height of the graphic elements to change in proportion to the size of the
graphics output area.
You can specify the type of unit for individual graphic elements or you can use the
GUNIT= graphics option to set the default units that will be used for most height
specifications.
Note: Titles and footnotes can be positioned elsewhere on the graph as well, with
different effects on space allocation. See “TITLE, FOOTNOTE, and NOTE Statements”
on page 210 for details. 4
Figure 2.6 Default Locations for Graphic Elements in the Graphics Output Area
optional
area for
titles and
footnotes
optional procedure
area for output
titles and area
footnotes
graphics
output
area
Note: If the titles, footnotes, and legend are very large, they may make the
procedure output area too small for the graph. You can control the size of title and
footnote text and of most legend elements with statement options. For details, see
Chapter 7, “SAS/GRAPH Statements,” on page 121 for a description of the appropriate
statement. In addition, “GOPTIONS Statement” on page 146 lists the graphics options
that control the size of various graphic elements. See also “Making Programs Portable”
on page 40. 4
40 Making Programs Portable Chapter 2
See “GUNIT” on page 309 for a complete description of the GUNIT= graphics
option.
3 Compare colors and patterns for the devices you will use and use the colors of the
device that has the fewest colors, With a slide camera, for example, you can choose
from over 16 million colors, but some graphics monitors display only four or eight
colors at a time.
If you want to generate a graph on both a color device and a black-and-white
device, such as a laser printer or a monochrome graphics monitor, all colors are
remapped to black, white, or scales of gray, depending on the device. However,
with the PATTERN statement, you can substitute line-patterns for colors.
3 Preview the appearance of the output on a different device with the
TARGETDEVICE= graphics option. For example, to see how the output will look
on a color PostScript printer, specify
goptions targetdevice=pscolor;
41
CHAPTER
3
Device Drivers
Overview 41
About Device Drivers 42
Types of Device Drivers 42
How Device Drivers Are Assigned 43
Selecting a Device Driver 43
Viewing the List of Available Device Drivers 44
Browsing the Contents of a Device Entry 44
Specifying a Device Driver in a SAS Session 44
Controlling Output with Device Drivers 45
Modifying Device Parameters Permanently 45
Overriding Device Parameters Temporarily 46
Graphics Options 46
Statement Options 46
Overview
SAS/GRAPH procedures that produce graphics output require a device driver to
display the output. This chapter discusses the role of device drivers in generating
SAS/GRAPH output, provides directions for selecting and specifying device drivers, and
explains how you can change the settings of device parameters.
Other tasks related to device drivers are discussed in Chapter 4, “SAS/GRAPH
Output,” on page 47 and Chapter 9, “Introducing SAS/GRAPH Output for the Web,” on
page 369 and in the SAS Help facility for SAS/GRAPH. These include
3 displaying graphics output (see “Displaying Graphics Output on Monitors or
Terminals” on page 49)
3 previewing on one device how output will look on another device (see “Previewing
Output” on page 52)
3 sending graphics output to a printer or other hardcopy device (see “Printing
Graphics Output” on page 51)
3 creating external files in other graphics formats for use with other applications
(see “About Graphics Stream Files” on page 60)
3 creating graphics output that can be referenced in an HTML file and viewed with
a Web browser (see “About Graphics Stream Files” on page 60)
For a description of device catalogs and for information on creating and modifying
device drivers, see Chapter 31, “The GDEVICE Procedure,” on page 915.
42 About Device Drivers Chapter 3
For more information about Universal Printing, see the Base SAS Software section in
SAS Help and Documentation. For more information about Windows printing, see the
SAS Help facility for SAS/GRAPH.
The NOFS on page 921 option in the PROC GDEVICE statement causes the
procedure not to use the GDEVICE windows.
If you want to write the list of devices to an external file you can
3 save the contents of the Output window.
3 use the PRINTTO procedure to redirect the GDEVICE procedure output to
an external file. See Base SAS Procedures Guide for a description of the
PRINTTO procedure.
Once you have generated the list of available device drivers, you can search the list
until you find the description that matches your output device. The corresponding name
is the name that you specify as the device driver.
display past the device’s capability or if you specify colors for a device that cannot
display them, you will get unpredictable results.
Note: If you run SAS/GRAPH software in a multi-user environment, you should not
change the device entries in the Institute-supplied catalog, SASHELP.DEVICES, unless
you are the system administrator or the SAS Support Consultant. 4
If you need to change a device driver in SASHELP.DEVICES, copy it into a personal
catalog named DEVICES, and then modify the copy. To use the new device driver,
assign the libref GDEVICE0 to the library that contains the modified copy. See
“Creating or Modifying Device Entries” on page 934 for details.
Graphics Options
To override device parameter settings with graphics options, simply submit the
options in a GOPTIONS statement. For example, the HSIZE= and VSIZE= graphics
options control the default size of the graphics output area and override the values of
the HSIZE= and VSIZE= device parameters in the current device entry. The following
GOPTIONS statement changes the dimensions of the graphics output area:
goptions hsize=6in vsize=4in;
These new values remain in effect until you change them, use the RESET= graphics
option to reset them, or end your SAS session.
The values that you specify for graphics options must be supported by your graphics
device. If you use an option that is not supported, SAS/GRAPH software ignores the
option. See “GOPTIONS Statement” on page 146 for information about specifying
graphics options.
Statement Options
You can also override parameters that control such attributes as text color and font
by using options in other SAS/GRAPH statements. For example, this TITLE statement
explicitly specifies the text color and font:
title color=blue font=zapf ’Production Quality’;
The COLOR= option overrides the default color selection from the device entry’s
colors list as well as any graphics options that affect text color. The FONT= option
overrides the device’s default font and any graphics options that affect the font. As long
as the values are supported by your graphics device, the values you specify in the
statements override the corresponding device parameters and graphics options when
the SAS program is executed.
When you specify options that override device parameter settings, this is the order of
precedence that SAS/GRAPH software uses:
1 options in a SAS/GRAPH procedure statement or AXIS, FOOTNOTE, LEGEND,
NOTE, PATTERN, SYMBOL, or TITLE statement
2 graphics options in a GOPTIONS statement
3 device parameters in a device entry
4 default hardware settings of a device.
47
CHAPTER
4
SAS/GRAPH Output
Example 66
Saving Multiple Graphs to Multiple Files 68
Example 68
Replacing Existing External Files 70
Example 71
Other Ways to Assign the Destination 72
Using GACCESS=GSASFILE 72
Using GACCESS= to Explicitly Specify a Destination 72
Exporting SAS/GRAPH Output Using Modified Device Entries 72
73
The Metagraphics Driver Facility 73
catalog-name
is the name of the catalog whose contents you want to view. The default is
WORK.GSEG. If the specified catalog does not contain any graphics entries, the
window opens but is empty. The catalog assignment is temporary and remains in
effect only while the GRAPH window remains open. To change the catalog,
resubmit the GRAPHn command.
entry-name
is the name of the catalog entry that you want to view. If you omit entry-name or
the entry does not exist, the last graph in the catalog is displayed. If you specify
entry-name, you must also supply the libref and catalog name.
GRSEG
is the type of catalog entry.
To close the GRAPH window, issue the END command.
Doing any of the following may change the HSIZE and VSIZE values and
consequently the size of the GRAPH window:
3 changing the device driver
3 specifying a target device
3 specifying dimensions with the HSIZE= and VSIZE= graphics options.
In addition, resizing the GRAPH window can reduce the number of cells available for
the output. In order to display some types of graphs in a reduced GRAPH window, you
may need to increase the number of cells either by using the HPOS= and VPOS=
graphics options or by modifying the device driver. To ensure that graphs have an
adequate number of cells, use a full-size GRAPH window when creating the graphs.You
can then reduce the window to replay the graphs. For more information on dimensions
and cell size, see “About the Graphics Output Area” on page 34.
If you create most or all of your graphs at the same size or with the same aspect
ratio, you can avoid distortion if you size the window before you draw the graphs and
then use the WSAVE command to save the position and dimensions of the window. If
you resize the GRAPH windows and do not use the WSAVE command, the new size is
not saved, even in the same SAS session.
number of seconds before the next graph is drawn. NOPROMPT suppresses the delay
between the graphs displayed. In this case, SAS/GRAPH automatically returns to your
program after the last graph displays. (See Chapter 8, “Graphics Options and Device
Parameters Dictionary,” on page 261 for a complete description of these graphics
options.)
With the direct display method, you cannot scroll to other graphs in the catalog. To
redisplay graphs, you must rerun the procedure or replay the catalog entries. For
information on replaying graphs, see Chapter 43, “The GREPLAY Procedure,” on page
1237.
Previewing Output
If you want to preview how a graph is going to appear on another device before you
send it to that device, you can use the TARGETDEVICE= graphics option. For example,
SAS/GRAPH Output Accessing Catalogs from Different Versions of SAS 53
CAUTION:
You can read Version 6 catalogs from Version 7 and Version 8, but you cannot write to
them unless you port them. 4
In some cases you have to specify an engine to read a Version 6 catalog from the
current SAS version:
3 If you are running the current version and you assign a libref that points to a
library that contains only Version 6 catalogs, the correct engine is automatically
54 Creating and Specifying Catalogs Chapter 4
applied and you can view the entries. However, you cannot write to the catalog
without porting it.
3 If you are running Version 7 or Version 8 and you assign a libref that points to a
library that contains both Version 6 and the current version catalogs, the
LIBNAME statement must specify the SASEB engine to view the entries in the
Version 6 catalog. Even with the engine assigned, you cannot write to the catalog
without porting it.
For more information, see “Transporting Catalogs across Operating Environments”
on page 56.
All Version 7 and Version 8 applications that support catalog entries that also existed
in Version 6 should be able to transparently read those Version 6 catalog entries. That
is, if a Version 7 or Version 8 user specifies the SASEB (Version 6 compatibility) engine
on the LIBNAME statement, the application should be able to read and process any
Version 6 data that the SASEB engine may return.
The Version 7 and Version 8 compatibility engines also support write access to
Version 6 catalogs.
CAUTION:
Be careful using GOUTMODE=REPLACE. GOUTMODE=REPLACE replaces all existing
entries in the output catalog. You cannot retrieve previous entries once they have
been replaced. See “GOUTMODE” on page 302 for more information. 4
SAS/GRAPH Output Modifying SAS/GRAPH Output 55
3 To open a GRAPH window and edit a graph that is stored in a catalog, submit the
GRAPH command from the command line of the SAS Explorer window and add
EDIT to the end of the command. Separate the two commands with a semicolon
(;). For example, the following statement opens the GRAPH3 window, displays the
specified graph, and activates the graphics editor:
graph3 mylib.grafcat.slide1; edit
You can use the graphics editor to change graphics elements already displayed in the
graph such as text, lines, and polygons, or you can add graphics elements to the graph.
You can create, delete, or duplicate a graphics element and select, change, move, or
resize it. You can also change an element’s properties, such as its color or fill pattern, or
its values, such as the coordinates of one of its points. For instance, you can move a bar
from one side of the display area to the other, make a copy of it and place it in yet
another place, and change its fill color and pattern. You can undo and redo changes,
zoom in or out on the display, move an element to the foreground or background, and
read in or link to another graph that has already been created.
After you have made changes, you can save your modifications to a catalog and send
the modified graph to an output device, such as a printer.
For a complete description of the graphics editor, refer to the SAS Help facility for
SAS/GRAPH.
Note: Modifying your graphics output with the graphics editor does not change the
SAS programs that generated that output. 4
To retain the original order of the GRSEG entries in the catalog, use SELECT=
in the PROC CPORT statement to export individual graphs in the order they were
created. Otherwise, when you use the GREPLAY procedure to list the graphics
entries in the imported catalog, the procedure will list the entries in alphabetical
order, rather than the order in which they were created.
Note: Only the GREPLAY procedure can list catalog entries in the order they
were created. All other procedures list entries in alphabetical order.
To export a catalog that contains groups of entries created using the GREPLAY
procedure, you must use SELECT= in the PROC CPORT statement to select the
names of the groups, rather than the names of individual graphs, to be included in
the transport file. If you export the entire catalog without using SELECT=, the
groups are not maintained in the catalog created when you import the transport
file in the new host environment.
When you use the CPORT procedure, messages in the SAS log identify the
catalog entries that have been placed in the transport file. If the catalog entry was
created by replaying several graphs into a template, the log messages list the
names of all of the entries that contributed to the templated graph.
2 Move the transport file to the target machine, if necessary. You must move the
transport file in binary format. If you do not move the transport file in binary
format, the CIMPORT procedure cannot read the file you create.
Operating Environment Information: Use communications software or tape to
move the transport file. Refer to the documentation for your network or standard
procedures for using tape files. 4
3 Once you have moved the transport file to the target machine, import the
transport file into a catalog in the new host environment using the CIMPORT
procedure. The entries are imported in the order specified in SELECT= in the
PROC CPORT statement used to create the transport file.
The SELECT= option in the PROC CIMPORT statement does not affect the
order of the imported entries.
Note: You must use the CIMPORT procedure from the current version of the SAS
System. The CIMPORT procedure in a previous release cannot read a transport file
created by the CPORT procedure in the current version. For details on using the
CPORT and CIMPORT procedures, see the Base SAS Procedures Guide. 4
Once the transport file has been moved to the new host environment using
communications software or tape, the CIMPORT procedure creates a new catalog called
MYLIB.GRAPHS on the new machine.
58 Transporting Catalogs across Operating Environments Chapter 4
After moving the transport file to the new host environment, you can import the color
map using the following statements:
filename tranfile ’external-file’;
libname newlib ’SAS-data-library’;
After moving the transport file to the new host environment, you can import the font
using the following statements:
filename tranfile ’external-file’;
libname gfont0 ’SAS-data-library’;
could export a device entry from the GDEVICE0.DEVICES catalog using the following
statements:
filename tranfile ’external-file’;
libname gdevice0 ’SAS-data-library’;
After moving the transport file to the new host environment, you can import the
device entry using the following statements:
filename tranfile ’external-file’;
libname gdevice0 ’SAS-data-library’;
In order to do these kinds of things with your SAS/GRAPH output, you must export
your graphs from SAS/GRAPH, using a different graphics file format, such as CGM,
GIF, or TIFF, and store them in external files.
For information on creating SAS/GRAPH output for Web publishing, see Chapter 9,
“Introducing SAS/GRAPH Output for the Web,” on page 369. For information on
SAS/GRAPH language elements and programs and on how procedure output is
generated, see Chapter 2, “SAS/GRAPH Programs,” on page 25. For information on
using and managing SAS/GRAPH output, see Chapter 4, “SAS/GRAPH Output,” on
page 47.
General Information
Common Requirements
Regardless of the process you use to create a GSF from a SAS/GRAPH program, you
must specify the following:
3 a destination for the output. This can be an aggregate file storage location (for
example, a directory or a partitioned data set) or a specific file. Typically you
specify the destination with a FILENAME statement and one or more graphics
options. For more information, see “FILENAME Statement” on page 28.
3 a device driver that creates the type of graphics output that you want.
3 whether SAS/GRAPH should replace an existing file or append new records to it.
By default, SAS/GRAPH replaces an existing file with newly created output of the
same name. For details, see “Replacing Existing External Files” on page 70.
SAS/GRAPH Output General Information 63
File extensions
When you send SAS/GRAPH output to an aggregate file storage location,
SAS/GRAPH generates the name of the external file by taking the catalog entry name
and adding the appropriate file extension. Most drivers provide a default extension. If a
driver does not generate an extension, SAS/GRAPH uses the default extension .GSF. To
specify a different extension from the one SAS/GRAPH provides, use the EXTENSION=
graphics option. (For details, see “EXTENSION” on page 288).
Example
illustrates how SAS/GRAPH generates names for catalog entries and external files,
depending on 1) whether the NAME= option is used, and 2) on the fileref specification.
This illustration assumes the GSLIDE procedure and DEV=GIF:
64 Saving One Graph to a File Chapter 4
Table 4.1 How SAS/GRAPH Generates Entry Names and File Names
NAME= (not specified) fileref points to a file named catalog entry name: GSLIDE
’MYSLIDE.GIF’ external file name:
MYSLIDE.GIF
NAME= (not specified) fileref points to a storage catalog entry name: GSLIDE
location (for example, a external file name:
directory) GSLIDE.GIF
Note: When the fileref points to an aggregate file storage location, the name of the
catalog entry always determines the name of the external file. It does not matter
whether the catalog entry name is the default name or a name assigned by NAME=. 4
CAUTION:
If the graph created by the program already exists in the catalog, a new catalog entry with
an incremented name will be created and a new external file may be created rather than
updating the existing file. 4
You cannot replace individual entries in a catalog; therefore, to replace an entry you
must first delete the entry and then re-create it. Therefore, even though the contents of
the external file are replaced, the catalog entry is not. Each time you submit the
program, a new entry is created and the catalog entry name is incremented.
Example
This example creates one GSF that contains one text slide created by a group of
TITLE and FOOTNOTE statements and the GSLIDE procedure.
Define the fileref. The FILENAME statement associates the fileref GRAFOUT with
the external file that is the destination for the GSF. The file extension .PS indicates
that the graphics output is PostScript.
filename grafout ’mygraph.ps’;
Specify graphics options for the GSF. RESET=ALL resets all global statements and
graphics options. DEVICE= specifies a PostScript device driver. GSFNAME= assigns
the fileref GRAFOUT as the destination for the GSF. GSFMODE=REPLACE (the
default) causes the contents of the external file to be replaced each time the graphics
procedure is run.
goptions reset=all
device=pscolor
gsfname=grafout
gsfmode=replace
ftext=swissb;
Produce one text slide. NAME= specifies the name that is assigned to the catalog
entry created by the procedure. If you omit NAME=, SAS/GRAPH uses the default
naming convention to name the entry.
proc gslide border name=’proposal’;
title1 h=4 ’Proposed Design Improvements:’;
title2 h=3 ’* Increase Stability’;
title3 h=3 ’* Increase Speed’;
title4 h=3 ’* Reduce Weight’;
footnote h=2 j=l ’ABC Company’;
run;
quit;
When you submit these statements, SAS/GRAPH does the following if no graphs of
the same name exist in the catalog:
3 Creates one catalog entry named PROPOSAL in WORK.GSEG.
3 Creates one external file that contains the output from the GSLIDE procedure and
sends a message to the LOG reporting the number of records and the name of the
file to which they were written. The file name is the one specified in the
FILENAME statement.
Because the destination is a specific file and because GSFMODE=REPLACE, each
time you run the program it replaces the contents of the external file. Therefore, this
method is particularly useful when you want to update an external file by resubmitting
an existing program.
However, if there is more than one run of a graphics procedure in this program, the
file would contain only the graphics output from the last procedure run because this
program replaces the external file each time a graphics procedure is run.
Note: Even though the contents of the external file are replaced, the catalog entry is
not. Unless you explicitly delete the existing entry named PROPOSAL, each time you
66 Saving Multiple Graphs to One File Chapter 4
submit the program, a new entry is created and the catalog entry name is incremented.
This table illustrates what happens if you submit the above program three times
without deleting the catalog entries: 4
Table 4.2
1 PROPOSAL mygraph.ps
2 PROPOSA1 mygraph.ps
3 PROPOSA2 mygraph.ps
Note that each new catalog entry replaces the contents of the external file, in this
case, mygraph.ps. For more information, see “Replacing Existing External Files” on
page 70.
For a complete description of the graphics options used in this example, see Chapter
8, “Graphics Options and Device Parameters Dictionary,” on page 261.
Example
This example stores several text slides in one external file. The program is the same
as the previous example except the GOPTIONS statement specifies
GSFMODE=APPEND and the GSLIDE procedure uses RUN-group processing to create
multiple slides. Each slide includes the current TITLE statement and all previously
defined TITLE and FOOTNOTE statements.
Define the fileref.
filename grafout ’mygraph.ps’;
Specify graphics options for the GSF. GSFNAME= assigns the fileref GRAFOUT as
the destination for the GSF. GSFMODE=APPEND adds each new piece of output to the
end of the external file.
goptions reset=all
device=pscolor
gsfname=grafout
gsfmode=append
ftext=swissb
rotate=landscape;
Produce four text slides. Each RUN-group generates a new catalog entry. NAME=
specifies the base name for each catalog entry created by the procedure.
proc gslide border name=’proposal’;
footnote h=2 j=l ’ABC Company’;
title1 h=4 ’Proposed Design Improvements:’;
SAS/GRAPH Output Saving Multiple Graphs to One File 67
run;
title1 h=3 ’* Increase Stability’;
run;
title1 h=3 ’* Increase Speed’;
run;
title1 h=3 ’* Reduce Weight’;
run;
quit;
When you submit these statements, SAS/GRAPH does the following if no graphs of
the same name exist in the catalog:
3 Creates a new catalog entry for each graph, beginning with the name PROPOSAL.
After the first graph is created, the entry name is incremented so that subsequent
graphs are called PROPOSA1, PROPOSA2, and so forth.
3 Creates one external file that contains all of the output from the GSLIDE
procedure. The file name is the one specified in the FILENAME statement. Each
time a graph is added to the file, SAS/GRAPH sends a message to the LOG
reporting the number of records and the name of the file to which they were
appended.
Note: Because the destination is a specific file and because the GSFMODE= setting
is APPEND, each time you run the program SAS/GRAPH adds the new graphs to the
external file. If you want the file to contain only the newly created graphs, delete it
before resubmitting the program. 4
In addition, if you resubmit the program without deleting the original catalog entries,
SAS/GRAPH will create four new entries that will be added to the catalog entry and four
new graphs appended to the external file, both of which will contain all eight graphs.
This table illustrates what happens if you submit this program twice without
deleting the catalog entries or the external file:
Table 4.3
PROPOSA2
PROPOSA3
2 PROPOSAL mygraph.ps PROPOSAL, PROPOSA1,
PROPOSA1 PROPOSA2, PROPOSA3,
PROPOSA4, PROPOSA5,
PROPOSA2
PROPOSA6, PROPOSA7
PROPOSA3
PROPOSA4
PROPOSA5
PROPOSA6
PROPOSA7
For more information, see “Replacing Existing External Files” on page 70.
68 Saving Multiple Graphs to Multiple Files Chapter 4
Although the general technique is the same, there are significant differences between
directing your graphics output to a specific file and directing it to an aggregate file
storage location. These differences are mostly concerned with how the file is named.
When the destination is an aggregate file storage location, SAS/GRAPH not only
creates the external file, it also names it. When SAS/GRAPH names an external file, it
always uses the name of the entry in the output catalog. This name is either
3 the name you specify in the NAME= option in the procedure
3 the default name supplied by SAS/GRAPH, such as GSLIDE.
In addition, SAS/GRAPH automatically appends the correct file extension to the
external file name. For example, if the output is named Q1SALES and the external file
is a GIF file, the file name is Q1SALES.GIF.
This technique of building the file name from the catalog entry name affects what
you do when you want to replace the contents of a file created in this way. For details,
see “Replacing Existing External Files” on page 70.
Example
This example creates four text slides and stores each one in a separate external file.
The program is similar to the previous examples except the fileref points to an
aggregate storage location instead of to a specific file.
Define the fileref. The FILENAME statement assigns an aggregate file storage
location as the destination for the files.
filename grafout ’external-file-location’; /* such as a directory */
Specify graphics options for the GSF. GSFNAME= assigns the fileref GRAFOUT as
the destination for the GSF. GSFMODE=REPLACE (the default) replaces the contents
of the external files with catalog entries of the same name.
goptions reset=all
device=pscolor
gsfname=grafout
SAS/GRAPH Output Saving Multiple Graphs to Multiple Files 69
gsfmode=replace
ftext=swissb
rotate=landscape;
Produce four text slides. Each RUN-group generates a new catalog entry. NAME=
specifies the base name for each catalog entry that is generated by the procedure. This
name is also the base name for the external files.
proc gslide border name=’proposal’;
footnote h=2 j=l ’ABC Company’;
title1 h=4 ’Proposed Design Improvements:’;
run;
title1 h=3 ’* Increase Stability’;
run;
title1 h=3 ’* Increase Speed’;
run;
title1 h=3 ’* Reduce Weight’;
run;
quit;
When you submit these statements, SAS/GRAPH does the following if no graphs of
the same name exist in the catalog:
3 Creates a new catalog entry for each graph, beginning with the name PROPOSAL.
After the first graph is created, the entry name is incremented so that subsequent
graphs are called PROPOSA1, PROPOSA2, and so forth.
3 Creates one external file for each catalog entry. The name of the file is the same as
the entry name plus the extension. In this case, the files are named
PROPOSAL.PS, PROPOSA1.PS, and so forth. For each file created, SAS/GRAPH
sends a message to the LOG reporting the number of records and the name of the
file to which they were written.
Note: Because you cannot replace individual entries in a catalog, each time you run
the program SAS/GRAPH creates new catalog entries and consequently new files. If
you want to replace the files, you must delete the corresponding catalog entries before
resubmitting the program. 4
This table illustrates what happens if you submit this program twice without
deleting the catalog entries:
70 Replacing Existing External Files Chapter 4
Table 4.4
1 PROPOSAL proposal.ps
PROPOSA1 proposa1.ps
PROPOSA2 proposa2.ps
PROPOSA3 proposa3.ps
2 PROPOSA4 proposa4.ps
PROPOSA5 proposa5.ps
PROPOSA6 proposa6.ps
PROPOSA7 proposa7.ps
Because the catalog names increment, there is never a matching file that the new
catalog can replace. Therefore, unless you delete the existing entries, the program
continues to create new files. To delete the existing entries, first run a GREPLAY
procedure with the DELETE option:
proc greplay igout=work.gseg nofs;
delete proposal proposa1 proposa2 proposa3;
One additional method for replacing catalog entries is rarely recommended because it
is easy to accidentally delete catalog entries that you did not intend to delete. If you
want to replace the entire contents of the catalog and if you are running only one
procedure, you can use the graphics option GOUTMODE=REPLACE. Whenever a new
procedure starts, GOUTMODE=REPLACE replaces the entire contents of the current
catalog with the new entries; it does not replace individual entries.
SAS/GRAPH Output Replacing Existing External Files 71
Example
The following example uses the GREPLAY procedure to explicitly delete specified
catalog entries so that you can re-create them and replace the corresponding external
files. This example uses the permanent catalog MYLIB.GRAFCAT.
3 The GREPLAY procedure explicitly deletes existing catalog entries that have the
same name as the entries to be created. If no entries exist, PROC GREPLAY
issues a message and the program continues.
3 The GSLIDE procedure generates four text slides and stores them in the catalog
specified by GOUT=. NAME= specifies PROPOSAL as the base name for the
catalog entries created by the procedure.
Define the fileref. The FILENAME statement assigns an aggregate file storage
location as the destination for the files.
filename grafout ’external-file-location’;
Specify graphics options for the GSF. GSFNAME= assigns the fileref GRAFOUT as
the destination for the GSF. GSFMODE=REPLACE (the default) replaces the contents
of the external files with catalog entries of the same name.
goptions reset=all
device=pscolor
gsfname=grafout
gsfmode=replace
ftext=swissb
rotate=landscape;
Delete existing catalog entries of the same name. The GREPLAY procedure deletes
the specified catalog entries. These are the catalog names generated by the NAME=
option in the procedure. If the entries do not exist, PROC GREPLAY issues a message
and the program continues.
proc greplay nofs igout=mylib.grafcat;
delete proposal proposa1 proposa2 proposa3;
run;
Produce four text slides. Each RUN-group generates a new catalog entry. NAME=
specifies the base name for each catalog entry generated by the procedure. This name is
also the base name for the external files.
proc gslide border gout=mylib.grafcat name=’proposal’;
footnote h=2 j=l ’ABC Company’;
run;
title1 h=3 ’* Increase Strength’;
run;
title1 h=3 ’* Reduce Drag’;
run;
title1 h=3 ’* Increase Resistance to Sheer’;
run;
quit;
3 creates a new catalog entry in MYLIB.GRAFCAT for each slide, and increments
the entry names: PROPOSAL, PROPOSA1, PROPOSA2, and PROPOSA3.
3 creates one external file for each catalog entry. The file name is built from the
catalog entry name. If a file of the same name already exists, SAS/GRAPH
replaces the contents of the file.
Using GACCESS=GSASFILE
This method is similar to the GSFNAME= method described in the previous sections.
3 Use a FILENAME statement and assign a destination to the fileref GSASFILE.
When you use GACCESS, the fileref must be named GSASFILE. The destination
can be either a specific file or an aggregate file storage location.
3 Assign GSASFILE to the GACCESS= graphics option instead of to GSFNAME=.
For example, these statements define and assign the fileref for an aggregate file
storage location:
/* define a fileref for the destination */
filename gsasfile ’external-file-location’;
Then simply change the device parameters to create an entry that produces graphics
stream files by default.
Often these device parameters correspond to the graphics options in your program.
For example, if your program uses the fileref GRAFOUT, you can enter a value of
Grafout in the Gsfname: field in the Host File Options window.
See Chapter 31, “The GDEVICE Procedure,” on page 915 for more information on
modifying device entries. Refer to the Device Help for SAS/GRAPH in the SAS Help
facility for lists of available drivers and for specific information on modifying device
entries in your operating environment.
CHAPTER
5
SAS/GRAPH Fonts
Overview 75
Specifying Fonts in SAS/GRAPH Programs 75
Font Specifications 76
Default Fonts 77
Font Locations 77
Using Hardware Fonts 78
Default Hardware Fonts 78
Using a GOPTIONS Statement to Change the Default Hardware Font 79
Using the GDEVICE Procedure to Change the Default Hardware Font 79
Specifying the Full Font Name 80
Specifying Alternative Hardware Fonts 80
Specifying Special Characters 81
Using SAS/GRAPH Software Fonts 82
Rendering Fonts 82
Font Lists 82
Overview
The SAS/GRAPH software has a variety of type styles that you can use to display
text and special characters in your procedure output. These type styles are stored in
fonts that you can specify when you want to select type for the text on your graphs or
choose plot symbols.
This chapter explains how to specify a font, how to change the default hardware font,
how to produce special characters, and how to select a software font.
After the FONTREG procedure runs, the SASEMF device driver and graphs in the
ODS PDF destination can use FreeType fonts without any modification. However, you
will need to modify the GIF, JPEG, PNG, and TIFFP device drivers before these can
access FreeType fonts. For details about using FreeType fonts, refer to The FONTREG
Procedure.
Note: In some operating environments, you can access the System or TrueType fonts
that are available to the host print driver that is currently set for your printer. For
more information, see the SAS documentation for your operating environment. 4
title to all the text in your output. When the SAS/GRAPH software encounters an
explicit font specification in a SAS statement, it uses the font that you specify rather
than a font that is specified in a GOPTIONS statement or the device’s hardware font.
With SAS/GRAPH you can select existing hardware or software fonts or create your
own font. Hardware fonts are fonts that exist on hardcopy output devices (such as
printers or plotters) or on a computer. PC TrueType and UNIX system fonts are
examples of hardware fonts that exist on computers. Software fonts are the fonts
delivered with SAS. The software fonts are the entries in the SASHELP.FONTS
catalogue. If you do not make a font assignment, in most cases the SAS/GRAPH
software uses the default hardware font for your device.
Note: Java and ActiveX devices do not support software fonts. 4
Font Specifications
A font specification is an argument that takes a font name as its value. Font
specifications typically take the following form:
FONT=font
F=font
where font is a valid SAS name. The specified font can be
3 a software font that is either
3 a catalog entry that is supplied by SAS Institute (for example, CENTB),
or that is user-generated (for example, MYFONT generated by the
GFONT procedure)
3 a system font that is available in your operating environment.
Note: Font names greater than eight characters in length must be
enclosed in quotation marks. 4
To see a list of available software fonts, issue the FONTLIST command
from the SAS command line. See Base SAS Software Help for more
information on the FONTLIST command. The resulting window enables you
to copy a font name into the copy buffer so that you can paste the name into
your SAS program. The window’s Family box lists the software fonts that are
supplied by SAS Institute. Choose the System button to see a list of the
system fonts that are available in your operating environment. Choose the
Help button for help on using the window. See “Font Lists” on page 82 for
more information on the valid font names for Institute-supplied software
fonts.
3 a hardware font that is either in the form of
3 HWxxxnnn
3 hardware-font-name.
See “Specifying Alternative Hardware Fonts” on page 80 for details.
For example, the following statement specifies the Century Bold font in a title:
title font=centb ’This is a Title’;
However, there are other arguments that also take font as a value. For example, the
FTEXT= option in the following GOPTIONS statement specifies the Century Bold font
for all text that does not have a more explicit font specification:
goptions ftext=centb;
SAS/GRAPH Fonts Font Locations 77
Note: In this chapter, the argument FONT= is used to represent any argument that
takes font as its value. 4
Default Fonts
When a font is needed, theSAS/GRAPH software looks first for a font specification in
the statement or procedure that produces the output, and then it looks in the
GOPTIONS statement. If no font specification is found, the SAS/GRAPH software uses
one of the following:
3 for TITLE1 statements, the default font is SWISS.
3 for all other text, the default font is NONE. The NONE font specifies the default
hardware font for the output device.
In some cases, the device’s hardware font cannot be used and the SIMULATE font is
used instead. The SIMULATE font is a software font that simulates the device’s
hardware characters by allowing the same amount of space for the text that the
hardware characters use. The SIMULATE font is used whenever the default hardware
font is unavailable, including the following situations:
3 FONT=NONE or FONT=HWxxxnnn or no font is specified, and one of the
following conditions or sets of conditions is also met:
3 GOPTIONS NOCHARACTERS is specified.
3 The device driver does not support hardware text.
3 You request a hardware font for a different device.
3 You specify an angle or rotation for the characters that the device does not
support.
3 The device does not have scalable hardware characters (that is, hardware
characters can be generated only in the proportions specified with the font),
and one of the following conditions is also met:
3 The values of the HPOS= and VPOS= graphics options do not match the
values displayed in the LCOLS or PCOLS field or the LROWS or
PROWS field in the Detail window of the device entry.
3 The HSIZE= or VSIZE= graphics option is set to values that are not the
default.
3 You replay a graph in a template that is not the same size as the full
size of the graphics output area, or you use a device driver other than
the one you used to create the graph.
3 The target device and the display device have different values for the
HPOS= and VPOS= graphics options.
3 You use any height specification, including the HEIGHT=, HTEXT=,
HTITLE=, and HBY= graphics options, that is not equal to 1.
You should never delete the SIMULATE font from the fonts catalog.
Note: You can change the font that is used as the SIMULATE font with the
SIMFONT= graphics option. If you use the SIMFONT= option, it is better to specify a
uniform font. Do not specify a hardware font as a substitute for SIMULATE. See
“SIMFONT” on page 351 for more information on the SIMFONT= option. 4
Font Locations
SAS/GRAPH software fonts are stored in catalogs. The SAS/GRAPH software looks
only into catalogs with certain librefs and names to find fonts. By default, SAS/GRAPH
78 Using Hardware Fonts Chapter 5
If your device has only one hardware font (this is often the case), the Chartype field
has a value of 0.
In addition, if the font selected with CHARTYPE= is not scalable and if the values of
HPOS= and VPOS= do not match the values of the Rows and Cols fields in the
Chartype window, then the SIMULATE font is substituted.
3 Note the number of the font that you want to use as the default font and go to the
Parameters window.
4 Enter the number of the font in the Chartype field.
5 Close the window and exit the procedure.
Note: If you change the number in the Chartype field in the Parameters window of
the device entry, the change is permanent and remains in effect from one SAS session
to another until you change the entry again. 4
(See Chapter 31, “The GDEVICE Procedure,” on page 915 for information on viewing
device entries and changing device parameters.)
The SAS System allows up to 255 characters for the font name. The font name may
contain spaces. If the font name is longer than 40 characters, PROC GDEVICE in
fullscreen mode only displays the first 37 characters, followed by an ellipsis (...). To see
the complete font name when the name is longer than 40 characters, use PROC
GDEVICE with the NOFS (no fullscreen) option as follows:
proc gdevice c=sashelp.devices nofs;
list driver-name;
run;
quit;
When a font is quoted, the SAS System will first look at the Chartype window of the
device driver entry to see if it is a valid hardware font. If the font is not found in the
Chartype window, the SAS System will then check to see if the quoted font is a valid
SAS/GRAPH software font. If the font is not recognized as either a valid hardware font
or a valid SAS/GRAPH software font, the SIMPLEX font will be used.
xxx are the last two or three characters of the module name in
the Module field in the Detail window of your device entry.
If the module name has eight characters (SASGDPSL, for
example), use the last three characters (PSL). If the
module name has only seven characters (SASGDVT, for
example), use the last two characters (VT).
nnn is the Chartype number of the hardware font that you
want to use as listed in the Chartype window in the
device entry. This value should be a three-digit decimal
number, with leading zeros if necessary.
3 In the font specification, explicitly assign a hardware font using the following form:
hardware-font-name
identifies the name of the hardware font that is listed in the Chartype
window of the device entry. Hardware-font-name must be enclosed in
quotation marks and the maximum length is 256 characters. The specified
font name will be converted internally to the HWxxxnnn name. Note that in
Annotate, the specified font name must be enclosed in both double quotes and
single quotes (see Chapter 25, “Annotate Dictionary,” on page 613 for details).
3 Assign one of the fonts listed in the Chartype window of your device entry as the
default hardware font with the CHARTYPE= graphics option. You can also change
the default hardware font by modifying the value of the Chartype field in the
Parameters window of your device entry. Then you can use FONT=NONE in your
SAS/GRAPH procedure or statement to specify the new default hardware font.
When you specify FONT=HWxxxnnn or hardware-font-name, the size of the
character cells is determined by the values in the Rows and Cols fields in the Chartype
window of the device entry, and the values of the HPOS= and VPOS= options are
ignored for the font. Consequently, the font retains its original proportions. In addition,
with this method the font catalog is checked for proportional spacing information. This
information is used by the software to determine how much space to reserve for
proportional text. See Chapter 8, “Graphics Options and Device Parameters
Dictionary,” on page 261 for additional information.
statement uses hexadecimal 18 to produce £ in the Zapf type style. (This example
assumes a U.S. key map).
title font=zapf ’18’x;
Note: The character code or hexadecimal value associated with any character in any
font is dependent on the key map that is currently being used. 4
In addition, you can use a key map to map selected characters to your keyboard. For
example, if you want to be able to type e directly, you could create a key map that maps
e to the key that usually generates the asterisk (*) and a device map that maps e to
your output device. Then, when you press the * key, although you see * on your display,
e is produced on your graphics device. See Chapter 34, “The GKEYMAP Procedure,” on
page 983 for details.
Rendering Fonts
The SAS/GRAPH software includes methods of storing rendered versions of
Bitstream fonts, along with three graphics options to control how the fonts are rendered.
When your graphics output uses one of the Bitstream fonts that are provided in the
SAS/GRAPH software, SAS/GRAPH must process information contained in
corresponding FONT catalog entries to determine how to draw characters of the
specified size and typeface. The process of calculating the character shapes and sizes is
known as rendering the font. Bitstream fonts that are available in the SAS/GRAPH
software include the Century, Swiss, and Zapf families.
The SAS/GRAPH software can store rendered versions of the Bitstream fonts in
memory or in special SAS files. Using these rendered versions of the fonts can provide
a speed improvement when characters of the same size and style are used again during
the SAS session. The SAS/GRAPH software can read the rendered version of the
characters from memory or from the rendered font file rather than having to perform
the rendering calculations again each time the characters are used. If you store the
rendered fonts in files in a permanent SAS data set, the SAS/GRAPH software can use
the rendered font files again in subsequent SAS sessions.
Note: Because the rendered font files use a special utility member type, they do not
appear in the list of library members that is displayed when you issue a DIRECTORY
command for the SAS data library in which the font files are stored. 4
You control whether and how rendered versions of fonts are stored using the
FONTRES=, RENDER=, and RENDERLIB= graphics options. See Chapter 8,
“Graphics Options and Device Parameters Dictionary,” on page 261 for details.
Font Lists
The fonts available with theSAS/GRAPH software are listed in the following tables.
All of the software fonts are stored in the catalog SASHELP.FONTS. For many fonts,
the last letter or letters of the font name indicates weight or spacing of the font:
B bold (thicker)
E empty (outline) versions of their counterparts
SAS/GRAPH Fonts Font Lists 83
I italic (slanted)
L light (thin)
U uniformly spaced versions of their counterparts; most of the
SAS/GRAPH fonts that do not end in U are proportionately spaced;
however, the Kanji fonts are always uniform.
X expanded (wider characters and extra space between characters).
CAUTION:
Empty and uniform versions of fonts cannot be used if you have deleted their filled or
proportionally spaced counterparts. 4
If the label of a font in SASHELP.FONTS is "Depends on," it is possible to delete it.
However, empty and uniform versions of fonts are generated from their regular, bold, or
italic counterparts. Therefore, if you delete any of these fonts, you cannot use the
uniform or empty version of that font. For example, you must have the CENTB
(Century Bold) font in order to use the CENTBE (Century Bold Empty) font.
84 Font Lists Chapter 5
Uniform Font
Type Style Font Name Name
Arabic ARABIC
David DAVID
Davidb DAVIDB
Hebrew NHEBREW*
Hebrewb HEBREWB
Hebrew Empty HEBREWE
Hiragana NHIRA*
Kanji KANJI
86 Font Lists Chapter 5
Uniform Font
Type Style Font Name Name
Kanji KANSJIS
Kanji Subset
Kanji 1 KAN1
Kanji 2 KAN2
Kanji 3 KAN3
Kanji 4 KAN4
Kanji 5 KAN5
Kanji 6 KAN6
Kanji 7 KAN7
Kanji 8 KAN8
Katakana KATA
Katakana NKATA*
Marker MARKERE
Empty *
Note: Figure 5.5 on page 87 shows the MARKER font. The MARKERE font
produces the same symbols but in empty (outline) form. 4
CHAPTER
6
SAS/GRAPH Colors and Images
SAS/GRAPH software uses these values if you do not explicitly select colors in other
statements. Refer to Chapter 8, “Graphics Options and Device Parameters Dictionary,”
on page 261 for complete information about each of these graphics options.
If you have not explicitly specified a color in a SAS statement or set a default color
for a graphic element in the graphics output, SAS/GRAPH software searches for a
colors list.
The color selected from the colors list varies depending on the procedure using the
color and the graphics element that is being drawn. Usually, the first color in the list is
used; however, certain procedures may select other colors. For example, if the CAXIS=
option is not specified in the GCONTOUR procedure’s PLOT statement, the procedure
selects the second color from the colors list to draw the axes. See the documentation for
an individual procedure for more information.
Each value you specify in a color list must be either a valid color name or a valid color
code. Color names must not exceed 64 characters and color codes must not exceed eight
characters. For an explanation of SAS color names and codes, see “Color-Naming
Schemes” on page 95.
SAS provides, in the SAS Registry, a set of ordinary-language color names that you
can use for colors that are common to most Web browsers. For a list of these names,
showing both the ordinary-language name and its associated RGB value, you can run
the following code and view the output in the Log window:
proc registry list
startat=’COLORNAMES’;
run;
94 Defining and Using a Colors List Chapter 6
You can also modify entries in this list and add your own names and their associated
RGB values. For more information on viewing and modifying the list of color names,
see Using the SAS Registry to Control Color in SAS Language Reference: Concepts.
Note: The COLORS= graphics option only provides a default lookup table. Any time
you explicitly select any other colors in your SAS/GRAPH program, those colors are
used to draw the graphics elements for which you have specified them. 4
For a pen plotter, SAS/GRAPH software uses the order of the colors in the COLORS=
graphics option to define the order of pens for a multiple pen plotter, or to make a pen
plotter prompt you to change the pen when a graph uses more colors than the plotter
has loaded.
The colors from any elements that have a color explicitly specified in your SAS
program are combined to form a color list. This color list is used to assign colors to the
elements that do not have a color explicitly specified. If no colors are explicitly specified,
black will be used. This setting is useful if you want to generate graphics output with
the maximum of 256 colors, and you do not want to use any of the default colors from
the current device driver.
professionally styled graphic output. The ODS styles are available for both bar graphs
and pie charts. For more information on ODS Styles see “Using ODS Styles” on page
488 and SAS Output Delivery System: User’s Guide.
Color-Naming Schemes
The valid color-naming schemes are
3 RGB (red green blue)
3 CMYK (cyan magenta yellow black)
3 HLS (hue lightness saturation)
3 HSV (hue saturation brightness), also called HSB
3 gray scale
3 SAS color names (from the SAS Registry)
3 the SAS Color Naming System (CNS).
For the CMYK color scheme, color specifications must be enclosed in quotation
marks. For the SAS color names and CNS names, quotation marks are required if the
color name contains spaces. In all other instances, quotation marks are optional.
You can freely intermix colors using different color-naming schemes in your
programs. However, depending on your device capabilities, the color that is displayed
may not be the color that you expect. See “Colors and Device Capabilities” on page 103
for information on how to tell if your device supports user-defined colors.
Note: When printed, RGB color values are automatically converted to the CMYK
color values so that the colors display appropriately in the output. 4
Note: You can specify a CMY value by making the kk, the color’s black component,
zero (00). 4
A predefined list of the SAS color names and their accompanying RGB values are
contained in the SAS Registry Editor. The SAS Registry Editor also allows you to add
your own SAS color names. With these colors, you can specify the name itself or the
RGB value associated with that color name.
With CNS, you develop your color value by selecting and combining valid lightness,
saturation, and hue terms. The CNS colors are based on the HLS color model and will
display fairly uniform transitions between color values.
Note: Invalid color values will be replaced by the next valid color value on the
foreground color list. Messages are written to the SAS log detailing the colors
substituted for invalid color values. 4
Table 6.1
White
CNS values should be written in the following order: lightness saturation hue. The
color names may written without space separators between words, with an underscore
to separate words, or with a space to separate words. The following list contains
examples of valid color names:
verylightmoderatepurplishblue
very_light_moderate_purplish_blue
“very light moderate purplish blue”
Color names containing spaces must be enclosed in quotation marks.
Note: The %CNS macro only accepts CNS color names where a space is used to
separate the words in the color name. See Table 6.5 on page 101 for more information 4
If a CNS color name is also a color name in the SAS Registry, the SAS Registry color
value will be used. Some CNS color names and color names in the SAS Registry have
100 Color-Naming Schemes Chapter 6
different color values. To use a CNS color value when the color name is also in the SAS
Registry, place quotes around the color name.
The lightness values black and white should not be used with saturation or hue
values. If not specified, medium is the default lightness value and vivid is the default
saturation value. Gray is the only saturation value that can be used without a hue.
Unless the CNS value is black, white, or some form of gray, at least one hue value must
be used.
One or two hue values can be used in the CNS color name. When using two hue
values, the hues must be adjacent to form a color. The hues are located in the following
circular order: blue, purple, red, orange/brown, yellow, green, and then returning to
blue. When two hues are used, the resulting color is a combination of both colors. Use
the suffix “ish” to reduce the effect of a hue when two hues are combined. For example,
reddish purple is less red than red purple. If you are using a color with an “ish” suffix,
this color must precede the color without the “ish” suffix.
Use... To...
%HELPCLR; List the color utility macro names.
When the color utility macros are invoked, the calculated color value can be directed
to the SAS log or perform in-place substitutions in the code. The following tables list
and describe the color utility macros and provide an usage example of each macro:
Replace cyan, magenta, yellow, black with numeric values Entering the following code into your
to create a CMYK color value. The numeric values that are Program Editor:
used in place of cyan, magenta, yellow, black indicate the %COLORMAC;
percentage (0 to 100) of each of these colors to be included data _null_;
in the CMYK color value. See “CMYK Color Codes” on put %CMYK(0,46,16,31);
run;
page 96 for more information on the color value produced
by using this macro. Returns the CMYK value 0075294F
which is purple.
Note: In the PUT statement, %CMYK(cyan, magenta, yellow, black), should not be
placed in quotations. 4
Replace hue, lightness, saturation with numeric values to Entering the following code into your
create a HLS color value. Hue should be replaced with any Program Editor:
value from 0 to 360. Lightness and saturation indicate a %COLORMAC;
percentage (0 to 100) to be included in the HLS color value. data _null_;
See “HLS Color Codes” on page 97 for more information. put ‘‘%HLS(0,50,100)’’;
run;
Returns the HLS value H00080FF
which is blue.
102 Color-Naming Schemes Chapter 6
Replace hue, saturation, value with numeric values to Entering the following code into your
create a HLS value from HSV components. Hue should be Program Editor:
replaced with any value from 0 to 360. Saturation and %COLORMAC;
value (brightness) indicate a percentage (0 to 100) to be data _null_;
included in the HLS color value. See “HSV (or HSB) Color put ‘‘%HSV(0,100,75)’’;
run;
Codes” on page 98 and “HLS Color Codes” on page 97 for
more information. Returns the HSV value V000FFBF
which is dark red.
Replace hls with a HLS color value to create a RGB color Entering the following code into your
value. See “HLS Color Codes” on page 97 and “RGB Color Program Editor:
Codes” on page 95 for more information. %COLORMAC;
data _null_;
put ‘‘%HLS2RGB(H04B8040)’’;
run;
Returns the RGB value CX9F5F8F
which is grayish reddish purple.
SAS/GRAPH Colors and Images Colors and Device Capabilities 103
Note: Round-trip conversions using HLS2RGB and then RGB2HLS macros or vice
versa, may produce ultimate output values that differ from the initial input values. For
example, converting CXABCDEF (a light blue) using %RGB2HLS (CXABCDEF)
produces H14ACDAD. Converting this value back to RGB using %HLS2RGB
(H14ACDAD) returns CXAACCEE. While not identical, the three colors are very
similar on the display and when printed. 4
For additional information on color-naming schemes, see Effective Color Displays:
Theory and Practice by David Travis and Computer Graphics: Principles and Practice
by Foley, van Dam, Feiner, and Hughes.
list. Some devices try to match the user-defined color with the closest color in the
device’s color palette. Others merely remap the color to the next available color in the
device’s color palette. To avoid having colors remapped, use the colors in your device’s
default colors list.
Pen Plotters
The colors you can use with a pen plotter are determined by your set of pens. You
specify the color names in the GOPTIONS statement’s COLORS= option, then place
pens with those color names in the plotter when the following message appears (the
message does not appear if you specify the NOPROMPT graphics option):
Please mount the following pens: . . .
By default, SAS/GRAPH software tries to keep a standard set of pens in the plotter’s
carousel. If colors in the standard set of pens are named in the COLORS= graphics
option, a mount request is issued for the entire standard set, even if all of them are not
used in the output. This minimizes the number of times pens must be reshuffled as a
graph is being drawn. If GOPTIONS COLORS=(NONE) is used, you are only prompted
to mount pens for the colors that are actually used in the output.
Note: You can specify any valid SAS name for a color when using a pen plotter. It
does not have to be a predefined or user-defined color name. For example, you can
specify COLOR=PEN3, and you will be prompted to mount PEN3 or SAS/GRAPH
software will assume a pen of that color is in the appropriate slot. This feature is often
helpful if you are using transparency pens or other special pens. 4
Limitations
Using colors in SAS/GRAPH software is limited by the number of colors that you can
use in one graph and by the capabilities of your device. The following sections discuss
these limitations.
Maximum Number of Colors Displayable in SAS/GRAPH Software
You can use a maximum of 256 unique colors on each graph, including the
background color (specified with the CBACK= graphics option or the CBACK device
parameter). If you use more than 256 unique names in a program, SAS/GRAPH
software issues a warning and remaps the 257th and any subsequent colors to
existing color names, beginning with the first color name in the existing color list.
Note: If you specify a color using two different color-naming schemes for the
same graph (for example, WHITE and RGB white, CXFFFFFF), SAS/GRAPH
software counts them as two color specifications out of the 256 colors that you are
allowed to use on one graph. 4
Maximum Number of Colors Displayable on a Device
The number of colors that you can display is limited by the type of graphics output
device that you have. If you generate a graph with more colors than the device can
SAS/GRAPH Colors and Images Colors and Device Capabilities 105
display, the colors that cannot be displayed are mapped to an existing color. You
may also receive a note in the SAS log telling you when a color is mapped to
another color in the colors list and what color will be used instead.
Although your device may support 256 colors, it may not let you use all of them
at once. The MAXCOLORS device parameter tells SAS/GRAPH software the
maximum number of colors that can be displayed at one time. MAXCOLORS is
the number of foreground colors plus the background color and has a range of two
to 256. If you use more than the number of colors set by the MAXCOLORS device
parameter, the excess colors are remapped.
Note: The MAXCOLORS device parameter defaults to the number of
displayable colors on the basic model of each graphics device supported. If your
graphics device can display more colors than the base model, use the
PENMOUNTS= graphics option to specify the number of colors that can be
displayed. Optionally, you can use PROC GDEVICE to modify the value of the
MAXCOLORS device parameter. 4
For pen plotters, you use the PENMOUNTS= graphics option to indicate the
number of pen holders on the plotter. PENMOUNTS is the number of foreground
colors and has a range of one to 255. PENMOUNTS does not include the
background color. Using this graphics option does not limit the number of colors
that you can specify for a graph that is produced on a pen plotter. If you use more
colors than the plotter has pen holders, you will be prompted to change pens
unless you have also specified the NOPROMPT graphics option.
Replaying Graphs on a Device That Displays Fewer Colors
You can use the GREPLAY Procedure to display graphs previously generated.
Sometimes you may need to replay the graphs on a device that cannot display as
many colors as the device on which the graph was originally developed. Use
“CMAP” on page 270 to control some of the remapping.
When you replay graphs on devices that display fewer colors than are in the
graph, two situations may cause problems:
3 Colors are specified that the device does not support.
3 More colors are specified than the device can display at one time.
If you specify colors on a device that does not support those colors, the colors are
remapped to those available for that device. You may also receive a note in the
SAS log telling you when a color is mapped to another color in the colors list and
what the new color is.
The number of colors that your device can display affects the actual color
displayed. If your graphics output device can generate a maximum of 64 distinct
colors and your graph contains 256 colors, the 65th through the 256th color
specifications are remapped to the device’s available colors and may not display as
the color you specify.
You can use the TARGETDEVICE= graphics option to preview the way a graph
is going to look on a different device. You set this graphics option to the device
entry name of the device driver that will be used later. The graph is displayed as
close as possible to the way it will display when the other device is used.
Note: When you use the TARGETDEVICE= graphics option, SAS/GRAPH
software uses the colors list of the target device as the default colors list; any color
that you explicitly use is displayed when you preview the graph, although the
target device may cause the color to be mapped. Refer to “TARGETDEVICE” on
page 355 for complete information about the TARGETDEVICE= graphics option. 4
Trueness of Color Displayed on a Device
The size of the color palette in your device determines the trueness of the color
that is actually produced. For example, a device with a palette of 64 colors can
106 Specifying Images in SAS/GRAPH Programs Chapter 6
only produce colors that contain a combination of four shades of red (including no
red), four shades of green (including no green), and four shades of blue (including
no blue). Consequently, ranges of color will be remapped to available colors. For
example, color specifications CX008080, CX258080, and CX3F8080 will all look the
same (no red). CX408080 through CX7F8080 will look redder; CX808080 through
CXBF0000, redder still; and CXC08080 through CXFF8080, the reddest. Larger
palettes have more color resolution but may not have more simultaneous colors.
CAT (SAS Catalog IMAGE entry) supports color-mapped images as well as true
color images. The images can be optionally
compressed.
DIB (Microsoft Windows Device Independent see the description of BMP.
Bitmap)
EMF (Microsoft NT Enhanced Metafile) supported under Windows 95, Windows 98,
Windows 2000, and Windows NT.
JPEG (Joint Photographic Experts Group) supports compression of images with the use of
JPEG File Interchange Format (JFIF) software.
JFIF software is developed by the Independent
Joint Photographic Experts Group.
PBM (Portable Bitmap Utilities) supports gray, color, RGB, and bitmap files. The
Portable Bitmap Utilities is a set of free utility
programs that were primarily developed by Jeff
Poskanzer.
SAS/GRAPH Colors and Images Reading and Writing Image File Types 107
PS (PostScript Image File Format) the Image classes use only PostScript image
operators. A level II PS printer is required for
color images. PostScript was developed by
Adobe Systems, Inc.
TGA (Targa) supports both true color images and
color-mapped images; however, the current
release of the Image classes supports only true
color TGA files. Targa is owned by Truevision,
Inc.
TIFF (Tagged Image File Format) internally supports a number of compression
types and image types, including bitmap,
color-map, gray-scale, and true color. TIFF was
developed by Aldus Corporation and Microsoft
Corporation and is used by a wide variety of
applications.
BMP FORMAT=BMP
COMPRESS=NONE is the default. Sets compression to
COMPRESS=RLE run-length encoded.
CAT FORMAT=CAT
PBM FORMAT=PBM
PCD FORMAT=PCD specifies photo CD format. FORMAT=PCD
RES= specifies the image resolution to be
read. Photo CD images have multiple
resolution images in each image. Values
are:
BASE/64 64x96
BASE/16 128x192
BASE/4 256x384
4BASE 1024x1536
16BASE 2048x3072.
TGA FORMAT=TGA
TIFF FORMAT=TIFF
XBM FORMAT=XBM
110 Reading and Writing Image File Types Chapter 6
XWD FORMAT=XWD
BMP FORMAT=BMP
CAT FORMAT=CAT
PBM FORMAT=PBM
COMPRESS=NONE creates a text PBM file.
PCL FORMAT=PCL
DPI=num specifies the number of dots per inch to use
to calculate the visual size of the image on
the PostScript page in the output file. The
default is 300. For example, a 600-pixel by
600-pixel image appears as a 2-inch by
2-inch image on the PostScript page if you
use the default setting.
PNG FORMAT=PNG
PS FORMAT=PS
TIFF FORMAT=TIFF
COMPRESS=NONE is the default
SAS/GRAPH Colors and Images Placing a Background Image 113
“Image File Types Supported by SAS/GRAPH” on page 106 shows the image file
formats that you can use. “Disabling and Enabling Image Output” on page 120 shows
how to suppress the image output without removing the imaging code from your
114 Placing a Background Image Chapter 6
SAS/GRAPH program; for example, you might want to suppress the image when
printing the graph.
By default, the image is tiled on the background, which means that the image is
copied as many times as needed to fill the background area. You can specify
IMAGESTYLE=FIT on the GOPTIONS statement to stretch the image so that a single
image fits within the entire background area:
goptions iback=’external-image-file’
imagestyle=fit;
After fitting the image, you can tile subsequent images by resetting the GOPTIONS
statement or by specifying IMAGESTYLE=TILE. The following graphs illustrate the
use of tiled versus stretched images.
The following example displays an image behind a pie chart. Because the
IMAGESTYLE option is not used, the image is tiled in the background area.
goptions reset=all ctitle=cx90d0d9 ftitle=swissb
ctext=white htext=0.85 htitle=2.5 ftext=swissb
colors=(cx00cccc cxcd0369 cx5b768d
cx594f4a cx008080 cxff8f71)
iback=’external-image-file’;
title ’Projected Automobile Sales’;
data sales;
length month $ 9;
input month amount;
datalines;
January 200
February 145
March 220
April 180
May 155
June 250
;
proc gchart;
pie month / freq=amount value=inside
noheading coutline=black;
run;
quit;
The preceding program generates the following graph, which illustrates the tiling of
an image to fill an area.
SAS/GRAPH Colors and Images Placing a Backplane Image on Graphs with Frames 115
“Image File Types Supported by SAS/GRAPH” on page 106 shows the image file
formats that you can use. “Disabling and Enabling Image Output” on page 120 shows
how to suppress the image output without removing the imaging code from your
116 Placing Images on the Bars of Two-Dimensional Bar Charts Chapter 6
SAS/GRAPH program; for example, you might want to suppress the image when
printing the graph.
By default, the image is tiled on the backplane, which means that the image is copied
as many times as needed to fill the backplane.
To stretch a single instance of the image to fill the backplane, specify
IMAGESTYLE=FIT as follows:
iframe=fileref | ’external-image-file’
imagestyle=fit;
To switch from a single fitted image back to a series of tiled images, you can specify
IMAGESTYLE=TILE.
The following example displays an image on the backplane of a horizontal bar chart.
Because the IMAGESTYLE= option is not used, the image is tiled by default.
goptions reset=all ctitle=cx000080 ftitle=swissb
ctext=black htext=0.85 htitle=2.5 ftext=swissb
cback=cxf7e1c2;
title ’Projected Automobile Sales’;
data sales;
length month $ 9;
input month amount;
datalines;
January 200
February 145
March 220
April 180
May 155
June 250
;
pattern1 value=solid color=cxcd0369;
axis1 width=1.5 major=(width=1.5)
label=( h=1 ’Number of Cars’) noplane;
axis2 width=1.5 major=(width=1.5)
label=( h=1 ’Month’) noplane;
proc gchart;
hbar3d month / freq=amount
nostats
axis=axis1
maxis=axis2
iframe=’external-image-file’
coutline=black;
run;
quit;
“Image File Types Supported by SAS/GRAPH” on page 106 shows the image file
formats that you can use. “Disabling and Enabling Image Output” on page 120 shows
how to suppress the image output without removing the imaging code from your
SAS/GRAPH program; for example, you might want to suppress the image when
printing the graph.
By default, the image is tiled on the bar, which means that the image is copied as
many times as needed to fill the bar area. You can specify IMAGESTYLE=FIT on the
PATTERN statement to stretch a single instance of the image to fit the dimensions of
the bar, as follows:
pattern image=’external-image-file’
imagestyle=fit;
After fitting the image, you can tile subsequent images by resetting the PATTERN
statement or by specifying IMAGESTYLE=TILE.
Note: Images are only supported on the bars that are generated by the HBAR and
VBAR statements. If an image is specified on a PATTERN statement that is used with
another type of chart, then the PATTERN statement is ignored and default pattern
rotation is affected. For example, if you submit a PIE statement when an image has
been specified on PATTERN, the default fill pattern is used for the pie slices; however,
rather than rotating that pattern through the colors list, each slice in the pie displays
the fill pattern in the same color. 4
The following example generates a bar chart that shows the sales for different
automobile manufacturers. The bars that represent the sales figures for each
manufacturer display a model vehicle for that manufacturer. Because
IMAGESTYLE=FIT is not specified, each image is tiled on the bar that displays it.
goptions reset=all ctitle=cx000080 ftitle=swissb
ctext=black htext=0.85 htitle=2.5
ftext=swissb cback=cxf7e1c2;
title ’Projected Automobile Sales’;
data sales;
length Month $ 9 Manufacturer $ 10;
input Month amount Manufacturer;
datalines;
January 100 Nissan
February 80 Nissan
March 210 Nissan
April 201 Nissan
January 400 Dodge
February 90 Dodge
March 220 Dodge
April 202 Dodge
January 300 Cheverolet
February 70 Cheverolet
March 230 Cheverolet
April 203 Cheverolet
January 200 Ford
February 100 Ford
March 240 Ford
April 204 Ford
;
run;
pattern1 image=’external-image-file’; /* corvette image */
pattern2 image=’external-image-file’; /* viper image */
118 Using Annotate to Display an Image Chapter 6
proc gchart;
vbar month / freq=amount
coutline=black
subgroup=Manufacturer
axis=axis1
cframe=olive;
run;
quit;
The code above displays the image in the screen coordinates (20, 20) to (40, 40). The
last parameter indicates how to display the image. The following keywords are
available:
fit fits the image within the specified area. This stretches the image, if
necessary.
120 Disabling and Enabling Image Output Chapter 6
tile tiles the image within the specified area. This copies the image as
many times as needed to fit the area.
“Image File Types Supported by SAS/GRAPH” on page 106 shows the image file
formats that you can use. “Disabling and Enabling Image Output” on page 120 shows
how to suppress the image output without removing the imaging code from your
SAS/GRAPH program; for example, you might want to suppress the image when
printing the graph.
Here is a complete example:
goptions reset=all;
title ’DGSI with image’;
footnote ’ dsgi with image option’;
data image;
rc=ginit();
rc=graph(’clear’);
rc=gdraw(’image’,’external-image-file’,
5, 5, 90, 90,’fit’);
rc=graph(’update’);
rc=gterm();
run;
quit;
NOIMAGEPRINT can be useful for printing output without images. To enable image
output, reset the GOPTIONS statement or specify the IMAGEPRINT graphics option.
121
CHAPTER
7
SAS/GRAPH Statements
Overview 123
AXIS Statement 124
Description 124
Syntax 125
Options 126
Text Description Suboptions 135
Using Text Description Suboptions 139
Tick Mark Description Suboptions 139
Using the AXIS Statement 140
Assigning AXIS Definitions 140
BY Statement 141
Description 141
Syntax 141
Required Arguments 142
Options 142
Preparing Data for BY-Group Processing 142
Controlling BY Lines 143
Suppressing the BY line 143
Suppressing the name of the BY variable 143
Controlling the appearance of the BY line 143
Naming the Catalog Entries 143
Using the BY Statement 143
With the GCHART Procedure 144
With the GMAP Procedure 144
With the GPLOT Procedure 144
With the RUN Groups 144
With the Annotate Facility 145
With TITLE, FOOTNOTE, and NOTE Statements 145
With PATTERN and SYMBOL Definitions 145
FOOTNOTE Statement 146
GOPTIONS Statement 146
Description 146
Syntax 146
Options 150
Using the GOPTIONS Statement 150
Graphics Option Processing 150
LEGEND Statement 151
Description 151
Syntax 151
Options 152
Text Description Suboptions 158
122 Contents Chapter 7
Overview
SAS/GRAPH programs can use some of the SAS language statements that you
typically use with the base SAS procedures or with the DATA step, such as LABEL,
WHERE, and FORMAT. These statements are described in the SAS Language
Reference: Dictionary.
In addition, SAS/GRAPH has its own set of statements that affect only graphics
output generated by the SAS/GRAPH procedures and the graphics facilities Annotate
and DSGI. Most of these statements are global statements. That is, they can be
specified anywhere in your program and remain in effect until explicitly changed or
canceled. These are the SAS/PH global statements:
AXIS
modifies the appearance, position, and range of values of axes in charts and plots.
FOOTNOTE
adds footnotes to graphics output. This statement is like the TITLE statement and
is described in that section.
GOPTIONS
submits graphics options that control the appearance of graphics elements by
specifying characteristics such as default colors, fill patterns, fonts, or text height.
Graphics options can also temporarily change device settings.
124 AXIS Statement Chapter 7
LEGEND
modifies the appearance and position of legends generated by procedures that
produce charts, plots, and maps.
NOTE
adds text to the graphics output. This statement is an exception because it is not
global but local, meaning that it must be submitted within a procedure.
Otherwise, NOTE is like the TITLE statement and is described in that section.
PATTERN
controls the color and fill of patterns assigned to areas in charts, maps, and plots.
SYMBOL
specifies the shape and color of plot symbols as well the interpolation method for
plot data. It also controls the appearance of lines in contour plots.
TITLE
add titles to graphics output. The section describing the TITLE statement includes
the FOOTNOTE and NOTE statements.
These statements are described in this chapter, which also includes two Base
language statements that have a special effect when used with SAS/GRAPH procedures:
BY
processes data according to the values of a classification (BY) variable and
produces a separate graph for each BY-group value.
ODS HTML
generates one or more files written in Hyper Text Markup Language (HTML). If
you use it with SAS/GRAPH procedures, you can specify one of the device drivers
GIF, ACTIVEX, or JAVA (ACTIVEX and JAVA are only available with GCHART,
GCONTOUR, GMAP, GPLOT, and G3D). With the GIF device driver, the graphics
output is stored in GIF files. With the ACTIVEX device driver, graphics output is
stored as XML input to ActiveX controls. With the JAVA device driver, graphics
output is stored as XML input to Java applets. The HTML files that are generated
reference the graphics output. When viewed with a Web browser, the HTML files
can display graphics and non-graphics output together on the same Web page.
AXIS Statement
The AXIS statement controls the location, values, and appearance of the axes in plots
and charts.
Used by:
GBARLINE, GCHART, GCONTOUR, GPLOT, and GRADAR procedures
Global
Description
AXIS statements specify the characteristics of an axis, including:
3 the way the axis is scaled
3 how the data values are ordered
3 the location and appearance of the axis line and the tick marks
3 the text and appearance of the axis label and major tick mark values.
AXIS definitions are used only when they are explicitly assigned by an option in a
procedure that produces graphs with axes.
SAS/GRAPH Statements AXIS Statement 125
Figure 7.1 on page 125 illustrates the terms associated with the various parts of axes.
Syntax
AXIS<1...99>< options>;
option(s) can be one or more options from any or all of the following categories:
3 axis scale options:
INTERVAL=EVEN | UNEVEN | PARTIAL
LOGBASE=base | E | PI
LOGSTYLE=EXPAND | POWER
ORDER=(value-list)
3 appearance options:
COLOR=axis-color
LENGTH=axis-length <units >
NOBRACKETS
126 AXIS Statement Chapter 7
NOPLANE
OFFSET=(<n1 ><,n2 >)<units > | (<n1<units>><,n2<units >>)
ORIGIN=<(x><,y >)<units> | (<x<units >><,y<units>>)
STYLE=line-type
WIDTH=thickness-factor
3 tick mark options:
MAJOR=(tick-mark-suboption(s) )| NONE
MINOR=(tick-mark-suboption(s) )| NONE
3 text options:
LABEL=(text-argument(s) )| NONE
REFLABEL=(text-argument(s) )| NONE
SPLIT="split-char"
VALUE=(text-argument(s) )| NONE
Options
When the syntax of an option includes units, use one of these:
CELLS character cells
CM centimeters
IN inches
PCT percentage of the graphics output area
PT points
If you omit units, a unit specification is searched for in this order:
1 GUNIT= in a GOPTIONS statement
2 the default unit, CELLS.
COLOR=axis-color
C=axis-color
specifies the color for all axis components (the axis line, all tick marks, and all
text) unless you include a more explicit AXIS statement color specification. Any of
these color specifications override COLOR= for the specified item:
Table 7.1
calling procedure: all axis text (AXIS label and major tick mark
CTEXT= value descriptions)
CAXIS= axis line and major and minor tick marks
If you omit all color options, the AXIS statement looks for a color specification
in this order:
SAS/GRAPH Statements AXIS Statement 127
LOGBASE=base | E | PI
scales the axis values logarithmically according to the value specified. Base must
be greater than 1. How the values are displayed on the axis depends on the
LOGSTYLE= option. For example, LOGBASE=E with the default
LOGSTYLE=EXPAND generates an axis like the one in Figure 7.2 on page 128.
128 AXIS Statement Chapter 7
NUM
e ** 4
e ** 3
e ** 2
e ** 1
e ** 0
10000 4
1000 3
100 2
10 1
a. b.
If you use ORDER= with a logarithmic axis, the values specified by ORDER=
must match the style specified by LOGSTYLE=. For example, if you specify a
logarithmic axis with a base of 2 and you want to display the first five expanded
values, use this statement:
SAS/GRAPH Statements AXIS Statement 129
If the values that are specified by ORDER= do not match the type of values
specified by LOGSTYLE=, the request for a logarithmic axis is ignored.
This option is not supported by the GRADAR Procedure.
Featured in: “Example 2. Specifying Logarithmic Axes” on page 229 .
Not supported by: Java
MAJOR=(tick-mark-suboption(s) )| NONE
modifies the major tick marks. Tick-mark-suboption(s) defines the color, size, and
number of the major tick marks. NONE suppresses all major tick marks, although
the values represented by those tick marks are still displayed.
Tick-mark-suboption can be
COLOR=tick-color
HEIGHT=tick-height <units >
NUMBER=number-of-ticks
WIDTH=thickness-factor
See “Tick Mark Description Suboptions” on page 139 for complete descriptions.
List all suboptions and their values within the parentheses.
AXIS definitions assigned to the group axis of a bar chart by the GAXIS= option
ignore MAJOR= because the axis does not use tick marks.
Note: By default, tickmarks are now placed at three intervals on the spokes of
a GRADAR chart. They are placed at the minimum value, maximum value, and at
one value in between. The tick marks on the 12 o’clock spoke are also labeled by
default.
HEIGHT is not supported by Java or ActiveX. WIDTH is not supported by
Java. 4
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226 , “Example 2. Specifying Logarithmic Axes” on page 229, and
“Example 7. Using BY-group Processing to Generate a Series of Charts” on page
240.
Not supported by: Java (partial), ActiveX (partial).
MINOR=(tick-mark-suboption(s) )| NONE
modifies the minor tick marks that appear between major tick marks.
Tick-mark-suboption(s) defines the color, number, or size of the minor tick marks.
NONE suppresses all minor tick marks. Tick-mark-suboption can be
COLOR=tick-color
HEIGHT=tick-height <units >
NUMBER=number-of-ticks
WIDTH=thickness-factor
See “Tick Mark Description Suboptions” on page 139 for complete descriptions.
List all suboptions and their values within the parentheses.
AXIS definitions assigned to the group axis of a bar chart by the GAXIS= option
ignore MINOR= because the axis does not use tick marks.
This option is not supported by the GRADAR Procedure.
HEIGHT is not supported by Java or ActiveX.
130 AXIS Statement Chapter 7
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226, “Example 2. Specifying Logarithmic Axes” on page 229, and
“Example 7. Using BY-group Processing to Generate a Series of Charts” on page
240.
Not supported by: Java (partial), ActiveX (partial)
NOBRACKETS
suppresses the printing of group brackets drawn around the values on the group
axis in a bar chart. NOBRACKETS applies only to the group axis of bar charts.
This option is not supported by the GRADAR Procedure.
See also: GROUP= on page 805 and GAXIS= on page 805.
Not supported by: Java, ActiveX
NOPLANE
removes either the horizontal or vertical 3D axis plane in bar charts produced by
the HBAR3D and VBAR3D statements. NOPLANE affects only the axis to which
the AXIS statement applies.
To remove selected axis elements such as lines, values or labels, use specific
AXIS statement options. To remove all axis elements except the 3D planes use the
NOAXIS option in the procedure. To remove the backplane, use the NOFRAME
option in the procedure.
This option is not supported by the GRADAR Procedure.
Featured in: “Example 7. Using BY-group Processing to Generate a Series of
Charts” on page 240.
OFFSET=(<n1><,n2>)<units > | (<n1<units>><,n2<units>>)
specifies the distance from the first and last major tick marks or bars to the ends
of the axis line.
The value of (n1 )is the distance from the beginning (origin) of the axis line to
the first tick mark or middle of the first bar, and the value of (n2 )is the distance
from the end of the axis line to the last tick mark or middle of the last bar.
On a horizontal axis, the (n1) offset is measured from the left end of the axis
line and the (n2) offset is measured from the right end. On a vertical axis, the (n1)
offset is measured up from the bottom of the axis line and the (n2) offset is
measured down from the top of the line.
To specify the same offset for both n1 and n2, use one value, with or without a
following comma. For example, either option sets both n1 and n2 to 4 centimeters:
offset=(4 cm)
offset=(4 cm,)
To specify different offsets, use two values, with or without a comma separating
them. For example,
offset=(4 cm, 2 cm)
To specify only the second offset, use only one value preceded by a comma. This
option offsets the last major tick mark or bar 3 centimeters from the right-hand
end of the axis line:
offset=(,3 cm)
You can specify units for the n1,n2 pair or for the individual offset values.
This option is not by the GRADAR Procedure .
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226.
Not supported by: Java
ORDER=(value-list )
SAS/GRAPH Statements AXIS Statement 131
specifies the order in which data values appear on the axis. The values specified
by ORDER= are the major tick mark values. You can modify the appearance of
these values with the VALUE= option.
The way you specify value-list depends on the type of variable:
3 For numeric variables, value-list is either an explicit list of values or a
starting and an ending value with an interval increment, or a combination of
both forms:
n <...n>
n TO n <BY increment>
n<...n> TO n <BY increment > <n <...n > >
If a numeric variable has an associated format, the specified values must
be the unformatted values.
Values must be listed in either ascending or descending order. By default
the increment value is 1. You can use a negative integer for increment to
specify a value list in descending order. In all forms, multiple n values can be
separated by blanks or commas. Here are some examples:
order=(2 4 6)
order=(6,4,2)
order=(2 to 10 by 2)
order=(50 to 10 by -5)
If the specified range is not evenly divisible by the increment value, the
highest value displayed on the axis is the last incremental value below the
ending value for the range. For example, this value list produces a maximum
axis value of 9:
order=(0 to 10 by 3)
With SAS date and time values, use a FORMAT statement so that the tick
mark values have an understandable form. For more information on SAS
date and time values, see the SAS Language Reference: Dictionary.
With any type of value-list, specifying values that are not distributed uniformly
or are not in ascending or descending order, generates a warning message in the
SAS log. The specified values are spaced evenly along the axis even if the values
are not distributed uniformly.
Using ORDER= to restrict the values displayed on the axis may result in
clipping. For example, if the data range is 1 to 10 and you specify ORDER=(3 TO
5), only the data values from 3 to 5 appear on the plot or chart. For charts, the
omitted values are still included in the statistic calculation.
Note: Values out of range do not always produce a warning message in the
SAS log. 4
CAUTION:
The ORDER= option does not calculate midpoint values; as a result it is not
interchangeable with the MIDPOINTS= option in the GCHART procedure. 4
You can use ORDER= to specify the order in which the midpoints are displayed
on a chart, but do not use it to calculate midpoint values. Be sure that the values
you specify match the midpoint values that are calculated either by default by the
GCHART procedure or by the MIDPOINTS= option. For details, see the
description of MIDPOINTS= for the appropriate statement in Chapter 29, “The
GCHART Procedure,” on page 773.
ORDER= overrides the suboption NUMBER= described in “Tick Mark
Description Suboptions” on page 139.
ORDER= is not valid with the ASCENDING, DESCENDING and NOZEROS
options used with the bar chart statements in the GCHART procedure.
This option is not supported by the GRADAR procedure.
Note: The Java applet supports ORDER= for numeric axes, but does not
support ORDER= for categorical, character, midpoint, or group axes.
The ActiveX control supports only simple order lists. Non-uniform interval
values, such as dates, are not supported. Only max and min values are supported
with a default interval of one day. 4
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226, “Example 5. Filling the Area between Plot Lines” on page 236, and
“Example 7. Using BY-group Processing to Generate a Series of Charts” on page
240
SAS/GRAPH Statements AXIS Statement 133
If you specify two values, with or without a comma separating them, the first
value sets the x coordinate and the second value sets the y coordinate, as in this
example:
origin=(2 pct, 4 pct)
If you specify one value preceded by a comma, only the y coordinate is set to
that value, as shown here:
origin=(,3 pct)
You can specify units for the x,y pair or for the individual coordinates.
This option is not supported by the GRADAR Procedure.
Not supported by: Java, ActiveX
REFLABEL=(text-argument(s)) | NONE
creates and defines the appearance of a reference-line label. Text-argument(s)
defines the appearance or the text of the label, or both. NONE suppresses the
reference-line label. Text-argument(s) can be one or more of these:
’text-string’
provides up to 256 characters of label text. By default, a reference line does
not have a label. Enclose each string in quotes. Separate multiple strings
with blank spaces; the strings are applied to the reference lines consecutively
along the axis, from the plot origin to the end of the axis.
text-description-suboption
modifies a characteristic such as the font, color, or size of the text string(s)
that follows it. Text-description-suboption can be
ANGLE=degrees
AUTOREF
COLOR=text-color
FONT=font | NONE
HEIGHT=text-height <units >
JUSTIFY=LEFT | CENTER | RIGHT
POSITION=TOP| MIDDLE| BOTTOM
ROTATE=degrees
T=n
See “Text Description Suboptions” on page 135 for a complete description.
Specify as many text strings and text description suboptions as you want, but
enclose them all in one set of parentheses.
REFLABEL is not supported by the GRADAR Procedure.
Not supported by: Java, ActiveX.
134 AXIS Statement Chapter 7
SPLIT="split-char"
specifies the split character that the AXIS statement uses to break axis values into
multiple lines. Split-char can be any character value that can be specified in a SAS
character variable. The split character must be embedded in the variable values in
the data set or in an associated format. When the AXIS statement encounters the
split character, it automatically breaks the value at that point and continues on
the next line. For example, suppose the data set contains the value Berlin,
Germany, and you specify SPLIT=",". The value would appear on the axis as
Berlin
Germany
The value will appear on the axis on one line as December, 1999. However,
any other axis values containing a comma would honor the split character.
This option is not supported by the GRADAR Procedure.
Featured in: Example 7 on page 856
Not supported by: Java, ActiveX
STYLE=line-type
specifies a line type for the axis line. Valid values for line-type are 0 through 46. If
you specify STYLE=0, the axis line is not drawn. The default is 1, a solid line.
Note: In order for the axis line to be altered by the STYLE= option, the
NOFRAME option must also be set. If only the STYLE=option is set, the axis
frame will be modified.
Note: This option overrides the LineStyle attribute in graph styles. For more
information on graph styles, see SAS Output Delivery System: User’s Guide . 4
4
Note: See also: Figure 7.22 on page 208 for examples of the available line
types. 4
VALUE=(text-argument(s) )| NONE
modifies the major tick mark values. That is, this option modifies the text that
labels the major tick marks on the axis. Text-argument(s) defines the appearance
or the text of a major tick mark value, or both. NONE suppresses the major tick
mark values, although the major tick marks are still displayed. Text-argument(s)
can be one or more of these:
’text-string’
provides up to 256 characters of text for the major tick mark value. By
default, the value is either the variable value or an associated format value.
Enclose each string in quotes and separate multiple strings with blanks.
Specified text strings are assigned to major tick marks in order. If you
specify only one text string, only the first tick mark value changes, and all
the other tick mark values display the default. If you specify multiple strings,
the first string is the value of the first major tick mark, the second string is
the value of the second major tick mark, and so forth. For example, to change
default tick mark values 1, 2, and 3 to First, Second, and Third, use this
option:
value=(’First’ ’Second’ ’Third’)
SAS/GRAPH Statements AXIS Statement 135
Note: Although VALUE= changes the text displayed at a major tick mark,
it does not affect the actual value represented by the tick mark. To change
the tick mark values, use ORDER=. Also note that with client-side rendering
using Java or ActiveX, it is necessary to use ORDER= to ensure that the
same number of tick marks are displayed as with server-rendered graphics.
For example, specify ORDER=(1 to 12) to ensure that tick marks for all
twelve months are displayed on the client.
To change the value of midpoints in bar charts produced with the
GCHART procedure, use the MIDPOINTS= option in the procedure. 4
text-description-suboption
modifies a characteristic such as the font, color, or size of the text string(s)
that follows it. Text-description-suboption can be
ANGLE=degrees
COLOR=text-color
FONT=font | NONE
HEIGHT=text-height <units >
JUSTIFY=LEFT | CENTER | RIGHT
ROTATE=degrees
TICK=n.
For a complete description, see “Text Description Suboptions” on page 135.
Place text description suboptions before the text strings they modify.
Suboptions not followed by a text string affect the default values. To specify
and describe the text for individual values or to produce multi-line text, use
the TICK= suboption.
Specify as many text strings and text description suboptions as you want, but
enclose them all in one set of parentheses.
Note: If an end-user viewing a graph in the Java applet or ActiveX control
zooms in on a particular part of a graph for which VALUE= is specified, the values
are not readjusted in coordination with the zooming. 4
Featured in: “Example 2. Specifying Logarithmic Axes” on page 229, “Example
7. Using BY-group Processing to Generate a Series of Charts” on page 240, and
“Example 9. Combining Graphs and Reports in a Web Page” on page 248.
Not supported by: Java (partial), ActiveX (partial)
WIDTH=thickness-factor
specifies the thickness of the axis line. Thickness increases directly with the value
of thickness-factor. By default, WIDTH=1.
Note: In order for the axis line to be altered by the WIDTH= option, the
NOFRAME option must also be set. If only the WIDTH=option is set, the axis
frame will be modified.
Java does not support WIDTH. ACTIVEX ignores the WIDTH option for the
vertical axis of an AXIS statement with GPLOT and GCONTOUR. 4
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226.
Not supported by: Java, ActiveX (partial)
specified text strings. See LABEL= on page 127, REFLABEL= on page 133, and
VALUE= on page 134.
ANGLE=degrees
A=degrees
specifies the angle of the baseline with respect to the horizontal. A positive value
for degrees moves the baseline counterclockwise; a negative value moves it
clockwise. By default, ANGLE=0 (horizontal) unless the text is automatically
angled or rotated to avoid overlapping. For an illustration of the effect of
ANGLE=, see Figure 7.24 on page 213.
Note: Changing the angle of a vertical axis-label can result in the label being
positioned above the graph when using client-side rendering with Java or
ActiveX. 4
See also: the ROTATE= suboption on page 138
Featured in: Example 7 on page 856 .
Not supported by: Java (partial)
AUTOREF
automatically labels each reference line on an axis with the response value at the
reference line’s position. AUTOREF is only used with the REFLABEL= option.
The automatic labels are applied only to reference lines that do not have specific
labels assigned to them. For example, the following option uses the response-axis
value as the label for every reference line except the second reference line, which
is assigned the label two:
reflabel=(autoref t=2 "two")
Note, however, that if at the same time you also request automatic labeling with
a PLOT or BUBBLE statement (using the AUTOHREF or AUTOVREF option),
then the automatic labeling of the PLOT or BUBBLE statement can write on top
of your custom label specified with t he AXIS statement. You must ensure that
your custom labels specified with the AXIS statement are not at the same position
as automatic labels requested with a different statement.
Not supported by: Java, ActiveX, GIF
COLOR=text-color
C=text-color
specifies the color for the text. If you omit the COLOR= suboption, a color
specification is searched for in this order:
1 the CTEXT= option for the procedure
2 the CTEXT= option in a GOPTIONS statement
3 the default, the first color in the colors list.
FONT=font | NONE
F=font | NONE
specifies the font for the text. See Chapter 5, “SAS/GRAPH Fonts,” on page 75 for
details on specifying font. If you omit FONT=, a font specification is searched for
in this order:
1 the FTEXT= option in a GOPTIONS statement
2 the default hardware font, NONE.
Not supported by: Java (partial)
Note: With client-side output using Java and ActiveX, text justification is
relative to the text string, not the tick mark. For example, left justification means
that the left end of the text string is justified with respect to the drawing location,
as well as other strings in a multiline label—which may be to the right of a tick
mark. 4
You can use JUSTIFY= to print multiple lines of text by repeating JUSTIFY=
before the text string for each line. You can also use JUSTIFY= to specify
multi-line text at specified major tick marks. For example, this statement
produces an axis label and major tick mark values like those shown in Figure 7.4
on page 138.
axis label=(’Current’ justify=c
’Sales Projections’)
value=(tick=1 ’JAN’ justify=c ’1997’
tick=2 ’FEB’ justify=c ’1997’
tick=3 ’MAR’ justify=c ’1997’
tick=4 ’APR’ justify=c ’1997’
tick=5 ’MAY’ justify=c ’1997’);
138 AXIS Statement Chapter 7
For the options to be applied to a text string, they must precede the quoted
string. In the following option, the j=left is ignored because it follows the
string:
reflabel(c=green "one" "two" t=3 "three" j=left)
3
Note: Client-side rendering with the Java applet or ActiveX control does not
support the REFLABEL option.
With VALUE=, TICK= specifies the nth major tick mark value. It is used to
designate the tick mark value whose text and appearance you want to modify.
For example, the following option changes the color of only the third tick
mark value and leaves all others unchanged:
value=(tick=3 color=red)
Suboptions that precede TICK= affect all the major tick mark values.
Suboptions that follow TICK= affect only the specified value. For example,
the following option makes all the major tick mark values 4 units high and
colors all of them blue except for the third one, which is red:
value=(height=4 color=blue tick=3 color=red)
FONT=SWISS applies to both Weight and (in tons). HEIGHT=4 affects Weight,
but is respecified as HEIGHT=3 for (in tons). JUSTIFY=RIGHT affects only (in
tons).
If you specify a negative number, tick marks are drawn inside the axis.
Not supported by: Java, ActiveX
NUMBER=number-of-ticks
N=number-of-ticks
specifies the number of tick marks to be drawn. With MAJOR=, number-of-ticks
must be greater than 1. With MINOR=, number-of-ticks must be greater than 0.
With MAJOR=, the NUMBER= suboption can be overridden by a major tick
mark specification in the procedure, which in turn can be overridden by ORDER=.
With MINOR=, the NUMBER= suboption can be overridden by a minor tick
mark specification in the procedure.
NUMBER= is not valid with logarithmic axes.
WIDTH=thickness-factor
W=thickness-factor
specifies the thickness of the tick mark, where thickness-factor is a number.
Thickness increases directly with thickness-factor. By default, WIDTH=1.
Not supported by: Java (partial)
Canceling one AXIS statement does not affect any other AXIS definitions. To cancel
all current AXIS statements, use the RESET= option in a GOPTIONS statement:
goptions reset=axis;
Statement that
generates an Option that assigns an AXIS
Procedure axis Type of axis definition
BY Statement
The BY statement processes data and orders output according to the BY group.
Used by:
GCHART, GCONTOUR, GMAP, GPLOT, GREDUCE, G3D, G3GRID procedures
Description
The BY statement divides the observations from an input data set into groups for
processing. Each set of contiguous observations with the same value for a specified
variable is called a BY group. A variable that defines BY groups is called a BY variable
and is the variable that is specified in the BY statement. When you use a BY
statement, the graphics procedure
3 processes each group of observations independently
3 generates a separate graph or output for each BY group
3 automatically adds a heading called a BY line to each graph identifying the BY
group represented in the graph
3 adds BY statement information below the Description field of the catalog entry.
By default, the procedure expects the observations in the input data set to be sorted
in ascending order of the BY variable values.
Note: The BY statement in SAS/GRAPH is essentially the same as the BY
statement in base SAS, but the effect on the output is different when it is used with
SAS/GRAPH procedures. 4
Syntax
BY<DESCENDING>variable
<...<DESCENDING>variable-n>
<NOTSORTED>;
142 Preparing Data for BY-Group Processing Chapter 7
Required Arguments
variable
specifies the variable that the procedure uses to form BY groups. You can specify
more than one variable. By default, the procedure expects observations in the data
set to be sorted in ascending order by all the variables that you specify or to be
indexed appropriately.
Options
DESCENDING
indicates that the data set is sorted in descending order by the specified variable.
The option affects only the variable that immediately follows the option name, and
must be repeated before every variable that is not sorted in ascending order. For
example, this BY statement indicates that observations in the input data set are
arranged in descending order of VAR1 values and ascending order of VAR2 values:
by descending var1 var2;
This BY statement indicates that the input data set is sorted in descending
order of both VAR1 and VAR2 values:
by descending var1 descending var2;
NOTSORTED
specifies that observations with the same BY value are grouped together, but are
not necessarily sorted in alphabetical or numeric order. The observations can be
grouped in another way, for example, in chronological order.
NOTSORTED can appear anywhere in the BY statement and affects all
variables specified in the statement. NOTSORTED overrides DESCENDING if
both appear in the same BY statement.
The requirement for ordering or indexing observations according to the values
of BY variables is suspended when you use the NOTSORTED option. In fact, the
procedure does not use an index if you specify NOTSORTED. For NOTSORTED,
the procedure defines a BY group as a set of contiguous observations that have the
same values for all BY variables. If observations with the same value for the BY
variables are not contiguous, the procedure treats each new value it encounters as
the first observation in a new BY group and will create a graph for that value,
even if it is only one observation.
Controlling BY Lines
By default, the BY statement prints a BY line above each graph that contains the
variable name followed by an equal sign and the variable value. For example, if you
specify BY SITE in the procedure, the default heading when the value of SITE is
London would be SITE=London.
3 the effect of BY-group processing on the GCHART, GMAP, and GPLOT procedures
3 the interaction between BY-group and RUN-group processing
3 the requirements for using BY-group processing with the Annotate facility
3 how to include BY information in titles, notes, and footnotes
3 how patterns and symbols are assigned to BY-groups
3 the effect of using BY-group processing with the ODS HTML statement.
For additional information on any of these topics, refer to the appropriate chapter.
value of the BY variable. For example, each of these two RUN-groups produces a
separate plot for every value of the BY variable SITE:
/* first run group*/
proc gplot data=sales;
title1 ’Sales Summary’;
by site;
plot sales*model_a;
run;
The BY statement stays in effect for every subsequent RUN group until you submit
another BY statement or exit the procedure. Variables in subsequent BY statements
replace any previous BY variables.
You can also turn off BY-group processing by submitting a null BY statement (BY;) in
a RUN group, but when you do this, the null BY statement turns off BY-group
processing and the RUN group generates a graph.
For more information, see “RUN-Group Processing” on page 33.
sure that REGION always has the same four values. Otherwise, the patterns may not
be the same across graphs. For example, if the value North is missing from the data,
the patterns are assigned as follows:
PATTERN1 is assigned to East,
PATTERN2 is assigned to South,
PATTERN3 is assigned to West.
In this case, South is assigned pattern 2 instead of pattern 3 and West is assigned
pattern 3 instead of pattern 4. To avoid this, include the value North for the variable
REGION, but assign it a missing value for all other variables.
FOOTNOTE Statement
See “TITLE, FOOTNOTE, and NOTE Statements” on page 210.
GOPTIONS Statement
The GOPTIONS statement temporarily sets default values for many graphics
attributes and device parameters used by SAS/GRAPH procedures.
Used by:
all statements and procedures in a SAS session
Description
The GOPTIONS statement specifies values for graphics options. Graphics options
control characteristics of the graph, such as size, colors, type fonts, fill patterns, and
symbols. In addition, they affect the settings of device parameters, which are defined in
the device entry. Device parameters control such characteristics as the appearance of
the display, the type of output produced, and the destination of the output.
The GOPTIONS statement allows you to change these settings temporarily, either for
a single graph or for the duration of your SAS session. You can use the GOPTIONS
statement to
3 override default values for graphics options that control either graphics attributes
or device parameters for a single graph or for an entire SAS session
3 reset individual graphics options or all graphics options to their default values
3 cancel definitions for AXIS, FOOTNOTE, PATTERN, SYMBOL, and TITLE
statements.
To change device parameters permanently, you must use the GDEVICE procedure to
modify the appropriate device entry or to create a new one. See Chapter 31, “The
GDEVICE Procedure,” on page 915 for details.
To review the current settings of all graphics options, use the GOPTIONS procedure.
See Chapter 36, “The GOPTIONS Procedure,” on page 1075 for details.
Syntax
GOPTIONS<options-list>;
options-list can be one or more options from any or all of the following categories:
3 reset option
SAS/GRAPH Statements GOPTIONS Statement 147
HTITLE=title-height <units>
RENDER=APPEND | DISK | MEMORY | NONE | READ
RENDERLIB=libref
SIMFONT=software-font
3 options that set defaults for procedures and global statements
GUNIT=units
INTERPOL=interpolation-method
OFFSHADOW=(x <units>, y <units> | (x,y) <units>
V6COMP | NOV6COMP
3 image animation options
DELAY=delay-time
DISPOSAL=NONE | BACKGROUND | PREVIOUS | UNSPECIFIED
INTERLACED | NONINTERLACED
ITERATION=iteration-count
TRANSPARENCY | NOTRANSPARENCY
3 options that affect how your SAS/GRAPH program runs
DISPLAY | NODISPLAY
ERASE | NOERASE
GWAIT=seconds
GRAPHRC | NOGRAPHRC
IMAGEPRINT | NOIMAGEPRINT
PCLIP | NOPCLIP
POLYGONCLIP | NOPOLYGONCLIP
3 options that control how output is sent to devices or files
ADMGDF | NOADMGDF
DEVADDR=device-address
DEVICE=device-entry
DEVMAP=device-map-name | NONE
EXTENSION=’file-type’
FILECLOSE=DRIVERTERM | GRAPHEND
FILEONLY | NOFILEONLY
GACCESS=output-format | ’output-format > destination’
GEND=’string’ <...’string-n’>
GEPILOG=’string’ <...’string-n’>
GOUTMODE=APPEND | REPLACE
GPROLOG=’string’ <...’string-n’>
GPROTOCOL=module-name
GSFLEN=record-length
GSFMODE=APPEND | PORT | REPLACE
GSFNAME=fileref
GSFPROMPT | NOGSFPROMPT
GSTART=’string’ <...’string-n’>
HANDSHAKE=HARDWARE | NONE | SOFTWARE | XONXOFF
KEYMAP=map-name | NONE
POSTGEPILOG=’string’
SAS/GRAPH Statements GOPTIONS Statement 149
POSTGPROLOG=’string’
PREGEPILOG=’string’
PREGPROLOG=’string’
PROMPTCHARS=’prompt-chars-hex-string’X
3 options that specify hardware capabilities of the device
CHARACTERS | NOCHARACTERS
CIRCLEARC | NOCIRCLEARC
DASH | NODASH
DASHSCALE=scaling-factor
FILL | NOFILL
FILLINC=0...9999
LFACTOR=line-thickness-factor
PIEFILL | NOPIEFILL
POLYGONFILL | NOPOLYGONFILL
SYMBOL | NOSYMBOL
3 options that control printer hardware features
AUTOCOPY | NOAUTOCOPY
AUTOFEED | NOAUTOFEED
BINDING=DEFAULTEDGE | LONGEDGE | SHORTEDGE
COLLATE | NOCOLLATE
DUPLEX | NODUPLEX
GCOPIES=(<current-copies><,max-copies>)
PAPERDEST=bin
PAPERFEED=feed-increment <IN | CM>
PAPERLIMIT=width <IN | CM>
PAPERSIZE=’size-name’ | (width,height)
PAPERSOURCE=tray
PAPERTYPE=’type-name’
PPDFILE=fileref | ’external-file’
REPAINT=redraw-factor
REVERSE | NOREVERSE
SPEED=pen-speed
UCC=’control-characters-hex-string’X
3 options that interact with the operating environment
DRVINIT=’system-command(s)’
DRVTERM=’system-command(s)’
PREGRAPH=’system-command(s)’
POSTGRAPH=’system-command(s)’
PROMPT | NOPROMPT
3 options for mainframe systems
GCLASS=SYSOUT-class
GDDMCOPY=FSCOPY | GSCOPY
GDDMNICKNAME=nickname
GDDMTOKEN=token
GDEST=destination
150 Using the GOPTIONS Statement Chapter 7
GFORMS=’forms-code’
GWRITER=’writer-name’
TRANTAB=table | user-defined-table
Options
See Chapter 8, “Graphics Options and Device Parameters Dictionary,” on page 261
for a complete description of all graphics options used by the GOPTIONS statement.
To reset only the background color specification to the default and keep the
remaining values, use this GOPTIONS statement:
goptions cback=;
Alternatively, you can use RESET=ALL, but it also cancels any global statement
definitions in addition to resetting all graphics options to default values.
Note: Not every graphics attribute can be set in all three places. See the statement
and procedure chapters for the options that can be used with each. 4
SAS/GRAPH Statements LEGEND Statement 151
Some graphics options are supported for specific devices or operating environments
only. See the SAS Help facility for SAS/GRAPH or the SAS companion for your
operating environment for more information.
LEGEND Statement
The LEGEND statement controls the location and appearance of legends on
two-dimensional plots, contour plots, maps, and charts.
Used by:
GCHART, GCONTOUR, GMAP, GPLOT procedures
Global
Description
LEGEND statements specify the characteristics of a legend but do not create
legends. These characteristics are
3 the position and appearance of the legend box
3 the text and appearance of the legend label
3 the appearance of the legend entries, including the size and shape of the legend
values
3 the text of the labels for the legend values.
LEGEND definitions are not automatically applied when a procedure generates a
legend. Instead, they must be explicitly assigned with a LEGEND= option in the
appropriate procedure statement.
illustrates the terms associated with the various parts of a legend.
Syntax
LEGEND<1...99>< options>;
option(s) can be one or more options from any or all of the following categories:
3 appearance options
ACROSS=number-of-columns
CBLOCK=block-color
CBORDER=frame-color
CFRAME=background-color
CSHADOW=shadow-color
DOWN=number-of-rows
FRAME
152 LEGEND Statement Chapter 7
FWIDTH=thickness-factor
SHAPE=BAR(width,height) <units> | LINE(length) <units> |
SYMBOL(width,height) <units>
3 position-options
MODE=PROTECT | RESERVE | SHARE
OFFSET=(<x ><,y >)<units > | (<x <units >><,y <units >>)
ORIGIN=(<x ><,y >)<units > | (<x <units >><,y <units >>)
POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER | RIGHT>
<INSIDE | OUTSIDE>)
3 text-options
LABEL=(text-argument(s)) | NONE
ORDER=(value-list)
VALUE=(text-argument(s)) | NONE
Options
When the syntax of an option includes units, use one of these:
CELLS character cells
CM centimeters
IN inches
PT points
PCT percentage of the graphics output area
Note: The Java applet does not support CM, IN, or PT. 4
If you omit units, a unit specification is searched for in this order:
1 GUNIT= in a GOPTIONS statement
2 the default unit, CELLS.
ACROSS=number-of-columns
specifies the number of columns to use for legend entries.
Featured in: “Example 8. Creating a Simple Web Page with the ODS HTML
Statement” on page 245.
CBLOCK=block-color
generates and colors a three-dimensional block effect behind the legend. The size
and position of the block are controlled by the graphics option OFFSHADOW=(x,y).
CBLOCK= and CSHADOW= are mutually exclusive. If both are present,
SAS/GRAPH software uses the last one specified. CBLOCK= is usually used in
conjunction with the FRAME, CFRAME=, or CBORDER= options.
The Java client treats the CBLOCK option like CSHADOW.
See also: the OFFSHADOW=“OFFSHADOW” on page 325 graphics option and
“Creating Drop Shadows and Block Effects” on page 163.
Not supported by: Java
CBORDER=frame-color
draws a colored frame around the legend. This option overrides the FRAME
option. CBORDER= can be used in conjunction with the CFRAME= option.
CFRAME=background-color
SAS/GRAPH Statements LEGEND Statement 153
specifies the background color of the legend. This option overrides the FRAME
option. If both CFRAME= and FRAME= are specified, only the solid background
produced by CFRAME= is displayed. CFRAME= can be used in conjunction with
the CBORDER= option.
CSHADOW=shadow-color
generates and colors a drop shadow behind the legend. The size and position of
the shadow is controlled by the graphics option OFFSHADOW=(x,y).
CSHADOW= and CBLOCK= are mutually exclusive. If both are present,
SAS/GRAPH uses the last one specified. CSHADOW= is usually specified in
conjunction with the FRAME, CFRAME=, or CBORDER= options.
See also: the OFFSHADOW=“OFFSHADOW” on page 325 graphics option and
“Creating Drop Shadows and Block Effects” on page 163.
DOWN=number-of-rows
specifies the number of rows to use for legend entries.
FRAME
draws a frame around the legend. The color of the frame is the first color in the
colors list.
FWIDTH=thickness-factor
specifies the thickness of the frame, where thickness-factor is a number. The
thickness of the line increases directly with thickness-factor. By default,
FWIDTH=1.
Not supported by: Java, ActiveX
LABEL=(text-argument(s)) | NONE
modifies a legend label. Text-argument(s) defines the appearance or the text of a
legend label, or both. NONE suppresses the legend label. By default, the text of
the legend label is either the variable name or a previously assigned variable label
(except in the case of GPLOT with OVERLAY, in which case the default label is
“PLOT”). Text-argument(s) can be one or more of these:
‘text-string’
provides up to 256 characters of label text. Enclose each string in quotes.
Separate multiple strings with blanks.
text-description-suboption
modifies a characteristic such as the font, color, or size of the text string(s)
that follows it. Text-description-suboption can be
COLOR=text-color
FONT=font | NONE
HEIGHT=text-height <units>
JUSTIFY=LEFT | CENTER | RIGHT
POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER |
RIGHT>)
Note: The Java applet does not support the POSITION suboption—it
draws legend labels at the top-left of the legend. And, it does not support
multiple values for the JUSTIFY suboption (only the first is honored). The
ActiveX control supports POSITION= but does not support multiple values
for the JUSTIFY suboption (only the first is honored). 4
See “Text Description Suboptions” on page 158 for complete descriptions.
Specify as many text strings and text description suboptions as you want, but
enclose them all in one set of parentheses.
154 LEGEND Statement Chapter 7
Featured in: “Example 3. Rotating Plot Symbols through the Colors List” on
page 231 and “Example 8. Creating a Simple Web Page with the ODS HTML
Statement” on page 245
Not supported by: Java (partial), ActiveX (partial)
MODE=PROTECT | RESERVE | SHARE
specifies whether or not the legend is drawn in the procedure output area or
whether legend elements can overlay other graphics elements. MODE= can take
one of these values:
PROTECT draws the legend in the procedure output area, but a blanking
area surrounds the legend, preventing other graphics elements
from being displayed in the legend. (A blanking area is a
protected area in which no other graphics elements are
displayed.)
RESERVE takes space for the legend from the procedure output area,
thereby reducing the amount of space available for the graph.
If MODE=RESERVE is specified in conjunction with
OFFSET=, the legend may push the graph off the graphics
output area. RESERVE is valid only when
POSITION=OUTSIDE. If POSITION=INSIDE is specified, a
warning is issued and MODE= is changed to PROTECT.
SHARE draws the legend in the procedure output area. If the legend is
positioned over elements of the graph itself, both graphics
elements and legend elements are displayed.
By default, MODE=RESERVE unless POSITION=INSIDE, in which case the
default changes to MODE=PROTECT.
See also: “Positioning the Legend” on page 162
Featured in: “Example 8. Creating a Simple Web Page with the ODS HTML
Statement” on page 245.
Not supported by: Java, ActiveX
OFFSET=(<x><,y>)<units> | (<x <units>><,y <units>>)
specifies the distance to move the entire legend; x is the number of units to move
the legend right (positive numbers) or left (negative numbers), and y is the number
of units to move the legend up (positive numbers) or down (negative numbers).
To set only the x offset, specify one value, with or without a following comma:
offset=(4 cm,)
To set both the x and y offset, specify two values, with or without a comma
separating them:
offset=(2 pct, 4 pct)
See also: “Positioning the Legend” on page 162 and the option POSITION= on
page 155
Not supported by: Java, ActiveX
ORDER=(value-list)
selects or orders the legend values that appear in the legend. The way you specify
value-list depends on the type of variable that generates the legend:
3 For numeric variables, value-list is either an explicit list of values, or a
starting and an ending value with an interval increment, or a combination of
both forms:
n <...n>
n TO n <BY increment>
n <...n> TO n <BY increment> <n <...n>>
If a numeric variable has an associated format, the specified values must
be the unformatted values.
3 For character variables, value-list is a list of unique character values enclosed
in quotes and separated by blanks:
’value-1’ <...’value-n’>
If a character variable has an associated format, the specified values must
be the formatted values.
For a complete description of value-list, see the option ORDER= on page 130 in
the AXIS statement.
Even though ORDER= controls whether a legend value is displayed and where
it appears, the VALUE= option controls the text that the legend value displays.
Not supported by: ActiveX, Java
ORIGIN=(<x><,y>)<units> | (<x <units >><,y <units>>)
specifies the x coordinate and the y coordinate of the lower-left corner of the legend
box. ORIGIN= explicitly positions the legend anywhere on the graphics output
area. It is possible to run a legend off the page or overlay the graph.
To set only the x coordinate, specify one value, with or without a following
comma:
origin=(4 cm,)
To set both the x and y coordinates, specify two values, with or without a comma
separating them:
origin=(2 pct, 4 pct)
ORIGIN= overrides the POSITION= option if both are used. Although using the
OFFSET= option with the ORIGIN= option is unnecessary, if OFFSET= is also
specified, it is applied after the ORIGIN= request has been processed.
See also: “Positioning the Legend” on page 162
Featured in: “Example 8. Creating a Simple Web Page with the ODS HTML
Statement” on page 245 .
Not supported by: Java, ActiveX
POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER | RIGHT>
<OUTSIDE | INSIDE>)
positions the legend on the graph. Value for POSITION= are
156 LEGEND Statement Chapter 7
OUTSIDE or specifies the location of the legend in relation to the axis area.
INSIDE
BOTTOM or specifies the vertical position.
MIDDLE or
TOP
LEFT or specifies the horizontal position.
CENTER or
RIGHT
By default, POSITION=(BOTTOM CENTER OUTSIDE). You can change one or
more settings. If you supply only one value the parentheses are not required. If
you specify two or three values and omit the parentheses, SAS/GRAPH accepts the
first value and ignores the others.
Once you assign the initial legend position, you can adjust it with the OFFSET=
option.
The ORIGIN= options overrides POSITION=. The value of the MODE= option
can affect the behavior of POSITION=.
This specification produces legend values like the ones in Figure 7.6 on
page 157(b):
SAS/GRAPH Statements LEGEND Statement 157
shape=symbol(2,.5)
Minn Minn
CITY
CITY CITY
CITY
Phoenix Phoenix
Raleigh Raleigh
a. b.
By default, width is 5, height is 1, and units are CELLS. You can specify
units for the width,height pair or for the individual coordinates.
Featured in: “Example 3. Rotating Plot Symbols through the Colors List” on
page 231.
Not supported by: Java, ActiveX
VALUE=(text-argument(s) )| NONE
modifies the legend value descriptions. Text-argument(s) defines the appearance or
the text of the value descriptions. By default, value descriptions are the values of
the variable that generates the legend or an associated format value. Numeric
values are right justified and character values are left justified.
NONE suppresses the value descriptions although the legend values (bars,
lines, and so on) are still displayed. (NONE is not supported by Java or ActiveX).
Text-argument(s) can be one or more of these:
‘text-string’
provides up to 256 characters of text for the value description. Enclose each
string in quotes. Separate multiple strings with blanks.
Specified text strings are assigned to the legend values in order. If you
submit only one string, only the first legend entry uses the value of that
string. If you specify multiple strings, the first string is the text for the first
entry; the second string is the text for the second entry; and so forth. For
example, this specification produces legend entries like those shown in Figure
7.7 on page 157:
value=(’1986’ ’1987’ ’1988’)
text-description-suboption
modifies a characteristic such as the font, color, or size of the text string(s)
that follows it. Text-description-suboption can be
158 LEGEND Statement Chapter 7
COLOR=text-color
FONT=font | NONE
HEIGHT=text-height <units >
JUSTIFY=LEFT | CENTER | RIGHT
TICK=n (not supported by Java or ActiveX)
See “Text Description Suboptions” on page 158 for complete descriptions.
Place text description suboptions before the text strings they modify.
Suboptions not followed by a text string affect the default values. To specify
and describe the text for individual values or to produce multi-line text, use
the TICK= suboption.
Specify as many text strings and text description suboptions as you want, but
enclose them all in one set of parentheses.
To order or select legend entries, use the ORDER= option.
See also: “Text Description Suboptions” on page 158 and the option ORDER= on
page 155
Not supported by: Java (partial), ActiveX (partial)
FONT=font | NONE
F=font | NONE
specifies the font for the text. See Chapter 5, “SAS/GRAPH Fonts,” on page 75for
information on specifying fonts. If you omit FONT=, a font specification is
searched for in this order:
1 the FTEXT= option in a GOPTIONS statement
2 the default hardware font, NONE.
HEIGHT=text-height <units>
H=text-height <units>
specifies the height of the text characters in the number of units. By default,
HEIGHT=1 CELL. If you omit HEIGHT=, a text height specification is searched
for in this order:
1 the HTEXT= option in a GOPTIONS statement
2 the default value, 1.
You can use JUSTIFY= to print multiple lines of text by repeating JUSTIFY=
before the text string for each line. For example, this statement produces a legend
label and value descriptions like those shown in Figure 7.8 on page 159:
legend label=(justify=c ’Distribution’
justify=c ’Centers’)
value=(tick=1 justify=c ’Portland,’
justify=c ’Maine’
tick=2 justify=c ’Paris,’
justify=c ’France’
tick=3 justify=c ’Sydney,’
justify=c ’Australia’);
Figure 7.8 Specifying Multiple Lines of Text with the JUSTIFY= Suboption
Figure 7.9 Using the POSITION= Suboption with Multi-line Legend Labels
POSITION=LEFT POSITION=(TOP)
(default) JUSTIFY=CENTER
multi-
multi- line
line label
label + + + ONE
● ● ● TWO + + + ONE
x x x THREE ● ● ● TWO
# # # FOUR x x x THREE
$ $ $ FIVE # # # FOUR
$ $ $ FIVE
POSITION=(TOP LEFT)
POSITION=TOP
multi- + + + ONE JUSTIFY=LEFT
line ● ● ● TWO
label x x x THREE multi-
# # # FOUR line
$ $ $ FIVE label
+ + + ONE
● ● ● TWO
x x x THREE
POSITION=(MIDDLE LEFT) # # # FOUR
$ $ $ FIVE
+ + + ONE
multi- ● ● ● TWO
line x x x THREE
label # # # FOUR POSITION=TOP
$ $ $ FIVE JUSTIFY=RIGHT
multi-
POSITION=(BOTTOM LEFT) line
label
+ + + ONE + + + ONE
● ● ● TWO ● ● ● TWO
multi- x x x THREE x x x THREE
line # # # FOUR # # # FOUR
label $ $ $ FIVE $ $ $ FIVE
If you omitted TICK=3, the text of the second legend entry would be
ParisSydney.
Text description suboptions that precede TICK= affect all the value descriptions
for the legend unless the same suboption (with a different value) follows a TICK=
specification. Text description suboptions that follow TICK= affect only the
specified legend entry. For example, suppose you specify this option for a legend
with three entries:
value=(color=red font=swiss tick=2 color=blue)
The text of all three entries would use the Swiss font; the first and third entries
would be red and only the second entry would be blue.
FONT=SWISS applies to both Weight and (in tons). HEIGHT=4 affects Weight,
but is respecified as HEIGHT=3 for (in tons). JUSTIFY=RIGHT affects only (in
tons).
Canceling one LEGEND statement does not affect any other LEGEND definitions. To
cancel all current LEGEND statements, use RESET= in a GOPTIONS statement:
goptions reset=legend;
legend
axis positions
Figure 7.11 on page 162 shows legend positions outside the axis area.
Use OFFSET=(x,y) to adjust the position of the legend specified by POSITION=. The
x value shifts the legend either left or right and the y value shifts the legend either up
or down.
The offset values are always applied after the POSITION= request. For example, if
POSITION=(TOP RIGHT OUTSIDE), the legend is located in the upper right corner of
the graphics output area. If OFFSET=(0,0) is specified, the legend does not move. If
OFFSET=(-5,-8)CM, the legend moves 5 centimeters to the left and 8 centimeters down.
Using ORIGIN=
Use ORIGIN=(x,y) to specify the coordinates of the exact location of the lower left
corner of the legend box. Because ORIGIN=(0,0) is the lower left corner of the graphics
output area, the values of x and y must be positive. If you specify negative values, a
warning is issued and the default value is used.
NOTE Statement
See “TITLE, FOOTNOTE, and NOTE Statements” on page 210.
Description
This section describes the ODS HTML statement as it relates to SAS/GRAPH
procedures.
The ODS HTML statement opens or closes the HTML destination. If the destination
is open, it produces output that is written in Hyper Text Markup Language (HTML). If
DEVICE=GIF, graphics output is produced as GIF files, and the HTML files display the
GIF files that are created by the SAS/GRAPH procedures. If DEVICE=JAVAMETA,
graphics output is produced as metagraphics data, which provides graphs that are exact
replicas of their corresponding GRSEG graphs but that are interactive in a Web page.
Procedures GCHART, GCONTOUR, GMAP, GPLOT, and G3D can also be used with the
JAVA and ACTIVEX drivers, both of which generate JavaScript in the output HTML
file. If DEVICE=JAVA, then a Java-enabled browser can use the script to render graphs
as a SAS/GRAPH Applet for Java. If DEVICE=ACTIVEX, then an ActiveX-enabled
browser can use the script to render graphs as a SAS/GRAPH Control for ActiveX.
Syntax
ODS HTML HTML-file-specification(s) | action
<ANCHOR=’string’>
<ARCHIVE=’string’>
<ATTRIBUTES=(’attribute-name1’=’attribute-value-1’ ...
’attribute-name-n’=’attribute-value=n’)>
<CODEBASE=file-location <(URL=’Uniform-Resource-Locator’)>>
<BASE=’base-text’>
<GFOOTNOTE | NOGFOOTNOTE>
<GPATH=graphics-location <(URL=’Uniform-Resource-Locator’ | NONE )>>
<GTITLE | NOGTITLE>
<HEADTEXT=’HTML-for-document-head’>
<METATEXT=’HTML-for-document-head’>
<NEWFILE=starting-point>
<PARAMETERS=(’parameter-name1’=’parameter-value-1’ ...
’parameter-name-n’=’parameter-value=n’)>
<PATH=file-location <(URL=’Uniform-Resource-Locator’ | NONE )>>
SAS/GRAPH Statements ODS HTML Statement 165
<RECORD_SEPARATOR=’string’ | NONE>
<STYLE=style-definition>
<TRANTAB=’translation-table’>;
Note: BODY= is required. If you use FRAME=, you must also use
CONTENTS= or PAGE=. 4
Required Arguments
One of these arguments is required.
CLOSE
closes the HTML destination and closes any HTML files that are currently open.
Featured in: “Example 8. Creating a Simple Web Page with the ODS HTML
Statement” on page 245.
EXCLUDE
excludes output objects from the HTML destination.
SELECT
selects output objects to send to the HTML destination.
SHOW
writes to the SAS log the current selection or exclusion list for the HTML
destination.
HTML-file-specification
opens the HTML destination and specifies the HTML file or files to write to. You
can open up to four HTML files; the file designated by BODY= is required.
Whenever you open one of these files, it remains open until you either
3 close the HTML destination with ODS HTML CLOSE
3 open a different file for the same HTML file specification.
HTML-file-specification can be one or more of the following arguments. Values
for file-specification follow the arguments.
BODY=file-specification
FILE=file-specification
identifies the file that contains the HTML version of the procedure output.
With SAS/GRAPH, the body file contains references to the graphs. If
166 ODS HTML Statement Chapter 7
DEVICE=GIF, the graphs are stored in separate GIF files. When you view
the body file on a browser, the graphs are automatically displayed.
Featured in: “Example 8. Creating a Simple Web Page with the ODS HTML
Statement” on page 245 and “Example 10. Creating a Bar Chart with
Drill-down for the Web” on page 255.
CONTENTS=file-specification
identifies the file that contains a table of contents to the ODS output that is
produced while the HTML destination is open. The contents file contains
links to the body file(s).
The text of links to graphics output is taken from the description field of
the GRSEG catalog entry. Use the DESCRIPTION= option in the procedure
to change the link text.
You can display a contents file alone or in conjunction with a frame file. If
you display a contents file directly (without using a frame file), selecting a
link opens the associated body file, and the contents file is no longer
displayed. If you display a contents file with a frame file, the contents file
always remains available in the left frame, and selecting a link opens the
associated body file in the right frame.
FRAME=file-specification
identifies a file that points to the body file and to either the table of contents
file or the page file, or both. If you specify FRAME=, you must also specify
either CONTENTS= or PAGE= or both.
When you open the frame file in the browser, it displays the Table of
Contents or the Table of Pages or both in the left frame, and the body file in
the right frame.
PAGE=file-specification
identifies the file that contains a table of pages to the ODS output that is
produced while the HTML destination is open.The pages file contains links to
the body file(s). ODS produces a new page of output whenever a procedure
explicitly specifies for a new page. The SAS system option PAGESIZE= has
no effect on pages in HTML output.
File-specification identifies the file or SAS catalog to write to and can be one of
the following:
3 fileref (<URL=’Uniform-Resource-Locator’> <NO_BOTTOM_MATTER>
<NO_TOP_MATTER> <DYNAMIC>)
3 external-file (<URL=’Uniform-Resource-Locator’> <NO_BOTTOM_MATTER>
<NO_TOP_MATTER> <DYNAMIC> )
3 entry.HTML (<URL=’Uniform-Resource-Locator’> <NO_BOTTOM_MATTER>
<NO_TOP_MATTER> <DYNAMIC> )
where
external-file
is the physical name of an external file to write to. For information on
specifying external files, see the SAS companion for your operating
environment.
fileref
is a fileref that has been assigned to an external file. The fileref must refer to
a single file; it cannot point to an aggregate file storage location. Use a
FILENAME statement to assign a fileref. See also “FILENAME Statement”
on page 28.
SAS/GRAPH Statements ODS HTML Statement 167
entry.HTML
specifies an entry in a SAS catalog to write to.You must also specify a library
and catalog. See the discussion on PATH=“ODS HTML Statement” on page
164.
URL=’Uniform-Resource-Locator’
provides a URL for file-specification. ODS uses this URL instead of the file
name in all the links and references that it creates that point to the file.
This option is useful for building HTML files that may be moved from one
location to another. If the links from the contents and page files are
constructed with a simple URL (one name), they work as long as the
contents, page, and body files are all in the same location.
NO_BOTTOM_MATTER
NOBOT
omits the bottom matter for the file. By default, when you close a file that
was open for HTML output of any kind, ODS writes some HTML to the
bottom of the file. This HTML ends the file so that it can be viewed cleanly in
a browser.
If you wish to leave a file in a state that you can append to, use
NO_BOTTOM_MATTER on the BODY= option on the ODS HTML statement
that opens the file. This option, in conjunction with NO_TOP_MATTER
makes it possible for you to add output to a file that already exists and to put
your own HTML code in the file between pieces of output.
To use NO_BOTTOM_MATTER, you must use a fileref for file-specification.
The FILENAME statement that defines the fileref must include the
host-specific option that opens the file for appending.
When you are opening a file that ODS has previously written to, you must
use ANCHOR= to specify a new base name for the anchors to avoid
duplicating anchors that already exist in the file. See the discussion “About
Anchors” on page 168.
NO_TOP_MATTER
NOTOP
omits the opening matter for the file. By default, when you open a file for
HTML output of any kind, ODS writes some HTML to the top of the file.
If you wish to append ODS output to an existing file, you must open the file
with NO_TOP_MATTER on the BODY= option on the ODS HTML statement
that opens the file. This option, in conjunction with NO_BOTTOM_MATTER
makes it possible for you to add output to a file that already exists and to put
your own HTML code in the file between pieces of output.
To use NO_TOP_MATTER, you must use a fileref for file-specification. The
FILENAME statement that defines the fileref must include the host-specific
option that opens the file for appending.
When you are opening a file that ODS has previously written to, you must
use ANCHOR= to specify a new base name for the anchors to avoid
duplicating anchors that already exist in the file. See the discussion“About
Anchors” on page 168.
DYNAMIC
enables you to send HTML output directly to a web server instead of writing
it to a file. This option sets the value of the HTMLContentType= attribute.
By default, if you do not specify DYNAMIC, ODS sets the value of
HTMLContentType= for writing to a file.
Note: If you specify the DYNAMIC suboption with any file specification in
the ODS HTML statement, you must specify it for all the file specifications in
the statement. 4
168 Using the ODS HTML Statement Chapter 7
Note: Regardless of how you specify the file, you may need to include the extension
.HTML or .HTM on the file name. Some browsers require one of these extensions in
order to read the file. 4
About Anchors
ODS HTML automatically creates an anchor for every piece of output generated by
the SAS procedures. An anchor specifies a particular location within an HTML file. In
SAS/GRAPH, an anchor usually defines a link target such as a graph whose location is
defined in an IMG element.
Controlling the anchor name is useful when you create a graph with drill-down
capability. In this case, you must create a variable that contains the names of the
anchors that are the targets for the different areas of the graph that the user may click
on.
PATTERN Statement
The PATTERN statement defines the characteristics of patterns used in graphs.
Used by:
GCHART, GCONTOUR, GMAP, GPLOT procedures; SYMBOL statement;
Annotate facility
Global
Assigned by default
Description
PATTERN statements create PATTERN definitions that define the color and type of
area fill for patterns used in graphs. These are the procedures and the graphics areas
that they create that use PATTERN definitions:
GCHART color, fill pattern, or image for the bars in 2D bar charts; color and
fill pattern for the segments of 3D bar charts, pie charts, and star
charts.
GCONTOUR contour levels in contour plots
GMAP map areas in choropleth, block, and prism maps; blocks in block
maps
GPLOT areas beneath or between plotted lines.
In addition, the SYMBOL statement and certain Annotate facility functions and
macros can use pattern specifications. For details see the “SYMBOL Statement” on
page 183 and Chapter 24, “Using Annotate Data Sets,” on page 587.
You can use the PATTERN statement to control the fill and color of a pattern, and
whether the pattern is repeated. There are three types of patterns:
3 bar and block patterns
3 map and plot patterns
3 pie and star patterns
Pattern fills can be solid or empty, or composed of parallel or crosshatched lines. For
two-dimensional bar charts, the PATTERN statement can specify images to fill
horizontal or vertical bars. In addition, you can specify device-dependent hardware
patterns for rectangle, polygon, and pie fills on devices that support hardware patterns.
If you do not create PATTERN definitions, SAS/GRAPH software generates them as
needed and assigns them to your graphs by default. Generally, the default behavior is
to rotate a solid pattern through the current colors list. For details, see “About Default
Patterns” on page 177.
Syntax
PATTERN<1...255>
<COLOR=pattern-color>
<REPEAT=number-of-times>
170 PATTERN Statement Chapter 7
<VALUE=bar/block-pattern
| map/plot-pattern
| pie/star-pattern
| hardware-pattern>;
Options
COLOR=pattern-color
C=pattern-color
specifies the color of the fill. Pattern-color is any SAS/GRAPH color name. See
Chapter 6, “SAS/GRAPH Colors and Images,” on page 91 .
Note: ActiveX assigns colors in a different order from Java, so the same data
can appear differently with those two drivers. 4
Using COLOR= with a null value cancels the color specified in a previous
PATTERN statement of the same number without affecting the values of other
options.
COLOR= overrides the CPATTERN= graphics option.
The CFILL= option in the PIE and STAR statements overrides COLOR=. For
details, see “Controlling Slice Patterns and Colors” on page 831.
CAUTION:
Omitting COLOR= in a PATTERN statement may cause the PATTERN statement to
generate multiple PATTERN definitions. 4
If no color is specified for a PATTERN statement, that is, if neither COLOR=
nor CPATTERN= is used, the PATTERN statement rotates the specified fill
through each color in the colors list before the next PATTERN statement is used.
For details, see “Understanding Pattern Sequences” on page 182.
See also: “Working with PATTERN Statements” on page 179.
Featured in: “Example 7. Using BY-group Processing to Generate a Series of
Charts” on page 240.
Not supported by: Java (partial), ActiveX (partial)
SAS/GRAPH Statements PATTERN Statement 171
If no valid patterns are available, default bar and block fill patterns are selected
in this order:
1 SOLID
SAS/GRAPH Statements PATTERN Statement 173
2 X1– X5
3 L1– L5
4 R1– R5
Each fill is used once with every color in the colors list unless a pattern color is
specified. The entire sequence is repeated as many times as required to provide
the necessary number of patterns.
Note: If the V6COMP graphics option is in effect, or if color is limited to a
single color with the CPATTERN= or COLORS= graphics options, the order is X1–
X5, L1– L5, R1– R5, S, and E. 4
Not supported by: Java (partial), ActiveX (partial)
VALUE=map/plot-pattern
V=map/plot-pattern
specifies patterns for:
3 contour levels in contour plots produced by the GCONTOUR procedure
3 map area surfaces in block, choropleth, and prism maps produced by the
BLOCK, CHORO, AND PRISM statements in the GMAP procedure.
3 areas under curves in plots produced by the AREAS= option in the PLOT
statement in the GPLOT procedure.
Values for map/plot-pattern are
MEMPTY an empty pattern. EMPTY or E are also valid aliases, except
ME when used with the map areas in block maps created by the
GMAP procedure.
MSOLID a solid pattern. SOLID or S are also valid aliases, except when
MS used with the map areas in block maps created by the GMAP
procedure.
Mdensity<style<angle>> a shaded pattern.
Note: Mdensity<style<angle>> is not supported by the Java
or ActiveX clients. 4
0o
M3N0 M3X0
o
45
M3N45 M3X45
90o
M3N90 M3X90
135o
M3N135 M3X135
If no valid patterns are available, default map and plot fill patterns are selected
in this order:
1 MSOLID
2 M2N0
3 M2N90
4 M2X45
5 M4N0
6 M4N90
7 M4X90
Each fill is used once with every color in the colors list unless a pattern color is
specified. The entire sequence is repeated as many times as required to provide
the necessary number of patterns.
Note: If the V6COMP graphics option is in effect, or if color is limited to a
single color with the CPATTERN= or COLORS= graphics options, MSOLID is not
used and the default fill list starts with M2N0. 4
Not supported by: Java (partial), ActiveX (partial)
VALUE=pie/star-pattern
V=pie/star-pattern
specifies patterns for pie and star charts produced by the PIE and STAR
statements in the GCHART procedure. Values for pie/star-pattern are
PEMPTY an empty pattern. EMPTY or E are also valid aliases.
PE
PSOLID a solid pattern. SOLID or S are also valid aliases.
PS
Pdensity<style<angle>> a shaded pattern.
SAS/GRAPH Statements PATTERN Statement 175
o
0
P3N0 P3X0
o
45
P3N45 P3X45
o
90
P3N90 P3X90
o
135
P3N135 P3X135
If no valid patterns are available, default pie and star fill patterns are selected
in this order:
1 PSOLID
2 P2N0
3 P2N90
176 Using the PATTERN Statement Chapter 7
4 P2X45
5 P4N0
6 P4N90
7 P4X90
Each fill is used once with every color in the colors list unless a pattern color is
specified. The entire sequence is repeated as many times as required to provide
the necessary number of patterns.
Note: If the V6COMP graphics option is in effect, or if color is limited to a
single color with the CPATTERN= or COLORS= graphic options, PSOLID is not
used and the default fill list starts with P2N0. 4
Note: If you use hatch patterns and request a legend instead of slice labels, the
patterns in the slices are oriented to be visually equivalent to the legend. 4
Not supported by: Java (partial), ActiveX (partial)
VALUE=HWxxxnnn
specifies a hardware pattern where
HW identifies the pattern as a hardware pattern. The pattern name
must begin with the characters HW.
xxx the last two or three characters of the module name in the
Module field in the Detail window of your device entry. If the
module name has eight characters (SASGDPSL, for example),
use the last three characters (PSL). If the module name has
only seven characters (SASGDVT, for example), use the last
two characters (VT).
nnn the number the driver uses to identify the device-dependent
pattern. Patterns and associated pattern numbers vary from
device to device. See the documentation for your device for
valid pattern numbers. For a brief description of some device
specific pattern values, see “Specifying Device-Dependent
Hardware Patterns” on page 181.
If you specify a hardware pattern for a device that does not support hardware
patterns, or if you specify an invalid pattern number, a solid rectangle, polygon, or
pie fill is substituted. A solid fill will also be used in place of a hardware pattern
in certain types of clipped polygons. See the PCLIP and POLYGONCLIP options
in Chapter 8, “Graphics Options and Device Parameters Dictionary,” on page 261
for more information on using hardware patterns with clipped polygons.
See also: “Specifying Device-Dependent Hardware Patterns” on page 181.
Not supported by: Java (partial), ActiveX (partial)
description of COLOR= on page 170, VALUE= on page 173, and IMAGE= on page 171
options.
PATTERN definitions are generated in the order in which the statements are
numbered, regardless of gaps in the numbering or the statement’s position in the
program. Although it is common practice, you do not have to start with PATTERN1,
and you do not have to use sequential statement numbers.
PATTERN definitions are applied automatically to all areas of the graphics output
that require patterns. When assigning PATTERN definitions, SAS/GRAPH starts with
the lowest-numbered definition with an appropriate fill specification or with no fill
specification. It continues to use the specified patterns until all valid PATTERN
definitions have been used. Then, if more patterns are required, SAS/GRAPH returns
to the default pattern rotation, but continues to outline the areas in the same color as
the fill.
This statement cancels only REPEAT= without affecting the rest of the definition:
pattern4 repeat=;
Add or change options in the same way. This statement changes the color of the
pattern from red to blue:
pattern4 color=blue;
Canceling one PATTERN statement does not affect any other PATTERN definitions.
To cancel all current PATTERN statements, use the RESET= option in a GOPTIONS
statement:
goptions reset=pattern;
3 automatically generates the appropriate default patterns and outlines to fill the
areas, or
3 uses patterns, colors, and outlines that are defined by PATTERN statements,
graphics options, and procedure options.
In order to understand how SAS/GRAPH generates and assigns patterns defined
with PATTERN statements it is helpful to understand how it generates and assigns
default patterns. The following sections describe the default pattern behavior for all
procedures. See “Working with PATTERN Statements” on page 179 for details about
defining patterns.
pattern1 value=r3;
In this case, the PATTERN statement rotates the R3 fill through all the colors in the
colors list. For more information on pattern rotation, see “Understanding Pattern
Sequences” on page 182.
With... Use...
Note: If you specify a fill that is inappropriate for the type of graph you are
generating (for example, if you specify VALUE=L1 in a PATTERN statement for a
choropleth map), SAS/GRAPH ignores the PATTERN statement and continues
searching for a valid pattern. If it does not find a definition with a valid fill
specification, it uses default patterns instead. 4
3 With a PATTERN statement that only specifies a color (COLOR=), the COLOR=
option overrides the CPATTERN= color, but CPATTERN= causes the fill to be
SAS/GRAPH Statements Specifying Device-Dependent Hardware Patterns 181
hatched, not the default SOLID. For example, these statements produce one red,
hatched pattern:
goptions cpattern=green;
pattern1 color=red;
GDDM Drivers
GDDM drivers include several sets of hardware patterns. These patterns include both
predefined and user-defined (device-dependent) fill patterns. When you use a hardware
pattern with a GDDM driver, specify the name of the device-dependent pattern set you
want the driver to use. This name will be stored in the GPROLOG string in the device
entry for the driver. Specify the name of the pattern set in either of these ways:
3 Use the GPROLOG= graphics option to assign the pattern set name to the
GPROLOG string.
3 Enter the pattern set name in the Gprolog window of the device entry for the
GDDM device driver.
If you do not specify a pattern set name, the device uses a predefined pattern.
Values for nnn for predefined patterns are 1 through 16. Values for nnn for
device-dependent patterns are 65 through 128.
Information regarding both types of fill patterns can be found in GDDM Application
Programming Guide. For additional information on specifying hardware patterns with
GDDM drivers, see also the GDDM Base Programming Reference.
HPLJxxxx Drivers
HPLJxxxx drivers for the HP LaserJet support the predefined shading levels and
predefined fill patterns for rectangle fill only. These patterns are documented in the
appropriate HP LaserJet technical manual. Values for nnn for shading levels are 001
through 008. Values for fill patterns are 009 through 014.
Metagraphics Drivers
Metagraphics drivers can use the hardware patterns supported by the device for
which they are written. When you specify hardware patterns for a metagraphics driver,
values of nnn can range from 0 through 999.
182 Understanding Pattern Sequences Chapter 7
Here, PATTERN1 generates the first PATTERN definition. PATTERN2 omits COLOR=,
so the specified fill is rotated through all three colors in the colors list before the
PATTERN3 statement is used. This table shows the color and fill of the PATTERN
definitions that would be generated if nine patterns were required:
Definition Characteristics:
Number Source Color Fill
1 PATTERN1 red x3
2 PATTERN2 blue r3
3 PATTERN2 red r3
4 PATTERN2 green r3
5 PATTERN3 blue l3
Notice that after all the PATTERN statements are exhausted, the procedure begins
using the default bar and block patterns, beginning with SOLID. Each fill from the
default list is rotated through all three colors in the colors list before the next default
fill is used.
SAS/GRAPH Statements SYMBOL Statement 183
Here, PATTERN1 is used twice and PATTERN2 cycles through the list of three colors
and then repeats this cycle a second time:
3 PATTERN2 red x1
4 PATTERN2 blue x1
5 PATTERN2 green x1
6 PATTERN2 red x1
7 PATTERN2 blue x1
8 PATTERN2 green x1
SYMBOL Statement
The SYMBOL statement defines the characteristics of symbols that display the data
plotted by a PLOT statement used by PROC GBARLINE, PROC GCONTOUR, and
PROC GPLOT.
Used by:
GBARLINE, GCONTOUR, GPLOT procedures
Global
Assigned by default
Description
SYMBOL statements create SYMBOL definitions, which are used by the GPLOT and
GCONTOUR procedures. For the GPLOT procedure, SYMBOL definitions control
3 the appearance of plot symbols and plot lines, including bars, boxes, confidence
limit lines, and area fills
3 interpolation methods
3 how plots handle data out of range.
For the GCONTOUR procedure, SYMBOL definitions control
3 the appearance and text of contour labels
3 the appearance of contour lines.
184 SYMBOL Statement Chapter 7
If you create SYMBOL definitions, they are automatically applied to a graph by the
procedure. If you do not create SYMBOL definitions, these procedures generate default
definitions and apply them as needed to your plots.
Syntax
SYMBOL<1...255>
<COLOR=symbol-color>
<MODE=EXCLUDE | INCLUDE>
<REPEAT=number-of-times>
<STEP=distance<units>>
<appearance-option(s)>
<interpolation-option>
<SINGULAR=n>;
appearance-options can be one or more of these:
BWIDTH=box-width
CI=line-color
CO=color
CV=value-color
FONT=font
HEIGHT=symbol-height<units>
LINE=line-type
POINTLABEL<=(label-description(s)) | NONE>
VALUE=special-symbol | text-string | NONE
WIDTH=thickness-factor
interpolation-option can be one of these:
3 general methods
INTERPOL=JOIN
INTERPOL=map/plot-pattern
INTERPOL=NEEDLE
INTERPOL=NONE
INTERPOL=STEP<placement><J><S>
3 high-low interpolation methods
INTERPOL=BOX<option(s)><00...25>
INTERPOL=HILO<C><option(s)>
INTERPOL=STD<1 | 2 | 3><variance><option(s)>
3 regression interpolation methods
INTERPOL=R<type><0><CLM | CLI<50...99>>
3 spline interpolation methods
INTERPOL=L<degree><P><S>
INTERPOL=SM<nn><P><S>
INTERPOL=SPLINE<P><S>
Options
When the syntax of an option includes units, use one of these:
CELLS character cells
SAS/GRAPH Statements SYMBOL Statement 185
CM centimeters
IN inches
PCT percentage of the graphics output area
PT points.
If you omit units, a unit specification is searched for in this order:
1 the GUNIT= option in a GOPTIONS statement
2 the default unit, CELLS.
BWIDTH=box-width
specifies the width of the box generated by either the INTERPOL=BOX or
INTERPOL=HILOB option. Box-width can be any number greater than 0. By
default, the value of box-width is the same as the value of the WIDTH= option,
whose default value is 1. Therefore, if you specify a value for WIDTH= and omit
BWDITH=, the width of the box changes accordingly.
Featured in: “Example 4. Creating and Modifying Box Plots” on page 233.
CI=line-color
specifies a color for an interpolation line (GPLOT) or a contour line (GCONTOUR).
If you omit CI= but specify CV=, CI= assumes the value of CV=. In this case, CI=
and CV= specify the same color, which is the same as specifying COLOR= alone.
If you omit CI=, the color specification is searched for in this order:
1 the CV= option
2 the COLOR= option
3 the CSYMBOL= option in a GOPTIONS statement
4 each color in the colors list sequentially before the next SYMBOL definition is
used.
See also: “Using Color” on page 206
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226
CO=color
specifies a color for
3 outlines of filled areas generated by the INTERPOL=map/plot-pattern option
3 confidence limit lines generated by the INTERPOL=R series option
3 staffs, boxes, and bars generated by the high-low interpolation methods:
INTERPOL=HILO, INTERPOL=BOX, and INTERPOL=STD.
If you omit the CO= option, the search order for a color specification depends on
the interpolation method being used.
See also: “Using Color” on page 206
Featured in: “Example 5. Filling the Area between Plot Lines” on page 236 and
“Example 4. Creating and Modifying Box Plots” on page 233.
COLOR=symbol-color
C=symbol-color
specifies a color for the entire definition, unless it is followed by a more explicit
specification. For the GPLOT procedure, this includes plot symbols, the plot line,
confidence limit lines, and outlines. For the GCONTOUR procedure, this includes
contour lines and labels.
Using the COLOR= option is exactly the same as specifying the same color for
both the CI= and CV= options.
186 SYMBOL Statement Chapter 7
If COLOR= precedes CI= or CV= in the same statement, CI= or CV= is used
instead.
If you do not use COLOR= or CI=, CV=, and CO=, the color specification is
searched for in this order:
1 the CSYMBOL= option in a GOPTIONS statement
2 each color in the colors list sequentially before the next SYMBOL definition is
used.
If you do not use a SYMBOL statement to specify a color for each symbol, but
you do specify a colors list in a GOPTIONS statement, then Java and ActiveX
assign colors to symbols differently than does the SAS server. To ensure
consistency on all devices, you should specify the desired color of each symbol. The
SAS server restarts at the first color in the colors list and rotates through all of
the colors in the color list for the first default symbol before going to the next
symbol in the default symbol list where it again rotates through all of the colors in
the color list before picking up the next symbol.
Note: Neither the Java applet nor the ActiveX control supports using COLOR=
with PROC GCONTOUR. 4
See also: “Using Color” on page 206
Not supported by: Java (partial), ActiveX (partial)
CV=value-color
specifies a color for
3 plot symbols in the GPLOT procedure
3 the filled areas generated by the INTERPOL=map/plot-pattern option
3 contour labels in the GCONTOUR procedure.
If you omit CV= but specify CI=, CV= assumes the value of CI=. In this case,
CV= and CI= specify the same color, which is the same as specifying COLOR=
alone.
If you omit CV=, the color specification is searched for in this order:
1 the CI= option
2 the COLOR= option
3 the CSYMBOL= option in a GOPTIONS statement
4 each color in the colors list sequentially before the next SYMBOL definition is
used.
Note: Neither the Java applet nor the ActiveX control supports using CV= with
PROC GCONTOUR. 4
See also: “Using Color” on page 206
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226, “Example 5. Filling the Area between Plot Lines” on page 236, and
“Example 4. Creating and Modifying Box Plots” on page 233.
Not supported by: Java (partial), ActiveX (partial)
FONT=font
F=font
specifies the font for the plot symbol (GPLOT) or contour-label text (GCONTOUR)
specified by VALUE=. The font specification can be
3 the name of a software font. For example, FONT=MARKER specifies a
software font that is stored in the catalog SASHELP.FONTS.
3 a hardware font specification of the form HWxxxnnn or hardware-font-name:
HWxxxnnn
SAS/GRAPH Statements SYMBOL Statement 187
HW identifies the font as a hardware font, xxx are the last two or three
characters of the module name as listed in the Module field in the device
entry’s Detail window, and nnn is the Chartype number of the hardware
font as listed in the device entry’s Chartype window (for example,
FONT=HWDMX001).
hardware-font-name
specifies the name of a hardware font as shown in the device entry’s
Chartype window (for example, FONT="Palatino-Italic"). The name
must be enclosed in double quotation marks.
By default, no font is specified. The symbol specified by VALUE= is taken from
the special symbol table shown in Figure 7.21 on page 202. To use symbols from
the special symbol table, omit FONT=.
You can use FONT= to specify a symbol font, such as Marker, that contains a
symbol that you want to use in your plot. In this case, the string specified by
VALUE= is the character code for the symbol. For example, this definition
specifies a heart:
symbol font=marker value=N;
You can also use FONT= to specify a text font, such as Swiss. In this case, the
string specified by VALUE= appears in the plot:
symbol font=swiss value=star;
See also: the VALUE= on page 199 option , “Specifying Plot Symbols” on page
205, and Chapter 5, “SAS/GRAPH Fonts,” on page 75.
Featured in: Example 2 on page 906
Not supported by: Java, ActiveX
HEIGHT=symbol-height<units>
H=symbol-height<units>
specifies the height in number of units of plot symbols (GPLOT) or contour labels
(GCONTOUR).
Note: HEIGHT= affects only the height of the symbols and labels on the plot;
it does not affect the height of any symbols that may appear in a legend.
The HEIGHT option overrides the MarkerSize attribute in graph styles. For
more information on graph styles, see SAS Output Delivery System: User’s
Guide. 4
Note: With client-side rendering using Java, the minimum height is 2 pixels;
with ActiveX a symbol may be so small as to be invisible.
Neither the Java applet nor the ActiveX control supports HEIGHT= with PROC
GCONTOUR. 4
See also: the option SHAPE= on page 156 in the LEGEND statement
Featured in: “Example 4. Creating and Modifying Box Plots” on page 233,
“Example 3. Rotating Plot Symbols through the Colors List” on page 231, and
Example 2 on page 906.
Not supported by: Java (partial), ActiveX (partial)
INTERPOL=BOX<option(s)><00...25>
I=BOX<option(s)><00...25>
188 SYMBOL Statement Chapter 7
produces box and whisker plots. The bottom and top edges of the box are located
at the sample 25th and 75th percentiles. The center horizontal line is drawn at
the 50th percentile (median). By default, INTERPOL=BOX, in which case the
vertical lines, or whiskers, are drawn from the box to the most extreme point
within 1.5 interquartile ranges. (An interquartile range is the distance between
the 25th and the 75th sample percentiles.) Any value more extreme than this is
marked with a plot symbol.
Values for option(s) are one or more of these:
F fills the box with the color specified by CV= and outlines the
box with the color specified by CO=
J joins the median points of the boxes with a line
T draws tops and bottoms on the whiskers.
In addition, you can specify a percentile to control the length of the whiskers
within the range 00 through 25. These are examples of percentile specifications
and their effect:
00 high/low extremes. INTERPOL=BOX00 is not the same as the
default, INTERPOL=BOX.
01 1st percentile low, 99th high
05 5th percentile low, 95th high
10 10th percentile low, 90th high
25 25th percentile low, 75th high; since the box extends from the
25th to the 75th percentile, no whiskers are produced.
Figure 7.15 on page 188 shows the type of plot INTERPOL=BOX produces.
Y
50
40
30
20
10
0
A B C
X
To increase the width of the box itself, use the BWIDTH= option. By default the
value of BWIDTH= is the same as the value of WIDTH=. Therefore, if you specify
a value for WIDTH= and omit BWIDTH=, the width of the box changes.
For a scatter effect with the box, use a multiple plot request, as in this example:
symbol1 i=none v=star color=green;
symbol2 i=box v=none color=blue;
proc gplot data=test;
plot (y y)*x / overlay;
This option cannot be used in a symbol definition that is named in the GPLOT
procedure, when that procedure is generating output for the Web using a Java
device driver. This applies only when the PLOT statement is used with the
OVERLAY option, or when the PLOT2 statement is used, with or without the
OVERLAY option.
Featured in: “Example 4. Creating and Modifying Box Plots” on page 233.
Not supported by: Java (partial)
INTERPOL=HILO<C><option>
I=HILO<C><option>
specifies that a solid vertical line connect the minimum and maximum Y values for
each X value. The data should have at least two values of Y for every value of X;
otherwise, the single value is displayed without the vertical line.
By default, for each X value, the mean Y value is marked with a tick. This is
shown in Figure 7.16 on page 190.
To specify high, low, close stock market data, include this option:
C draws tick marks at the close value instead of at the mean
value. Specifying C assumes that there are three values of Y
(HIGH, LOW, and CLOSE) for every value of X. If more or
fewer than three Y values are specified, the mean is ticked.
The Y values can be in any order in the input data set.
In addition, you can specify one of these values for option:
B connects the minimum and maximum Y values with bars
instead of lines. Use the BWIDTH= option to increase the
width of the bars.
J joins the mean values or the close values (if HILOC is
specified) with a line. This point is not marked with a tick
mark. You cannot use the PLOT statement option AREAS=
with INTERPOL=HILOJ.
T adds tops and bottoms to each line.
BJ connects maximum and minimum values with a bar and joins
the mean or close values.
TJ adds tops and bottoms to the lines and joins the mean or close
values.
Figure 7.16 on page 190 shows the type of plot INTERPOL=HILO produces.
Plot symbols in the form of dots have been added to this figure.
190 SYMBOL Statement Chapter 7
Y
50
40
30
20
10
0
A B C
X
values of the horizontal variable are not strictly increasing, the corresponding
parametric method (L1P, L3P, or L5P) is used.
Specifying INTERPOL=L1P, INTERPOL=L3P, or INTERPOL=L5P results in a
parametric Lagrange interpolation of degree 1, 3, or 5, respectively. Both the
horizontal and vertical variables are processed with the Lagrange method and a
parametric interpolation of degree 1, 3, or 5, using the distance between points as
a parameter.
INTERPOL=map/plot-pattern
I=map/plot-pattern
specifies that a pattern fill the polygon that has been defined by the data points.
Values for map/plot-pattern are
MEMPTY
ME
an empty pattern. EMPTY and E are valid aliases.
The Java applet does not support this option.
MSOLID
MS
a solid pattern. SOLID and S are valid aliases
Mdensity<style<angle>>
a shaded pattern. (The Java applet does not support this option.)
Density specifies the density of the pattern’s shading:
1...5 1 produces the lightest shading and 5 produces the
heaviest.
Style specifies the direction of pattern lines:
N parallel lines (the default)
X crosshatched lines.
Angle specifies the starting angle for parallel or crosshatched lines:
0...360 the degree at which the parallel lines are drawn. By
default, angle is 0 (lines are parallel to the horizontal
axis).
The INTERPOL=map/plot-pattern option only works if the data are structured
so that the data points and, consequently, the plot lines form an enclosed area.
The plot lines should not cross each other.
See also: the “PATTERN Statement” on page 169
Featured in: “Example 5. Filling the Area between Plot Lines” on page 236
Not supported by: Java (partial)
INTERPOL=NEEDLE
I=NEEDLE
draws a vertical line from each data point to a horizontal line at the 0 value on the
vertical axis or the minimum value on the vertical axis if it is greater than 0. The
horizontal line is drawn automatically.
Figure 7.17 on page 192 shows the type of plot INTERPOL=NEEDLE produces.
Plot symbols are not displayed in this figure.
192 SYMBOL Statement Chapter 7
Y
20
10
10
20
1 2 3 4 5 6
X
Y
30
*
20 *
** * *
*
** * *
10 * *
* ***
0 *
* Reinsch, C.H. (1967), “Smoothing by Spline Functions,” Numerische Mathematik, 10, 177–183.
194 SYMBOL Statement Chapter 7
t = (x2 + y2)
If two points are so close together that the computations
overflow, the second point is not used.
S sorts a data set by the independent variable before plotting its
data.
Note: When points on the graph are out of range of the axis values, the curve is
clipped. If an end point is out of range, no curve is drawn. Out-of-range conditions
may be caused by restricting the range of axis values with the HAXIS= or VAXIS=
option in the PLOT statement or the ORDER= option in an AXIS definition.
Note: When points on the graph are close together and a spline interpolation is
used, the Java applet is unable to draw some line types correctly. 4
4
INTERPOL=STD<1 | 2 | 3><variance><option(s)>
I=STD<1 | 2 | 3><variance><option(s)>
specifies that a solid line connect the mean Y value with ± 1, 2, or 3 standard
deviations for each X.
Note: By default, 2 standard deviations are used. 4
** Pizer, Stephen M. (1975), Numerical Computing and Mathematical Analysis, Chicago: Science Research Associates, Inc.,
Chapter 4.
SAS/GRAPH Statements SYMBOL Statement 195
The sample variance is computed about each mean, and from it, the standard
deviation sy is computed. Variance can be one or both of these:
M computes sy ,
P computes sample variances using a pooled estimate, as in a
one-way ANOVA model.
In addition, specify one of these values for option(s):
B connects the minimum and maximum Y values with bars
instead of lines.
J connects the means from bar to bar with a line.
T adds tops and bottoms to each line.
BJ connects maximum and minimum values with a bar and joins
the mean values.
TJ adds tops and bottoms to the lines and joins the mean values.
Figure 7.19 on page 195 shows the type of plot INTERPOL=STD produces. A
horizontal tick is drawn at the mean. Plot symbols in the form of dots have been
added to this figure.
Y
60
50 ●
●
40 ●
● ●
●
30 ●
●
●
● ●
20 ●
10
0
A B C
X
Note: By default, the vertical axis ranges from the minimum to the maximum
Y value in the data. If the requested number of standard deviations from the
mean covers a range of values that exceeds the maximum or is less than the
minimum, the STD lines are cut off at the minimum and maximum Y values.
When this cutoff occurs, rescale the axis using VAXIS= in the PLOT statement or
ORDER= in an AXIS definition so that the STD lines are shown. 4
If you restrict the range of axis values by using HAXIS= or VAXIS= in a PLOT
statement or ORDER= in an AXIS definition, by default any observations that fall
outside the axis range are excluded from the interpolation calculation. See the
MODE= on page 197 option.
To increase the thickness of all lines generated by the INTERPOL=STD option,
use the WIDTH= option.
You cannot use the PLOT statement option AREAS= with INTERPOL=STD.
This option cannot be used in a symbol definition that is named in the GPLOT
procedure, when that procedure is generating output for the Web using a Java
device driver. This applies only when the PLOT statement is used with the
196 SYMBOL Statement Chapter 7
OVERLAY option, or when the PLOT2 statement is used, with or without the
OVERLAY option.
Not supported by: Java (partial)
INTERPOL=STEP<placement><J><S>
I=STEP<placement><J><S>
specifies that the data are plotted with a step function. By default, the data point
is on the left of the step, the steps are not joined with a vertical line, and the data
are not sorted before processing.
Specify one of these values for placement:
L displays the data point on the left of the step.
R displays the data point on the right of the step.
C displays the data point in the center of the step.
Note: When a step is retraced in order to locate its center
point, both the server and Java treat this as effectively not
drawing that part of the step at all. ActiveX, however, draws
each part of the step—resulting in a somewhat differently
appearing graph. 4
In addition, specify one or both of these:
J produces steps joined with a vertical line.
S sorts unordered data by the independent variable before
plotting.
Figure 7.20 on page 196 shows the type of plot INTERPOL=STEPJR produces.
Plot symbols in the form of dots have been added to this figure.
Y
100 ●
●
75
50 ●
25 ●
●
0 ● ●
1 2 3 4 5 6 7
X
LINE=line-type
L=line-type
specifies the line type of the plot line in the GPLOT procedure, or the contour line
in the GCONTOUR procedure:
1 a solid line.
2...46 a dashed line.
Line types are shown in Figure 7.22 on page 208. By default, LINE=1.
Note: This option overrides the LineStyle attribute in graph styles. For more
information on graph styles, see SAS Output Delivery System: User’s Guide.
SAS/GRAPH Statements SYMBOL Statement 197
Neither the Java applet nor ActiveX control supports client-side rendering for
GCONTOUR. 4
Not supported by: Java (partial), ActiveX (partial)
MODE=EXCLUDE | INCLUDE
specifies that interpolation calculations exclude or include data values that are
outside the range of plot axes. By default, MODE=EXCLUDE, which excludes
values outside the axis range from any calculations.
If you control the range of values displayed on an axis by using HAXIS= and
VAXIS= in the GPLOT procedure, or ORDER= in an AXIS definition, any data
points that lie outside of the range of the axes are discarded before the
calculations are done for interpolation lines. This has a particularly noticeable
effect on the high-low interpolation methods, which include INTERPOL=HILO,
INTERPOL=BOX, and INTERPOL=STD. Regression analysis also represents only
part of the original data.
See also: “Values Out of Range” on page 1087.
POINTLABEL<=(label-description(s)) | NONE>
labels plot points. The labels always use the format that is assigned to the
variable(s) whose values are used for the labels. POINTLABEL without any
specified descriptions labels points with the Y value. NONE suppresses the point
labels. Label-description(s) can be used to change the variable whose values are
used to label points, and/or to change features of the label text, such as the color,
font, or size of the text.
Note: If you do not specify a color on a SYMBOL statement, the symbol
definition is rotated through the colors list before the next SYMBOL statement is
used. Thus, if your plot contains multiple plot lines and you want to limit your
POINTLABEL specification to a single line, you must specify a color on the
SYMBOL statement that contains the POINTLABEL description. 4
Label-description(s) can be one or more of these:
COLOR=text-color
C=text-color
specifies the color of the label text. The default is the first color from the
colors list.
FONT=font | NONE
F=font | NONE
specifies the font for the text. See Chapter 5, “SAS/GRAPH Fonts,” on page
75 for details on specifying font. If you omit FONT=, a font specification is
searched for in this order:
1 the FTEXT= option in a GOPTIONS statement
2 the default hardware font, NONE.
HEIGHT=text-height <units >
H=text-height <units >
specifies the height of the text characters in number of units. By default,
HEIGHT=1 CELL. If you omit HEIGHT=, a text height specification is
searched for in this order:
1 the HTEXT= option in a GOPTIONS statement
2 the default value, 1.
JUSTIFY=CENTER | LEFT | RIGHT
J=C | L | R
specifies the horizontal alignment of the label text. The default is CENTER.
The location of the point label is relative to the location of the corresponding
data point.
198 SYMBOL Statement Chapter 7
Alternatively, you can label the plot points with the values of the X and Y
variables, in either order. The order that you specify X and Y in the variable
specification determines the order that the values are displayed in the label.
The following option specifies variables HEIGHT and WEIGHT; in the label,
the value for HEIGHT will be displayed, followed by the value for WEIGHT:
POINTLABEL=("#height:#weight")
The variables that you specify must be the plot’s X and Y variables.
Specifying any other variables will cause unexpected labeling.
By default when you specify both the X and Y variables, a colon (:) displays
in the label to separate the values in each label. To change the character that
displays as the delimiter, use the $ syntax to specify an alternative character.
The following option specifies a vertical bar (|) as the delimiter in the label:
POINTLABEL=("#height:#weight $|")
The $ syntax must be within the same quotation marks as the variable
specification. The $ specification can precede or follow the variable
specification, but it must be separated from the variable specification by at
least one space.
Note: Specifying a delimiting character with the $ only changes the
character that displays in the label. It does not change the syntax of the
variable specification, which requires a colon and pound sign (:#) to precede
the second variable. 4
Note: There is a sixteen character length limit for each variable. A
maximum character length limit of thirty-three characters is possible. This
can be composed of X and Y variables, any other valid data set variable, and
a separator as required. 4
Specify as many label-description suboptions as you want. Enclose them all
within a single set of parentheses, and separate each suboption from the others by
at least one space.
Not supported by: Java (partial), ActiveX (partial)
REPEAT=number-of-times
R=number-of-times
SAS/GRAPH Statements SYMBOL Statement 199
specifies the number of times that a SYMBOL definition is applied before the next
SYMBOL definition is used. By default, REPEAT=1.
The behavior of REPEAT= depends on whether any of the SYMBOL color options
(CI=, CV=, CO=, and COLOR=) or the CSYMBOL= graphics option also is used:
3 If any SYMBOL color option also is used in the SYMBOL definition, that
SYMBOL definition is repeated the specified number of times in the specified
color.
3 If no SYMBOL color option is used but the CSYMBOL= graphics option is
currently in effect, the SYMBOL definition is repeated the specified number
of times in the specified color.
3 If no SYMBOL statement color options are used and the CSYMBOL=
graphics option is not used, the SYMBOL definition is cycled through each
color in the colors list, and then the entire group generated by this cycle
repeats the number of times specified by REPEAT=. Thus, the total number
of iterations of the SYMBOL definition depends on the number of colors in
the current colors list.
Neither the Java applet nor ActiveX control supports client-side rendering
for GCONTOUR.
See also: “Using the SYMBOL Statement” on page 202.
Not supported by: Java (partial), ActiveX (partial)
SINGULAR=n
tunes the algorithm used to check for singularities. The default value is machine
dependent but is approximately 1E-7 on most machines. This option is rarely
needed.
STEP=distance<units>
specifies the minimum distance between labels on contour lines. The value of
distance must be greater than zero. By default, STEP=65PCT.
Note: If you specify units of PCT or CELLS, STEP= calculates the distance
between the labels based on the width of the graphics output area, not the height.
For example, if you specify STEP=50PCT and if the graphics output area is 9
inches wide, the distance specified is 4.5 inches. A value less than 10 percent is
ignored and 10 percent is used instead. 4
When you use STEP=, specify the minimum distance that you want between
labels. The option then calculates how many labels it can fit on the contour line,
taking into account the length of the labels and the minimum distance you
specified. Once it has calculated how many labels it can fit while retaining the
minimum distance between them, it places the labels, evenly spaced, along the
line. Consequently, the space between labels may be greater than what you
specify, although it will never be less.
In general, to increase the number of labels from the default, reduce the value
of distance.
If the procedure cannot write the label at a particular location on the contour,
for example because the contour line makes a sharp turn, the label may be placed
farther along the line or omitted. If labels are omitted, a note appears in the log.
Specifying a low value for the GCONTOUR procedure’s TOLANGLE= option may
also cause labels to be omitted, since this forces the procedure to select smoother
labeling locations, which may not be available on some contours.
Featured in: Example 2 on page 906.
Not supported by: Java, ActiveX
VALUE=special-symbol | text-string | NONE
V=special-symbol | text-string | NONE
200 SYMBOL Statement Chapter 7
3 specifies a plot symbol for the data points (GPLOT and GBARLINE). If you
omit the SYMBOL statement, plot points are generated using the default plot
symbol. The default symbol is a square if you use the ActiveX or Java devices
and a PLUS sign for other devices. If you specify a SYMBOL statement, but
do not specify the VALUE= option, plot symbols are suppressed.
Note: For ActiveX output, the VALUE= option is not supported when
INTERPOL=HILO or INTERPOL=STD. You can use the OVERLAY option
with GPLOT to get symbols to appear on the data points. 4
3 specifies contour-label text in a contour plot (GCONTOUR). By default with
the AUTOLABEL option, GCONTOUR labels contour lines with the contour
variable’s value at that contour level.
3 VALUE=NONE suppresses plot symbols at the data points, or labels on the
contour lines. You can set the VALUE=NONE option independent of the
INTERPOL= option.
Values for special-symbol are the names and characters shown in Figure 7.21 on
page 202. The special symbol table can be used only if the FONT= option is not
used or a null value is specified:
font=,
value="’"
Java and ActiveX support the following characters from the marker font for
special-symbol:
Character Aliases
Star
Circle Sphere, Dot, Balloon
Plus Cross
Flag Y
SAS/GRAPH Statements SYMBOL Statement 201
Character Aliases
X
Prism Z
Spade “
Heart #
Diamond $
Club %
Hexagon Paw
Cylinder Hash
Note: If you do not use a SYMBOL statement to specify a color for each
symbol, but you do specify a colors list in a GOPTIONS statement, then Java and
ActiveX assign colors to symbols differently than does the SAS server. To ensure
consistency on all devices, you should specify the desired color of each symbol.The
SAS server restarts at the first color in the colors list and rotates through all of
the colors in the color list for the first default symbol before going to the next
symbol in the default symbol list where it again rotates through all of the colors in
the color list before picking up the next symbol. 4
Note: The VALUE option overrides the MarkerSymbol attribute in graph
styles. For more information on graph styles, see SAS Output Delivery System:
User’s Guide. 4
See also: the option FONT= on page 186 and “Specifying Plot Symbols” on page
205.
Featured in: “Example 3. Rotating Plot Symbols through the Colors List” on
page 231, “Example 4. Creating and Modifying Box Plots” on page 233, and
Example 2 on page 906.
Not supported by: Java (partial), ActiveX (partial)
WIDTH=thickness-factor
W=thickness-factor
specifies the thickness of interpolated lines (GPLOT) or contour lines
(GCONTOUR), where thickness-factor is a number. The thickness of the line
increases directly with thickness-factor. By default, WIDTH=1.
WIDTH= also affects all the lines in box plots (INTERPOL=BOX), high-low
plots with bars (INTERPOL=HILOB), and standard deviation plots
(INTERPOL=STD). It also affects the outlines of the area generated by the
AREAS= option in the PLOT statement of the GPLOT procedure.
Note: By default, the value specified by WIDTH= is used as the default value
for the BWIDTH= option. For example, specifying WIDTH=6 also sets BWIDTH=
to 6 unless you explicitly assign a value to BWIDTH=.
Java and ActiveX do not provide the same measure of control for width as SAS/
GRAPH on the server. Measurements are translated to pixels rather than a
percentage. 4
Featured in: “Example 1. Ordering Axis Tick Marks with SAS Datetime Values”
on page 226 and “Example 4. Creating and Modifying Box Plots” on page 233.
Not supported by: Java (partial) and ActiveX (partial)
202 Using the SYMBOL Statement Chapter 7
Note: The words or special characters in the VALUE= column are entered exactly as
shown. 4
The following statement cancels only HEIGHT= without affecting the rest of the
definition:
symbol4 height=;
Add or change options in the same way. This statement adds an interpolation
method to SYMBOL4:
symbol4 interpol=join;
This statement changes the color of the plot symbol from red to blue:
symbol4 cv=blue;
Canceling one SYMBOL statement does not affect any other SYMBOL definitions. To
cancel all current SYMBOL statements, use RESET= in a GOPTIONS statement:
goptions reset=symbol;
3 specify a default color for all SYMBOL statements using the CSYMBOL= option
on the GOPTIONS statement. This method makes it easy to specify the same color
for each definition when you do not need more explicit color specifications.
3 limit the colors list to a single color using the COLORS= option on the GOPTIONS
statement. This method makes it easy to specify the same color for each definition
when you want the color to apply to other definitions also, such as PATTERN
definitions.
For more information on specifying colors for symbol definitions, see “Using Color” on
page 206.
If you do not use color to limit a SYMBOL statement to a single symbol definition,
SAS/GRAPH generates multiple symbol definitions from that statement by rotating the
current definition through the colors list (for more details, see “Using Generated Symbol
Sequences” on page 208). Because SAS/GRAPH uses symbol definitions in the order
they are generated, this means that the nth symbol definition applied to a graph does
not necessarily correspond to the SYMBOLn statement.
For example, assuming no color is specified on the CSYMBOL= graphics option,
these statements generate four definitions:
goptions colors=(red blue green);
symbol1 value=star;
symbol2 value=square color=yellow;
In this case, if a graph needs only three symbols, the SYMBOL2 definition is not used.
To make the nth applied symbol definition correspond to the SYMBOLn statement,
limit each SYMBOL statement to a single color, using one of the techniques listed at
the beginning of this section.
This example uses color to ensure each SYMBOL statement generates only one
definition. You can omit color specifications to let SAS/GRAPH rotate symbol definitions
through the colors list. For details, see “Using Generated Symbol Sequences” on page
208.
To use plot symbols other than those in Figure 7.21 on page 202, use the FONT=
option to specify a font for the plot symbol. If the font is a symbol font, such as Marker,
the string specified with the VALUE= option is the character code for the symbol to be
displayed. If the font is a text font, the string specified with VALUE= is displayed as
the plot symbol. (See VALUE= on page 199 and FONT= on page 186.)
This table illustrates some of the ways you can define a plot symbol:
Plot
Definition Symbol
symbol1 value=plus;
symbol2 value=+;
symbol5value="’";
proc gplot;
plot y1*x1 y2*x2 y3*x3 / overlay;
run;
Using Color
Generally, there are two ways to explicitly specify color for SYMBOL statements:
3 specify colors on the SYMBOL statements
3 specify a color on the CSYMBOL= graphics option.
You can also let SAS/GRAPH rotate symbol definitions through the colors list. For
details, see “Using Generated Symbol Sequences” on page 208.
The COLOR= option colors the entire symbol or those portions of it not colored by
one of the other color options. If COLOR= precedes CI= or CV=, the CI= or CV=
specification is used instead. If none of the SYMBOL color options is used, color
specifications are searched for in this order:
1 the CSYMBOL= option in a GOPTIONS statement
2 each color in the colors list sequentially before the next SYMBOL definition is used.
CAUTION:
If no color options are used, the SYMBOL definition cycles through each color in the colors
list. 4
SAS/GRAPH Statements Specifying Line Types 207
If the SYMBOL color options and the CSYMBOL= graphics option are not used, the
SYMBOL definition cycles through each color in the colors list before the next definition
is used. For details, see “Using Generated Symbol Sequences” on page 208.
Note: These line types are also used by other statements and procedures. Some
options accept a line type of 0, which produces no line. 4
CSYMBOL= color is not in effect, the specified plot symbol or line type is rotated
through the colors list.
If REPEAT= is also used, the resulting SYMBOL definition is repeated the specified
number of times.
Here, the SYMBOL1 statement generates the first SYMBOL definition. The
SYMBOL2 statement does not include color, so the first default plot symbol is rotated
through all colors in the colors list before the SYMBOL3 statement is used. This table
shows the colors and symbols that would be used if nine symbol definitions were
required for PROC GPLOT:
Sequence Characteristics:
Number Source Color Symbol Interpolation
Sequence Characteristics:
Number Source Color Symbol Interpolation
8 first default color=green first default default
Notice that after the SYMBOL statements are exhausted, the procedure begins using
the default definitions (sequences 6 through 9). Each plot symbol from the default list is
rotated through all colors in the colors list before the next plot symbol is used. Also,
SYMBOL1 does not specify a plot symbol, so the default sequencing provides the first
default symbol (a + sign). When sequencing resumes in sequence number 6, it starts at
the beginning again, selecting the first default plot symbol and rotating it through the
colors list.
If you use REPEAT= but no color, the sequence generated by cycling the definition
through the colors list is repeated the number of times specified by REPEAT=. For
example, these statements define a colors list and illustrate the effect of REPEAT= on
SYMBOL statements both with and without explicit color specifications:
goptions colors=(blue red green);
symbol1 color=gold repeat=2;
symbol2 value=star color=cyan;
symbol3 value=square repeat=2;
Here, SYMBOL1 is used twice, SYMBOL2 is used once, and SYMBOL3 rotates
through the list of three colors and then repeats this cycle a second time:
Sequence Characteristics:
Number Source Color Symbol Interpolation
Description
TITLE, FOOTNOTE, and NOTE statements add text to maps, plots, charts, and text
slides. With these statements you can
3 control the content, appearance, and placement of the text, including color, size,
font, and alignment
3 underline or draw boxes around the text
3 draw straight lines on the output.
Figure 7.23 on page 211 shows the default appearance and placement of titles,
footnotes, and notes on the graphics output area.
Titles are centered at the top of the graphics output in the title area. They are
positioned in numeric order with the lowest-numbered TITLE at the top of the title
area and the highest-numbered TITLE at the bottom of the title area.
TITLE statements have these default characteristics:
3 TITLE1 is twice the height of all other titles and uses the SWISS font.
3 All other TITLE statements are one unit high and use the default hardware font.
Footnotes are positioned similarly in the footnote area at the bottom of the graphics
output area, with the lowest numbered FOOTNOTE at the top of the footnote area.
Unless otherwise specified, they use the default hardware font and are one unit high.
Space for the title area and the footnote area is taken from the procedure output
area. The more titles and footnotes you specify and the bigger they are, the smaller the
procedure output area will be.
Notes are positioned at the top of the procedure output area and are left justified.
The statements appear one below another in the order they appear in the program.
Unless otherwise specified, they use the default hardware font and are one unit high.
For more information on titles, footnotes, and notes in the graphics output area, see
“Placement of Graphic Elements in the Graphics Output Area” on page 39.
212 TITLE, FOOTNOTE, and NOTE Statements Chapter 7
Syntax
TITLE<1...10>< text-argument(s)>;
FOOTNOTE<1...10>< text-argument(s)>;
NOTE< text-arguments(s)>;