Previous Page | Next Page

SAS/GRAPH Statements

Example 8. Creating a Simple Web Page with the ODS HTML Statement

Features:

ODS HTML statement options:

BODY=

CLOSE

GOPTIONS statement options:

RESET=

LEGEND statement options:

ACROSS=

LABEL=

Sample library member: GONCSWB1

Displaying a Map in a Web Page

[output from gonscwb1.sas]

This example illustrates the simplest way to use the ODS HTML statement to create an HTML file and a GIF file that you can display in a Web browser. It generates one body file that displays one piece of SAS/GRAPH output--a map of average per capita income.

This example also illustrates default pattern behavior with maps and explicit placement of the legend on the graph. It shows how the default solid map pattern uses different shades of the default style color to differentiate between countries.

And it shows how to use a LEGEND statement to arrange and position a legend so it fits well with the graph's layout.

Close the ODS Listing destination for procedure output, and set the graphics environment. To conserve system resources, ODS LISTING CLOSE closes the Listing destination for procedure output. Thus, the graphics output is not displayed in the GRAPH window, although it is written to the graphics catalog and to the GIF files.

ods listing close;
goptions reset=all;

Open the ODS HTML destination. The BODY= option names the file for storing HTML output.

ods html body="na_body.html"
       ;

Define title for the map. By default, any defined title is included in the graphics output (GIF file).

title "North America Gross National Income per Capita 2004";

Define legend characteristics. The ACROSS= option defines the number of columns in the legend. The LABEL= option specifies a legend label and left-justifies it above the legend values.

legend across=2
       origin=(8,5)
       mode=share
       label=(position=top
             justify=left
             "Gross National Income per Capita")
;

Generate the prism map. Because the NAME= option is omitted, SAS/GRAPH assigns the default name GMAP to the GRSEG entry in the graphics catalog. This is the name that is assigned to the GIF file created by the ODS HTML statement.

proc gmap map=maps.namerica data=sashelp.demographics;
      id cont id;
 	  format gni dollar10.0;
      choro gni / levels=10 legend=legend1;
run;
quit;

Close the ODS HTML destination, and open the ODS Listing destination. You must close the HTML destination before you can view the output with a browser. ODS LISTING opens the Listing destination so that the destination is again available for displaying output during this SAS session.

ods html close;
ods listing;

Previous Page | Next Page | Top of Page