Flylib.com

Books Software

 
 
 

Chapter 4: SASGRAPH Output


Chapter 4: SAS/GRAPH Output

About SAS/GRAPH Output

Most SAS/GRAPH procedures produce graphics output , which is distinct from SAS output . Whereas SAS output is made up of text, graphics output is made up of commands that tell a graphics device how to draw graphics.

This chapter discusses how to display, print, store, modify, and transport SAS/GRAPH output after you have created it. For information on SAS/GRAPH language elements and programs and on how procedure output is generated, see Chapter 2, SAS/GRAPH Programs, on page 25.

What You Can Do With SAS/GRAPH Output

By default, SAS/GRAPH procedures that produce graphics output display the output on your monitor or terminal, using either the GRAPH window or the direct display method. For details, see Displaying Graphics Output on Monitors or Terminals on page 49. SAS/GRAPH also can direct graphics output to a variety of other destinations. Graphics output can be

  • sent directly to a graphics hardcopy device, such as a printer, plotter, or slide camera. The way you send graphics output to a hardcopy device depends on your hardware, operating environment, and system configuration. For details, see Printing Graphics Output on page 51.

  • saved in a temporary or permanent SAS catalog entry for later replay. For details, see Storing Graphics Output in SAS Catalogs on page 53.

  • modified with the graphics editor. You can edit or create graphics output, and save the modified graph to a catalog. For details, see Modifying SAS/GRAPH Output on page 55.

  • transported in catalogs from one operating environment to another. For details, see Transporting and Converting Graphics Output on page 56.

  • converted for use with a different version of SAS by converting the catalog containing the graphics output. For details, see Converting Catalogs to a Different Version of SAS on page 59.

  • exported to external files 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 packages. For details, see About Exporting SAS/GRAPH Output on page 59.

In addition, you can produce graphics output as GIF files and automatically generate HTML files so that you can display your graphics output with a Web browser. For details, see Chapter 9, Introducing SAS/GRAPH Output for the Web, on page 369.

Regardless of the other types of output generated, SAS/GRAPH procedures always generate a SAS catalog entry. The entry is stored in the WORK.GSEG catalog unless you specify a different catalog with the GOUT= option in a PROC statement. To generate only catalog entries and suppress all other forms of graphics output, use the NODISPLAY graphics option.



Displaying Graphics Output on Monitors or Terminals

If you want to see your graphics output immediately or preview it before generating a hardcopy, you can send it to your monitor or terminal.

Note: If you are using a terminal or PC that emulates a terminal, it must be a graphics terminal.

In most environments, SAS/GRAPH automatically displays graphics output in the GRAPH window. If your environment does not support the GRAPH window, SAS/GRAPH displays your graphs with the direct display method. See Displaying Graphs with Direct Display on page 50.

You can suppress the display of graphics output with the NODISPLAY graphics option. Suppressing a display is useful when you want to create only a catalog entry.

Displaying Graphs with the GRAPH Window

The GRAPH window , which is available in the SAS windowing environment, displays catalog entries of type GRSEG. You can use this window to view either the graphics output that you are currently generating or graphics output that has been stored in a catalog. You can scroll backward and forward through the catalog entries.

Some devices allow you to use up to four graph windows : GRAPH1, GRAPH2, GRAPH3, and GRAPH4. By default, the GRAPH1 window displays the graphs in the default catalog, WORK.GSEG, or the catalog that you specified with the GOUT= option.

The GRAPH window acts like other SAS windows: you can resize it and move it, and you can submit global SAS window commands from it. For details on sizing windows, see the SAS documentation for your operating environment. For a description of SAS window commands, see SAS Language Reference: Dictionary .

GRAPH window commands control how the graphs appear in the window. For a description of these commands, refer to the SAS Help facility for the GRAPH window.

Opening and Closing the GRAPH Window

The GRAPH Window opens automatically when you submit a procedure that produces graphics output, or when you select a catalog entry from the PROC GREPLAY window or from the SAS Explorer window. You can also open the GRAPH window with the GRAPH n command. The GRAPH n command opens the default catalog WORK.GSEG, or a catalog you specify, or a specific entry.

The GRAPH n command has the following form:

GRAPH n << libref .> catalog- name <. entry-name <.GRSEG>>>

n

  • is a number from 1 to 4 that indicates which GRAPH window to open.

libref

  • points to the library where the catalog is or will be stored.

catalog-name

  • is the name of the catalog whose contents you want to view. The default is WORK.GSEG. If the specified catalog does not contain any graphics entries, the window opens but is empty. The catalog assignment is temporary and remains in effect only while the GRAPH window remains open. To change the catalog, resubmit the GRAPH n command.

entry-name

  • is the name of the catalog entry that you want to view. If you omit entry-name or the entry does not exist, the last graph in the catalog is displayed. If you specify entry-name , you must also supply the libref and catalog name.

GRSEG

  • is the type of catalog entry.

To close the GRAPH window, issue the END command.

Sizing the GRAPH Window

The default size of a GRAPH window depends on the display device.

CAUTION:

  • Resizing the GRAPH window after you have displayed a graph can distort the graphs. If you replay a graph in a GRAPH window that is a different size from the size at which you created the graph, the graph may be distorted . Distortion occurs if the new HSIZE and VSIZE values do not maintain the width-to-height ratio of the original window.

Doing any of the following may change the HSIZE and VSIZE values and consequently the size of the GRAPH window:

  • changing the device driver

  • specifying a target device

  • specifying dimensions with the HSIZE= and VSIZE= graphics options.

In addition, resizing the GRAPH window can reduce the number of cells available for the output. In order to display some types of graphs in a reduced GRAPH window, you may need to increase the number of cells either by using the HPOS= and VPOS= graphics options or by modifying the device driver. To ensure that graphs have an adequate number of cells , use a full-size GRAPH window when creating the graphs.You can then reduce the window to replay the graphs. For more information on dimensions and cell size, see About the Graphics Output Area on page 34.

If you create most or all of your graphs at the same size or with the same aspect ratio, you can avoid distortion if you size the window before you draw the graphs and then use the WSAVE command to save the position and dimensions of the window. If you resize the GRAPH windows and do not use the WSAVE command, the new size is not saved, even in the same SAS session.

Displaying Graphs with Direct Display

Environments that do not support the GRAPH window use the direct display method. With this method, your display is cleared and the graph appears when you run a graphics procedure.

If the procedure produces more than one graph, you are prompted to press ENTER between each graph for the next one to be displayed. To return to your program, press END or ENTER after the last graph.

You can display the graphs automatically and control the amount of time between each graph with the GWAIT= and NOPROMPT graphics options. GWAIT= specifies the number of seconds before the next graph is drawn. NOPROMPT suppresses the delay between the graphs displayed. In this case, SAS/GRAPH automatically returns to your program after the last graph displays. (See Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261 for a complete description of these graphics options.)

With the direct display method, you cannot scroll to other graphs in the catalog. To redisplay graphs, you must rerun the procedure or replay the catalog entries. For information on replaying graphs, see Chapter 43, The GREPLAY Procedure, on page 1237.