Printing SAS Graphs

To print SAS/GRAPH output from Hubert

To print SAS/Graph output:

When using SAS/GRAPH, a GOPTIONS statement is used to specify the output device. SAS/Graph includes drivers for many different output devices. PROC GDEVICE is run to obtain an alphabetical list of available output device drivers that can be specified in GOPTIONS DEVICE=

PROC GDEVICE:
RUN:

In the list, locate the device name for your printer. If it is not in the list, start by choosing device that your printer emulates. Several devices similar to your printer may need to be tried to find one that works.

Once a device name is identified, insert a GOPTIONS statement prior to SAS/GRAPH procedures:

GOPTIONS DEVICE=devicename;

To test if a devicename works for your system, use the GTESTIT procedure. When a graphics device is properly specified for your hardware, it produces three graphs. In PC/SAS, use DEVICE=WIN to test display on your pc monitor and also print it to your default Windows printer:

GOPTIONS DEVICE=WIN;
PROC GTESTIT;
RUN;

Documentation on printing SAS/Graph output is located on pages 55+ in SAS /Graph Software: Reference, Version 8. The SAS manual also explains the many goptions available. Popular options are:

  • For multiple graphs in one file, use the gfsmode=append goption instead of gfsmode=replace
  • To rotate to landscape, add to goptions statement: rotate=landscape

To print SAS/GRAPH output from Hubert.

The following must be specified:

  • a location for saving the graph (use a filename statement)
  • a graphical device where the printed output will be produced (use a goptions statement)

The following example will print to the unix system printer in the Sanger Hall B3 -012. It creates a usrroom.ps file (in postscript format) which can then be printed using the unix command:

lp usrroom.ps

/* Sample program to produce SAS/Graph output on unix (Hubert) and print to the unix system printer in Sanger Hall B3-012*/

title1 'Test graph using LJ5SIPS device driver for printer in Sanger B3-012';

*Specify filename and goptions prior to SAS/GRAPH procedure;
filename mygraph 'usrroom.ps';
goptions reset=all device=LJ5SIPS gsfmode=replace gsfname=mygraph;

* create a sample dataset;
data new;
     input x y;
datalines;
1 3
2 6
3 4
4 7
5 1
;
run;

* Run proc gplot to create a graph;
proc gplot;
    symbol i=join;
     plot y*x;
run;

SAS at VCU

 

701 W. Broad St., Box 843059
Richmond, VA 23284
(804) 828-1177
RSS

 
VCU