45
goptions device=hplj5p3;
This statement formats the graph for the Hewlett Packard LaserJet Series V printer. You
can view the complete list of SAS/GRAPH drivers by submitting the PROC GDEVICE
statement.
To print a graph to a printer file (also called a graphics stream file, or GSF) instead of
directly to a printer, use the GSFNAME option in the GOPTIONS statement and use a
filename or a fileref to specify where you want the output. For example:
filename graphout "graphpic.prn";
goptions gsfname=graphout gsfmode=replace
device=hpljs2;
Printing and Previewing from the GRAPH Window
You can preview a graph that you create and, at the same time, format it for optimal
display on the device of your choice. To preview the graph before you print it, run your
SAS/GRAPH program with the following GOPTIONS statement:
goptions targetdevice=driver-name;
where driver-name is either one of the WINPxxx drivers or a SAS/GRAPH native driver.
By specifying a target device, SAS/GRAPH can format the graph with colors and
attributes that are appropriate for the target printer. To print the graph after it is
displayed, select the File menu and then select Print.
Note: If you do not specify a target device before you create the graph, SAS/GRAPH
prompts you (in the Print dialog box) for a device driver name when you attempt to
print the graph that you are previewing. (In most cases the WINPRTM or WINPRTC
driver is specified by default. The graph colors, orientation, and sizing might not be
optimal for the output device that you specify.
Choosing between a SAS/GRAPH Native Driver and the WINPxxx
Driver
When deciding whether to use SAS/GRAPH native drivers or the WINPxxx series of
drivers, consider such factors as the device that you are using and the type of output that
you want to produce. Note the following specific considerations:
• If no Windows printer driver is available for your device, use a SAS/GRAPH native
driver.
• If you have a device for which there is no SAS/GRAPH native driver, use the
WINPxxx driver, if there is a Windows printer driver available for the device. In
cases where a new model of hard-copy device becomes available between releases of
SAS and the hardware vendor provides a new Windows driver that uses new features
of the device, you can use a WINPxxx driver to take advantage of those features.
• If you want to use options such as HSIZE= or VSIZE= to customize the size
specifications used in your graph, using SAS/GRAPH native drivers usually
produces more reliable results.
• To use TrueType fonts in your SAS/GRAPH output, use one of the WINPxxx drivers
and specify the font just as you would specify one of the installed hardware fonts for
your printer. For more information about TrueType fonts, see “Using TrueType Fonts
with SAS/GRAPH Software” on page 637 .
194
Chapter 6 • Managing SAS Output under Windows
38
Importing Graphics from Other Applications
Overview of Importing Graphics from Other Applications
SAS/GRAPH lets you import bitmap and vector graphics that were created by other
software applications. SAS/GRAPH provides these benefits:
• You can create your graphic using another graphics editor. Import the graphic into
SAS/GRAPH to produce output on a specialized device.
• You can merge clip art and graphs from other applications with the graphs that you
create in SAS/GRAPH.
You can import bitmap graphics into these SAS windows:
• GRAPH window. The imported graphic becomes a new GRSEG entry in the current
catalog.
• Graphics Editor. The imported graphic becomes part of the current graph.
• Image editor window. The imported graphic becomes a new image.
SAS provides two ways to import bitmap graphics into SAS/GRAPH:
• From the application that you used to create the graphic, copy the graphic to the
Windows clipboard. Then switch to your SAS Session and paste the graphic into the
SAS GRAPH window, as described in “Pasting Graphics from the Windows
Clipboard” on page 195 .
• From the SAS GRAPH window (or the Graphics Editor or Image Editor) import the
graphics file by using the Import Image dialog box, as described in “Importing a
Graphics File from within a SAS/GRAPH Window” on page 195 .
• “Pasting Graphics from the Windows Clipboard” on page 195
• “Importing a Graphics File from within a SAS/GRAPH Window” on page 195
Pasting Graphics from the Windows Clipboard
If the tool that you use to create the source graphics is a Windows application, then you
can use the Windows clipboard to copy the graphics to your SAS session as follows:
1. From the application that you used to create the graphic, select the graphic and copy
it to the clipboard using the copy procedures for your graphics tool.
2. Switch to your SAS session (or start your SAS session, if it is not already running).
3. With the SAS GRAPH window active, select Paste from the Edit menu. The graphic
is pasted into the SAS GRAPH window.
Importing a Graphics File from within a SAS/GRAPH Window
SAS/GRAPH provides import filters to translate graphics files that were created in other
applications to a format that you can use with SAS.
You can import graphics from other applications that produce files in any of the formats
that are shown in the following table:
Producing Graphics
195
46
Table 6.9 Graphics Import File Formats
Graphics File Format
File Extension
Microsoft Windows bitmap
BMP
Microsoft Windows metafile
WMF
enhanced metafile
EMF
Device independent bitmap
DIB
JPEG format
JPG
graphic interchange format (GIF)
GIF
tag image file format (TIFF)
TIF
PC Paintbrush
PCX
Truevision Targa
TGA
Encapsulated PostScript Interchange (EPSI)
PS
Portable Network Graphics
PNG
Photo CD image
PCD
Portable Pixmap
PBM
X Window bitmap
XBM
X Window dump
XWD
To import bitmap graphics into SAS/GRAPH:
1. Make the GRAPH window the active window and then select Import Image from
the File menu.
2. Use the Import Image dialog box to select the source directory and graphics file.
The Format field must show the correct source format; the field indicates which
import filter SAS/GRAPH uses. You can have SAS automatically detect the file
format of the file to import by selecting AUTO as the format. Click OK.
Note: Automatic file format detection using AUTO does not detect the DIB, EMF,
and WMF file formats.
You can also include IMAGE catalog entries in your graphs. For information about
including IMAGE catalog entries, see SAS Help and Documentation.
196
Chapter 6 • Managing SAS Output under Windows
46
Exporting Graphics for Use with Other Applications
Overview of Exporting Graphics for Use with Other Applications
SAS provides the following methods of exporting graphics created in SAS/GRAPH for
use with other word processing or desktop publishing packages, or for display on the
Internet or intranet:
• Export the graphics to a file from the GRAPH window, Graphics Editor, or Image
Editor, as described in “Exporting a Graphic to a File from a SAS/GRAPH Window”
on page 197 .
• Pasting the contents of the Windows clipboard into the target application (as a
bitmap), as described in “Pasting Graphics from SAS/GRAPH into Other Windows
Applications” on page 198 .
• Create a computer graphics metafile (CGM) file for use with a specific graphics
package, using drivers that are included with SAS, as described in “Creating CGM
Files for Export to Other Applications” on page 198 .
• Create a Windows metafile for use with another Windows application, as described
in “Creating WMF (Windows Metafile) Files for Export to Other Applications” on
page 200 .
You can also use SAS/GRAPH to create GIF and VRML files for use with web
browsers, PDF files for use with the Adobe Acrobat reader, and many other useful types
of graphics files. For more information about how to create these types of files, see
SAS/GRAPH: Reference and SAS/GRAPH in SAS Help and Documentation.
Exporting a Graphic to a File from a SAS/GRAPH Window
SAS/GRAPH provides export filters to translate graphics that were generated in
SAS/GRAPH into formats that you can use with other applications, such as spreadsheet
and desktop publishing programs.
You can export graphics from SAS/GRAPH in any of the formats that are shown in the
following table:
Table 6.10 Graphics Export File Formats
Graphics File Format
File Extension
Microsoft Windows bitmap
BMP
Microsoft Windows metafile
WMF
enhanced metafile
EMF
Device independent bitmap
DIB
JPEG format
JPG
graphic interchange format (GIF)
GIF
tag image file format (TIFF)
TIF
Producing Graphics
197
47
Graphics File Format
File Extension
Adobe PostScript
PS
Encapsulated PostScript Interchange (EPSI)
PS
Portable Network Graphics
PNG
Portable Pixmap
PBM
To export a graph from the GRAPH window:
1. Make the GRAPH window the active window and select Export Image from the
File menu.
2. In the Export Image dialog box, select the target file format.
3. Specify the directory and filename for the exported graphic. Click OK.
For more information about exporting graphics to a SAS IMAGE catalog entry from the
Image editor, see SAS Help and Documentation for SAS/GRAPH.
Pasting Graphics from SAS/GRAPH into Other Windows
Applications
A quick way to export graphics from SAS to another Windows application is to use the
Windows clipboard. When you copy information from SAS/GRAPH to the clipboard,
you can then paste that information into any application that accepts DIB, BMP or WMF
input.
To copy information from SAS/GRAPH to the clipboard:
1. From the GRAPH window, hold down the left mouse button and drag the mouse
over the portion of the graph that you want to copy. A selection box marks off the
selected area as you move the mouse. When you are finished, release the mouse
button.
If you do not select an area of the graph to copy, the next step copies the entire graph
to the clipboard.
2. With the GRAPH window still active, press CTRL+C (or select Copy to Paste
Buffer from the Edit menu).
This action copies the graph to the clipboard. You can then return to the target
application and paste the graph (typically by using the Paste or Paste Special options in
the target Windows application). For more information about how to paste information
from the clipboard, see the documentation for the other Windows application.
Creating CGM Files for Export to Other Applications
You can export graphs from SAS/GRAPH to other graphics packages by using drivers
that were developed specifically for those packages. When you use computer graphics
metafiles (CGMs) as the medium of transport between packages, the graph retains its
separate components so that you can independently edit and size it. The editing
capabilities that you can use depend on the target graphics package.
To create a CGM from SAS/GRAPH, set GOPTIONS as follows:
filename fileref 'filename.cgm';
goptions device=cgmxxxx gsfname=fileref
198
Chapter 6 • Managing SAS Output under Windows
50
gsfmode=replace;
where CGMxxxx is the appropriate CGM driver for your target application, and
filename.CGM is the name of the file that you want to create. CGMOFML and
CGMOFMP are the recommended device drivers for all CGM output. If CGMOFML
and CGMOFMP are not adequate for the receiving software, then you can use the
devices in Table 6.11 on page 199 . This table lists the graphics packages to which you
can export CGMs and the appropriate drivers to use.
The driver names that are marked with an asterisk (*) are already provided with SAS
9.4. Some of the drivers have been disabled and are designated, in the table, by the
phrase, disabled in device catalog. To enable a device driver, do the following:
1. Point the library GDEVICE0 to a new location. For example:
LIBNAME GDEVICE0 'directory';
2. Use PROC CATALOG to copy some or all of the entries to the GDEVICE0 location.
For example:
PROC CATALOG C=SASHELP.DGDEVICE;
COPY OUT=GDEVICE0.DEVICES;
RUN;
For more information about how to use the CGM drivers and graphics packages, contact
SAS Institute's Technical Support Division.
Table 6.11 CGM Drivers for Popular Graphics Packages
Package
Suggested Driver
Aldus PageMaker
CGMAPMA* (disabled in dgdevice catalog)
Aldus Persuasion
CGMAPSA* (disabled in dgdevice catalog)
BPS 35 MM Express
CGM35 (disabled in dgdevice catalog)
Borland Quattro Pro (Windows)
CGMBQWC (disabled in dgdevice catalog)
Borland Quattro Pro (DOS)
CGMBQA* (disabled in dgdevice catalog)
Frame Tech FrameMaker
CGMFRCA* (disabled in dgdevice catalog)
CGMFRGA* (disabled in dgdevice catalog)
CGMFRMA* (disabled in dgdevice catalog)
Harvard Graphics 2.12 for DOS
CGHHG (disabled in dgdevice catalog)
Harvard Graphics 3.0 for DOS
CGMHG3A* (disabled in dgdevice catalog)
Harvard Graphics for Windows
CGMHGWA* (disabled in dgdevice catalog)
ImageBuilder
CGMIMG (disabled in dgdevice catalog)
Interleaf 5
CGMCILFC* (disabled in dgdevice catalog)
CGMGILFG* (disabled in dgdevice catalog)
CGMMILFM* (disabled in dgdevice catalog)
Producing Graphics
199
39
Package
Suggested Driver
Microsoft Word for Windows 6.0
CGMMW6C* (disabled in dgdevice catalog)
Microsoft Word for Windows 2.0
CGMMWWC* (disabled in dgdevice catalog)
Microsoft PowerPoint
CGMMPPA (disabled in dgdevice catalog)
Microsoft Office 97
CGMOF97L or CGMOFML, CGMOF97P, or
CGMOFMP
Polaroid CI3000
CI3000 (disabled in dgdevice catalog)
WordPerfect 5.1 for DOS
CGMWPCA (disabled in dgdevice catalog)
CGMWPCAP* (disabled in dgdevice catalog)
CGMWPGA (disabled in dgdevice catalog)
CGMWPGAP* (disabled in dgdevice catalog)
CGMWPMA (disabled in dgdevice catalog)
CGMWPMAP* (disabled in dgdevice
catalog)
WordPerfect 5.2 for Windows
CGMWPWA* (disabled in dgdevice catalog)
WordPerfect Presents for DOS
CGMWPCA* (disabled in dgdevice catalog)
CGMWPGA* (disabled in dgdevice catalog)
CGMWPMA* (disabled in dgdevice catalog)
Zenographics Pixie
CGMPIX (disabled in dgdevice catalog)
Creating WMF (Windows Metafile) Files for Export to Other
Applications
To learn how to export WMF files from SAS/GRAPH software, contact SAS Institute's
Technical Support Division and ask for information for your target software application.
Additional Resources
For full details about using SAS/GRAPH software, see SAS/GRAPH: Reference. For
further details about using graphics and fonts with SAS under Windows, see “Using
TrueType Fonts with SAS/GRAPH Software” on page 637 .
200
Chapter 6 • Managing SAS Output under Windows
Documents you may be interested
Documents you may be interested