Chapter 49: The DATA Step Graphics Interface


Overview

The DATA Step Graphics Interface (DSGI) enables you to create graphics output within the DATA step or from within an SCL application. Through DSGI, you can call the graphics routines used by SAS/GRAPH software to generate an entire custom graph or to add features to an existing graph. You can use DSGI to write a custom graphics application in conjunction with all the power of the programming statements accessible by the DATA step.

DSGI provides many of the same features as the Annotate facility, but it also has many advantages over the Annotate facility.

  • You can use DSGI functions and routines through SCL.

  • You can save disk space. DSGI graphics can be generated through the DATA step without creating an output data set. The graphics output is stored as a catalog entry in the catalog you select and, optionally , is displayed after the DATA step is submitted.

  • DSGI generates graphics faster than the Annotate facility. With the Annotate facility, you must first create a data set and then submit a PROC step to display the graphics output. In DSGI, you eliminate the PROC step because the graphics output is generated after the DATA step.

  • DSGI supports viewports and windows , which enable you to specify the dimensions, position, and scale of the graphics output. They also allow you to include multiple graphs in the same graphics output.

You should consider using the Annotate facility for enhancing procedure output and using DSGI for creating custom graphics without using a graphics procedure.

DSGI is based upon the Graphics Kernal System (GKS) standard, although it does not follow a strict interpretation, nor is it implemented on a particular level of GKS. GKS was used to provide a recognizable interface to the user . Because of its modularity, the standard allows for enhancements to DSGI without the side effect of converting programs between versions of SAS/GRAPH software.

This chapter explains the concepts used to create graphics output with DSGI. The discussion provides an overview of the functions and routines used in DSGI. For complete details of each function and routine, see Chapter 50, DATA Step Graphics Interface Dictionary, on page 1401.

Display 49.1 on page 1355 shows a pie chart that was created entirely with DSGI functions. Display 49.2 on page 1355 is an example of a text slide that was created with DSGI statements.

click to expand
Display 49.1: Exploded Pie Chart Generated with the DSGI
click to expand
Display 49.2: Text Slide Created Using the DSGI

Syntax

DSGI uses GASK routines and functions to draw graphics elements. These statements have the following syntax:

CALL GASK( operator , arguments );

return-code-variable = function- name ( operator , arguments );

where

arguments

are the additional required variables or values for the routine or function.

return-code-variable

is an arbitrary name and can be any numeric variable name. It will hold the return code upon execution of the function.

function-name

is the DSGI command you want to execute and must be one of the following: GDRAW, GINIT, GPRINT, GRAPH, GSET, or GTERM.

operator

is a character string that names the function you either want to submit or for which you want the current settings. When used with functions, operator can take different values depending on function-name .

Requirements

When using DSGI statements, the following formats for arguments must be used:

  • All x and y coordinates are expressed in units of the current window system. (See The Current Window System on page 1359 for details.)

  • The arguments used with DSGI functions can be expressed as either constants or variables. The arguments used with GASK routines must be variable names since values are returned through them. See Chapter 50, DATA Step Graphics Interface Dictionary, on page 1401 for a complete explanation of each argument used with DSGI functions and routines.

  • All arguments that are character constants must be enclosed in either single or double quotation marks.




SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net