Chapter Contents

Previous

Next
SAS/GRAPH Software: Reference

Using SAS/GRAPH Web Drivers to Create Web Output

SAS/GRAPH provides three device drivers that you can use to create graphics output for the Web: GIF, HTML, and WEBFRAME. The GIF driver creates GIF format files, and you have to create the HTML files to reference those files. The HTML and WEBFRAME drivers automatically write graphics output to one or more GIF files, and both create the HTML file(s) needed to display the GIF files. What distinguishes the HTML and WEBFRAME drivers is the layout they use to display the output:

HTML driver WEBFRAME driver
Generates one HTML file that displays all the graphics output on a single page. To see the output, you can scroll to any graph on the page.

Note: To get more control over the output, you can use ODS to generate Web output with this same layout.

Uses two frames to display graphs and, therefore, requires a browser that supports HTML frames. The left frame displays thumbnail-size versions of all the graphics output. To see a full-size version of the graph, select a thumbnail, and the full-size graph displays in the right frame.

Note: The WEBFRAME driver is the only SAS/GRAPH driver that creates thumbnail-size graphs; you cannot get this same layout using ODS.



Producing GIF Files (DEV=GIF)

The GIF driver produces a GIF file for each graph that is generated when the GIF device is specified. The GIF files are created from the GRSEG entries generated by SAS/GRAPH procedure output. To see the output, you have to create the HTML file(s) needed to view the GIF files in a Web browser.

To direct the GIF output files, you can let SAS/GRAPH use the default output location, or you can use a FILENAME statement and the GSFNAME= graphics option to specify a location as follows:

filename outfiles 'path-to-Web-server';
goptions gsfname=outfiles dev=gif;

For more details, see Specifying Output Locations for HTML and GIF Files. After a graphics procedure is run, the resulting GIF file can be used in any Web page.


Displaying Graphs on One Web Page (DEV=HTML)

The HTML device driver generates one HTML file and one or more GIF files. The GIF files are created from the GRSEG entries generated by SAS/GRAPH procedure output. To see the output, you use a browser to view the HTML file, which references the GIF file(s) created by the last graphics procedure that is run in the SAS program. If that procedure creates multiple GIF files, as would be the case with BY-group processing, the files are referenced consecutively so that they are displayed in sequence on a single Web page, as shown in Graphs Generated with DEVICE=HTML.

Graphs Generated with DEVICE=HTML

[IMAGE]

To direct the HTML and GIF output files, you can let SAS/GRAPH use the default output location, or you can use a FILENAME statement and the GSFNAME= graphics option to specify a location as follows:

filename outfiles 'path-to-Web-server-space';
goptions gsfname=outfiles dev=html;

For more details, see Specifying Output Locations for HTML and GIF Files.

Each time a graphics procedure is run, the HTML device driver creates an HTML file named index.html. This is the file you view in a browser. You cannot change this name.

Note:   To control the name of the output HTML files, use ODS to generate the Web output. For information on ODS, see Using the Output Delivery System (ODS) with SAS/GRAPH Software.  [cautionend]

The GIF files are always named by appending a .GIF extension to the name of the corresponding GRSEG entry. Thus, if you use a procedure's NAME= option to name a GRSEG MYGRAPH, then the GIF file is assigned the name mygraph.gif. If you do not use the NAME= option, then the GIF file is assigned the GRSEG's default name, such as gchart.gif. For more details, see Naming Conventions Used for GIF Files.

Note:   Because SAS/GRAPH does not replace existing GRSEG entries when a procedure creates a new entry of the same name, you may want to use a GREPLAY procedure to delete existing GRSEG entries before generating the Web output. For details, see Naming Conventions Used for GIF Files.  [cautionend]

With DEV=HTML, the output from each run of a graphics procedure overwrites the existing index.html file; this is true even when you use RUN-group processing to generate the procedure runs. Thus, when you view index.html, only output from the last run of a graphics procedure is displayed. To see additional output, use the GREPLAY procedure as discussed in Replaying Multiple Graphs for Web Output.

For an example, see Example 1: Using the HTML and WEBFRAME Device Drivers. For an example on using the Web drivers to create drill-down graphs, see Example 3: Using a Web Driver to Generate a Drill-down Graph.


Linking to Graphs with Thumbnail-Size Images (DEV=WEBFRAME)

The WEBFRAME device driver generates multiple HTML files and multiple GIF files. The GIF files are created from the GRSEG entries that are generated by SAS/GRAPH procedure output. The HTML file that you view in a browser defines two frames for displaying the output, as shown in Graphs Generated with DEVICE=WEBFRAME. Thus, to display the output from the WEBFRAME device driver, you must have a browser that supports HTML frames.

Graphs Generated with DEVICE=WEBFRAME

[IMAGE]

To direct the HTML and GIF output files, you can let SAS/GRAPH use the default output location, or you can use a FILENAME statement and the GSFNAME= graphics option to specify a location as follows:

filename outfiles 'path-to-Web-server-space';
goptions gsfname=outfiles dev=webframe;

For more details, see Specifying Output Locations for HTML and GIF Files.

The WEBFRAME device is designed for displaying multiple graphs. It creates these files:
index.html This is the file that you view in a browser or reference from another HTML page. It defines two frames for displaying procedure output. The left frame displays file sasthumb.html, and the right frame displays the graph selected in the left frame.
sasthumb.html This file references small, thumbnail versions of the GIF images that are created by the WEBFRAME device driver. Also, it links each thumbnail to its corresponding full-size GIF image. When file index.html is displayed in a browser, the thumbnails appear one under the other in the left frame. The name of the corresponding full-size image appears just below the thumbnail. When you click on a thumbnail, the full-size GIF image is displayed in the right frame.
GIF Files The WEBFRAME device driver creates a thumbnail/full-size image pair for each graph that is produced by the procedure output. The filename for the full-size image corresponds to the name in the GRSEG entry. The thumbnail image file is assigned the same name, but with the prefix "f". For information on the naming conventions that SAS/GRAPH uses for GRSEG entries, see Naming Conventions Used for GIF Files.
graphname.html Each full-size image has the name graphname.gif, where graphname corresponds to the name in the GRSEG entry. For each file graphname.gif, there is a corresponding HTML file named graphname.html, which simply references the GIF file. When a thumbnail image is selected in the left frame, the corresponding HTML file is loaded into the browser's right frame, displaying the GIF image.

Note:   Referencing the GIF files from an HTML file rather than displaying the GIF files directly gives you the capability of using the WEBFRAME driver to generate drill-down graphs (see About Drill-down Graphs).  [cautionend]

With DEV=WEBFRAME, the output from each run of a graphics procedure overwrites the existing index.html and sasthumb.html files; this is true even when you use run-group processing to generate the procedure runs. Thus, when you view index.html, only output from the last run of a graphics procedure is displayed. To see additional output, use the GREPLAY procedure as discussed in Replaying Multiple Graphs for Web Output.

For a complete example, see Example 1: Using the HTML and WEBFRAME Device Drivers. For an example on using the Web drivers to create drill-down graphs, see Example 3: Using a Web Driver to Generate a Drill-down Graph.


Replaying Multiple Graphs for Web Output

With DEV=HTML or DEV=WEBFRAME, the output from each run of a graphics procedure overwrites the existing index.html file (with DEV=WEBFRAME, the driver also overwrites the existing sasthumb.html). Thus, when you view index.html, only output from the last run of a graphics procedure is displayed.

Note:   If the last run generates multiple graphs, as would be the case with BY-group processing, then all of the output from that run is referenced in the final write to index.html.  [cautionend]

To view output from multiple procedure runs, do both of the following:

  1. specify PROC GREPLAY as the last graphics procedure run with DEV=HTML or DEV=WEBFRAME

  2. use the REPLAY statement with PROC GREPLAY to replay all the output you want to view.

For example, assume a program has three separate procedure runs that generate catalog entries named CENTRAL, SOUTH, and WEST, in that order. Without a PROC GREPLAY, only the file west.gif is displayed when you view index.html. However, assuming that the entries are stored in the default output catalog, WORK.GSEG, if you run the following GREPLAY procedure, then all three GIF files will be displayed when you view index.html:

proc greplay igout=work.gseg nofs;
   replay central south west;

Note:   You can replay any output from the catalog; you are not limited to replaying entries that were created in the current program.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.