Overview of SAS/GRAPH Output

The result of most SAS/GRAPH procedures is the graphic display of data in the form of graphics output, which is distinct from SAS output. Whereas SAS output consists of text, graphics output consists of commands that tell a graphics device how to draw graphics elements. A graphics element is a visual element of graphics output (for example, a plot line , a bar , a footnote , the outline of a map area , or a border). This chapter discusses how to display, print, store, and export SAS/GRAPH output after you have created it.

SAS/GRAPH Output Terminology

The following terms are used when describing SAS/GRAPH output:
Graphics output file
A file that contains bitmapped or vector graphic information. See Supported Graphics Formats.
Image file
A file that contains bitmapped graphic information. Examples include GIF, PNG, and JPEG files. Image files are a subset of graphics output files.
Document file
A file output by the Output Delivery System (ODS) that contains an image or is used to view an image. Examples include HTML, PDF, RTF, SVG, and PostScript files.

Supported Graphics Formats

You can export your SAS/GRAPH output in many different graphics file formats. SAS/GRAPH supports the following image file formats:
BMP
Windows Bitmap
GIF
Graphics Interchange Format
JPEG
Joint Photographic Experts Group
PNG
Portable Network Graphics
TIFF
Tagged Image Format File
SAS/GRAPH supports the following vector file formats:
CGM
Computer Graphics Metafile
EMF
Microsoft Enhanced Metafile
EPS
Encapsulated PostScript
PCL
Printer Control Language
PDF
Portable Document Format
PS
PostScript
SVG
Scalable Vector Graphics
The vector-based formats:
  • are usually smaller than image files
  • can be edited with third–party software (except for EPS)
  • support system fonts
  • support font embedding with the PDF, SVG, and PostScript devices
  • provide a clear image on high-resolution devices.
The type of graphics file format that you choose depends on how you are going to use the output. For example, you are planning to import the graph into other software applications, such as Microsoft Excel, Word or Power Point, you might prefer to create a CGM or EMF file. The vector-based files are usually smaller than image files, they support TrueType fonts, and except for EPS, they can be edited with third-party software. In addition, they use device-resident fonts and provide a clear image on high-resolution devices.
If you want to display the graph on a Web page, or import it into software that cannot accept vector graphics, you must create an image file such as PNG or GIF.
Most software applications that process graphics input can accept one or more of these file formats. Check the documentation for the hardware or software product to which you want to send the graph to determine what file formats it can use.
For a complete list of graphics file formats that are available with SAS/GRAPH in your operating environment, refer to the Device Help for SAS/GRAPH in the SAS Help facility.

Output Types

The SAS graphics procedures can generate the following types of output:
  • a GRSEG (except for procedures GKPI, GTILE, and GAREABAR)
  • a graphics output file that contains the graph (BMP, JPG, GIF, PNG, and so on)
  • an HTML file that contains XML code that is consumed by the ActiveX control or Java applet
In addition, the SAS Output Delivery System (ODS) creates document files, which include the following types of output:
  • an EMF file that contains a graph
  • an HTML file that displays one or more graphs
  • a PCL file that contains one or more graphs
  • a PDF file that contains one or more graphs
  • a PostScript file that contains one or more graphs
  • an RTF file that contains one or more graphs
  • an SVG file that contains one or more graphs

About GRSEGs

A GRSEG is a SAS catalog entry that contains graphics commands in a generic, device-independent format. There are few cases in which you would be concerned with the GRSEGs. One case for using the GRSEGs is when combining multiple graphs into a single graphics output file using the GREPLAY procedure (see Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File). Beyond this case, there are few reasons to use the GRSEGs. If you plan to use the GRSEGs, you must understand when they are generated and where they are stored.
GRSEGs are supported by the SAS/GRAPH procedures that use the graphics output devices with some exceptions. The procedures that are supported by only the JAVA, JAVAIMG, ACTIVEX, and ACTXIMG devices, such as GKPI, GTILE, and GAREABAR, do not support GRSEGs.
A procedure that generates a GRSEG produces output in two steps:
  1. It creates a GRSEG in a SAS catalog.
  2. It uses a graphics output device to translate the commands from the GRSEG to commands that a particular graphics device understands. This is called device-dependent output.
This method enables you to produce graphics output on several types of graphics output devices.
A GRSEG is stored in a catalog in the SAS temporary directory. The graphics instructions that are contained in the GRSEG are understood only by the SAS/GRAPH software. You cannot use third-party graphics applications to view the graphic in a GRSEG. The SAS/GRAPH software provides devices that enable you to output a GRSEG to standard graphics formats such as GIF, PNG, and PDF, which you can view using third-party applications.
SAS/GRAPH software always assigns a name and a description to each GRSEG so that you can identify it. By default, the names and descriptions are determined by the procedure. For example, a GRSEG produced by the GCHART procedure is assigned the name GCHART and a description such as PIE CHART OF MONTH.
By default, SAS/GRAPH appends each new GRSEG to the catalog. If you create more than one graph with a procedure during a SAS session and the GRSEGs are stored in the same catalog, SAS/GRAPH software appends a number to the end of the name of subsequent GRSEGs. This number makes the names unique within the catalog. For example, if you create three graphs with the GCHART procedure during the same SAS session, the GRSEGs are named GCHART, GCHART1, and GCHART2. SAS/GRAPH software uses this naming convention whether GRSEGs are being stored in a temporary or a permanent catalog.
You can supply a name and description when you create the graph by using the NAME= and DESCRIPTION= options. If you create more than one graph of the same name, the SAS/GRAPH software increments the specified name just as it does the default names.

What You Can Do with SAS/GRAPH Output

By default, output from SAS/GRAPH procedures that produce graphics output is sent to the ODS HTML destination using the HTMLBlue ODS style. Using the SAS ODS and the graphics options, you can direct graphics output to a variety of other destinations. Specifically, you can do the following with your graphics output:
  • send it directly to a graphics hard-copy device, such as a printer. For details, see Printing Your Graph.
  • save it in a temporary or permanent SAS catalog for later replay. See Replaying Your SAS/GRAPH Output.
  • export it to a graphics output file using different graphics file formats. For example, you can save SAS/GRAPH output in formats such as CGM or PostScript for use with other software applications. For details, see Exporting Your Output.
Regardless of the destination of a graph, a GRSEG is created for those SAS/GRAPH procedures that support GRSEGs. The GRSEG is stored in the WORK.GSEG catalog unless you specify a different catalog with the GOUT= procedure option. To generate only GRSEGs and suppress all other forms of graphics output, use the NODISPLAY graphics option. See DISPLAY.
After your graphics output is saved in a catalog, you can do the following with your graphics: