Example 8: Creating a Simple Web Page with the ODS HTML Statement
Features: |
ODS HTML statement options: BODY=
- GOPTIONS statement options:
- BORDER
- RESET=
- LEGEND statement options:
- ACROSS=
- LABEL=
|
Sample library member: |
GONCSWB1 |
This example illustrates
the simplest way to use the ODS HTML statement to create an HTML file
and a PNG file that you can display in a Web browser. This example
also illustrates
-
the default pattern behavior with
maps and explicit placement of the legend on the graph
-
how the default solid map pattern
uses different shades of the default style color to differentiate
between countries
-
how to use a LEGEND statement to
arrange and position a legend so that it fits well with the graph's layout.
This example generates one body file that displays
one piece of
SAS/GRAPH output
a map of average per capita income.
Displaying a Map in a Web Page
Program
goptions reset=all border;
ods html body="na_body.html";
title1 "North America Gross National Income per Capita 2004";
legend across=2
origin=(8,5)
mode=share
label=(position=top
justify=left
"Gross National Income per Capita")
;
proc gmap map=maps.namerica data=sashelp.demographics;
id cont id;
format gni dollar10.0;
choro gni / levels=10 legend=legend1;
run;
quit;
Program Description
Set the graphics environment.
goptions reset=all border;
Set 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 (PNG
file).
title1 "North America Gross National Income per Capita 2004";
Define legend characteristics. The
ACROSS= option defines the number of columns in the legend. The ORIGIN=
option specifies on the procedure output area the position of the
lower left corner of the legend box. The MODE=SHARE option displays
the legend in the procedure output area along with the map. 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 PNG 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;
Copyright © SAS Institute Inc. All rights reserved.