Developing Web Presentations with the GIF, JPEG, SVG, and PNG Devices

You can use the GIF, JPEG, SVG, and PNG devices to create Web presentations that consist of static graphics. You can also add data tips and drill-down links to your graphs.

About the GIF, JPEG, SVG, and PNG Devices

The GIF, JPEG, SVG, and PNG devices enable you to generate static graphs for your Web presentation. You can use these devices when you are sending output to the ODS HTML destination in order to generate an HTML file to display one or more graphs. For details, see Generating an HTML Output File Using the GIF, PNG, SVG, or JPEG Device.
Enhancements that are available to GIF, PNG, SVG, and JPEG Web presentations include adding drill-down links or tool-tip functionality. Styles other than the default ODS style can be applied with the STYLE= ODS option. Drill-down links can be added to the following elements:
  • the chart elements (such as the bars, plot markers, or GMAP areas) using the URL= or the HTML= option
  • the legend using the HTML_LEGEND= option
  • the titles and footnotes using the LINK= option in the title or footnote statement
  • the annotated text or graphics or both that use the HTML= variable in the annotate data set

When to Use the GIF, JPEG, SVG, and PNG Devices

The GIF, JPEG, SVG, and PNG devices are best suited to Web presentations that consist of static graphs and graphs with simple drill-down capabilities. If you need more interactivity, or if you want to compute responses to drill-down actions when the graph is viewed, then generate a presentation using the ACTIVEX or JAVA device. The GIF device provides only 256 colors, which might be suitable for many presentations. The PNG, SVG, and JPEG devices provide TruColor support and are better suited for Web presentations that contain color-intensive graphics.

Generating an HTML Output File Using the GIF, PNG, SVG, or JPEG Device

Follow these steps to generate a complete Web presentation that consists of an HTML output file and one or more images:
  1. Close the current ODS HTML destination:
    ods html close;
  2. Enter your DATA step, if necessary.
  3. Open ODS HTML and specify the options shown in the following statement:
    ods html
       path="C:/Public/graph" (url=none)/* HTML output directory */
       body="webgif1.htm"       /* HTML filename              */
       gpath="C:/Public/graph/images"; /* graphics output file  location */
    Specifying URL=NONE tells ODS to reference the graphics output file simply by name without prefixing the full path (assuming that the graphics output file is in the same directory as the HTML file).
    Note: With the GIF, JPEG, SVG, or PNG device, footnotes and titles are stored in the graphics output file by default. To move footnotes and titles out of the graphics output file and into the HTML file, specify the ODS HTML options NOGTITLE or NOGFOOTNOTE, or both. See Controlling Titles and Footnotes.
  4. Specify your device:
    goptions reset=all device=png;
  5. Run procedures to generate graphs. For example
    proc gchart data=sashelp.class;
            hbar3d sex / sumvar=height type=mean;
     run;
    quit;
    You can use BY statements to create multiple graphs.
  6. Close ODS HTML to close the output file, and then reopen ODS HTML:
    ods html close;
    ods html;
  7. Open the HTML output file in your Web browser. For example, open file C:\Public\graph\webgif1.htm.
Note: Using this technique, however, you cannot create drill-down links or data tips for your graphs.
For an example, see Example: Generating PNG Output.