By default, the graphics catalog is a temprorary data set, and is erased when your SAS/Graph job completed. However, by specifying certain SAS options you can save the graphics catalog as a permanent file. You can then use Proc GREPLAY later to:
Proc GPLOT data=EXPER2;
Plot RT * TRIAL / GOUT=GRAPHS.PLOTLIB
(other options) ;
SAS will store the plot in the file 5PLOTLIB GRAPHS on your A-disk.
If that file did not exist previously, it will be created.(2) If you wish to store or access a graphics
catalog on a disk other than your A-disk, use the FILEDEF statement
to define the file. For example, to store plots in a file on a B-disk
(assuming you have Read/Write access to it) use:
CMS FILEDEF GRAPHS DISK dummy dummy B;It is useful to place this line at the beginning of your SAS program to indicate clearly where the plots will be stored.
If you specify a one-part name in a GOUT= option, the catalog will be stored in a WORK library. Thus the plot statement,
Plot RT * TRIAL / GOUT=PLOTLIB;
creates a catalog WORK.PLOTLIB, which corresponds to the external
file 5PLOTLIB WORK A, but WORK files are erased when your job
completes. If you do not specify the GOUT= option, graphic catalog
entries are written to a default catalog, WORK.GSEG.
LIBNAME gcat_name 'disk_used';
e.g.,
LIBNAME PLOTLIB 'A';
PROC graphproc DATA=dataset GOUT=graphicscatalog ;
e.g.,
PROC GPLOT DATA=EXPER2 GOUT=GRAPHS.PLOTLIB ;
or
Plot RT*TRIAL / GOUT=GRAPHS.PLOTLIB;
In a program you can direct different plots to different graphic
catalogs if you wish to segregate them in some way.
By default, any plots produced are added to the end of the catalog. If a procedure produces several graphs, an entry is made in the catalog for each one.(3)
If you wish to store a series of plots in a catalog, but don't want to have them displayed or plotted now, use the NODISPLAY option on the GOPTIONS statement:
GOPTIONS NODISPLAY;
PROC G3D data=NORMAL2;
PLOT Y * X = Z /
&GOUT
NAME='NORMAL2'
DES ='Bivariate normal 3D plot';
The include file, GRAPHICS SAS, contains a statement assigning GOUT a
null value (if it is not already defined)
%GLOBAL GOUT;If you do not redefine GOUT, it will have no effect (the plots will not be stored permanently). However, if you include a statement such as
%LET GOUT= GOUT=GRAPHS.PLOTLIB;
GCHART PIE CHART OF REGION GMAP CHOROPLETH MAP OF SPACESYou can also supply your own name and description as options to some of the SAS/Graph procedures (G3D, GMAP, GANNO, GCHART and GCONTOUR). For example, you might have used these statements to create the map:
Proc GMAP MAP=MAPS.CANADA
DATA=DAYCARE
GOUT=GRAPHS.PLOTLIB;
ID PROVINCE;
CHORO SPACES /
NAME = 'SPACEMAP'
DES = 'Number of Licensed day care spaces' ;
It is strongly recommended that you use these options, to save
confusion later over which plot is which. If you don't supply a name
or description when the plot is created, you can always change them
later with GREPLAY.
PROC G3D data=NORMAL2;
PLOT Y * X = Z /
GOUT=GRAPHS.PLOTLIB
NAME='NORMAL2'
DES ='Bivariate normal 3D plot'
... (other options) ... ;
RUN;
For some applications, such as those described in Introduction to SAS/Graph: Tutorial Examples, (Friendly, 1988), line mode is used to create and display a template containing multiple graphs. However, for managing a graphics catalog, the the full screen GREPLAY editor is more convenient.
Lets assume we have defined a library called "GRAPHS" with the FILEDEF statement. We also stored all the plots in the graphics catalog called "PLOTLIB" by specifying GOUT=GRAPHS.PLOTLIB in SAS/Graph procedures. The following sequence will allow you to get any plot stored in PLOTLIB. Assume you are using a TEK4010 compatible screen and you want SAS to list the plots on the screen. The example below shows how you would run SAS interactively to You type in the lines shown below after the ? prompt. This sequence is equivalent to writing a SAS program on-line. Use PF3 to submit these lines to SAS for execution.
R;
SAS * You invoke SAS ;
1? %GSTART(KEYNOTE);
2? CMS FILEDEF GRAPHS DISK dummy dummy A;
3? PROC GREPLAY IGOUT=GRAPHS.PLOTLIB FS;
4? LIST IGOUT; * List all the plots stored in
this catalog;
With Proc GREPLAY, you can define both an input graphic
catalog (using the IGOUT= option), and an output graphic
catalog (using the GOUT= option), and these can refer to the same
catalog file (if you want to modify the catalog), or to different
catalogs (if you want to copy plots from one to another).
The LIST IGOUT statement displays a list of the graphs in the input catalog. The GREPLAY screen should appear with a listing of the plots stored in the catalog defined, as shown in Figure 1. +-------------------------------------------------------------------+ | | |
The Type field in the display indicates whether the graph was created as a device-independent (I) graph, or as a device-dependent graph. Only device-independent graphs can be replayed through templates.At this point you can do any of the following:
SELECT GROUPS, PRESS ENTER TO STOPDefine the groups by typing letters and digits in the Sel field beside each name. For example, use A1, A2, A3 to denote group "A", with three members ordered by the digits 1, 2, 3. After you press ENTER, the plots are reordered in the display screen according to the groups.
Note: You are not prompted to confirm a request to delete a graph, so be careful.