Generating Static Graphics |
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 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
For details, see Adding Drill-Down Links to Web Presentations Generated with a Static-Graphic Device.
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:
To conserve resources, close the ODS LISTING destination (the Output window, which is open by default):
ods listing close;
Specify your ODS HTML statement, with the following options:
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 with Java and ActiveX Devices in HTML Output.
goptions reset=all device=png;
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.
Close the HTML output file and reopen the ODS listing destination:
ods html close; ods listing;
Reopening the listing destination establishes standard operating conditions for later programs that you run in the same SAS session.
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 Generating PNG Output.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.