![]() | ![]() | ![]() | ![]() | ![]() |
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The graphics output in the Results tab was produced using SASĀ® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Define the libref of MAPS if necessary */
*libname maps 'location-of-map-data-sets';
/* create the SITES data set */
data sites;
length stcode $ 2;
input Region Stcode $ Sites;
State=stfips(stcode);
datalines;
1 AK 12
4 AL 7
4 AR 12
2 AZ 10
1 CA 90
1 CO 15
5 CT 15
5 DE 18
4 FL 52
4 GA 15
1 HI 4
3 IA 16
1 ID 8
3 IL 38
3 IN 30
3 KS 10
4 KY 16
4 LA 15
5 MA 30
4 MD 13
5 ME 12
3 MI 72
3 MN 30
3 MO 22
4 MS 1
1 MT 8
4 NC 22
3 ND 0
3 NE 10
5 NH 18
5 NJ 105
2 NM 9
1 NV 1
5 NY 78
3 OH 34
2 OK 10
1 OR 10
5 PA 100
5 RI 12
4 SC 26
3 SD 2
4 TN 14
2 TX 26
1 UT 12
4 VA 25
5 VT 8
1 WA 49
3 WI 40
5 WV 6
1 WY 3
;
run;
/* Add a drill down variable to the */
/* sample data set */
data newsites;
length regiondrill $ 40;
set sites;
if region=1 then
regiondrill='HREF="hazsite_statebody.html#Region1"';
if region=2 then
regiondrill='HREF="hazsite_statebody.html#Region2"';
if region=3 then
regiondrill='HREF="hazsite_statebody.html#Region3"';
if region=4 then
regiondrill='HREF="hazsite_statebody.html#Region4"';
if region=5 then
regiondrill='HREF="hazsite_statebody.html#Region5"';
run;
/* This sample writes its output to C:\TEMP */
/* when run on the Windows operating system. */
/* Modify the destination on the FILENAME */
/* statement below if you want to write the */
/* output to a location other than C:\TEMP */
/* or if you are running on an operating */
/* system other than Windows. */
filename odsout 'c:\temp';
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
goptions device=gif xpixels=600 ypixels=400;
/* Close the listing destination */
ods listing close;
/* Open the ODS HTML destination using */
/* the PATH, BODY, CONTENTS, and FRAME */
/* options */
ods html path=odsout
body='hazsite_mapbody.html'
contents='hazsite_contents.html'
frame='hazsite_frame.html';
/* Add titles to the map */
title1 'Hazardous Waste Sites in EPA Regions (1997)';
title2 h=12pt 'Click on a region for more information';
/* Create the graph using the HTML= option */
/* on the CHORO statement */
proc gmap map=maps.us data=newsites;
id state;
choro region / discrete
html=regiondrill
coutline=black
nolegend
des='EPA Regional Map'
;
run;
quit;
/* Open the ODS HTML body file for the state maps */
ods html body='hazsite_statebody.html'
anchor='Region1'
path=odsout;
/* sort the response data set by region */
proc sort data=newsites;
by region;
run;
/* define legend characteristics */
legend1 label=('Number of Sites:' position=(top center))
value=(j=l '0-24' '25-49' '50-74' '75-99' 'over 100')
frame;
options nobyline;
title1 'Waste Sites per State in Region #byval(region)';
/* Create the regional maps */
proc gmap map=maps.us data=newsites;
by region;
id state;
block sites / midpoints=(12 37 62 87 112)
legend=legend1
shape=cylinder
blocksize=4
coutline=black
des='State Maps'
name='states01';
run;
quit;
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This sample code produces a drill down map for the web. Click here to view the HTML output.
| Type: | Sample |
| Topic: | Third Party ==> Output ==> Device Drivers ==> GIF, JPEG, PNG SAS Reference ==> ODS (Output Delivery System) Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps SAS Reference ==> Procedures ==> GMAP |
| Date Modified: | 2005-08-27 03:03:23 |
| Date Created: | 2005-05-23 14:15:19 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |





