Chapter Contents


SAS/GRAPH Software: Reference

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. For information on assigning graphics catalogs, see Storing Graphics Output in SAS Catalogs.

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.

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 for a complete description.

NOTE statement
adds text to the graphics output. See TITLE, FOOTNOTE, and NOTE Statements for a complete description.

You can also use other SAS language statements with SAS/GRAPH procedures. See Other SAS Language Statements.

SAS/GRAPH Global Statements

SAS/GRAPH has its own set of statements that affect only graphics output that is generated by the SAS/GRAPH procedures and the graphics facilities Annotate and DSGI.

SAS/GRAPH global statements define or modify the titles, footnotes, legends, axes, symbols, and patterns that appear on your graphs, as well as controlling the appearance of the graph, the graphics environment, the destination of the output, and device characteristics.

You can specify these statements anywhere in your program, and they remain in effect until explicitly changed or canceled. These are the SAS/GRAPH global statements:

modifies the appearance, position, and range of values of axes in charts and plots.

specifies 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.

modifies the appearance and position of legends generated by procedures that produce charts, plots, and maps.

controls the color and fill of patterns that are assigned to areas in charts, maps, and plots.

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.

add titles and footnotes to graphics output.

See SAS/GRAPH Statements for complete descriptions of these statements.

Annotate DATA Step

An Annotate DATA step generates a data set of graphics commands that can be applied to SAS/GRAPH procedure output. See The Annotate Data Set for information on building and using Annotate data sets. See Annotate Dictionary for a complete description of all Annotate functions and variables.

Other SAS Language Statements

These SAS language statements can also be used within SAS/GRAPH procedures:

FILENAME statements
identify external files or aggregate file storage locations that you want to use for input or output. See FILENAME Statement for more information.

FORMAT statement
assigns a format to a variable. SAS/GRAPH procedures use formatted values to determine such aspects of the graph as midpoints, axis labels, tick-mark values, and legend entries.

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 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 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

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';

is any SAS name.

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.

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

The LIBNAME statement has this general form:

LIBNAME libref 'SAS-data-library';

is any SAS name.

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.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.