The GMAP Procedure |
Procedure Features: |
| ||||
ODS Features: |
| ||||
Other Features: |
| ||||
Sample library member: | GMPSPATL |
When you use a feature table with the GMAP procedure, you must merge the feature table with your response data set before generating a map, storing the combined data in a new data set. On PROC GMAP, you use the DATA= option to name the combined data set, and you use the ID statement to identify the variable that contains the spatial information.
To illustrate the use of a feature table, assume you want to generate a map of the United States. Rather than using the traditional map data set MAPS.US, you want to use its corresponding feature table. To determine which feature table corresponds to a traditional map data set, look in the MAPS.METAMAPS data set:
The feature table MAPS.US2 corresponds to the traditional map data set MAPS.US.
In MAPS.US2, the values of the variable _MAP_GEOMETRY_ encapsulate the geometry object.
The sample program uses the following procedures and statements:
PROC SORT sorts WORK.SITES by the values of variable STATE. This prepares SITES for a merge with the feature table MAPS.US2. The variable STATE identifies the map areas in both SITES and MAPS.US2.
PROC SORT sorts the feature table MAPS.US2. The OUT= option specifies that the sorted data be written to a new data set WORK.MYMAP.
In the DATA step, the MERGE statement merges the feature table with the response data. The combined data set is saved to a new data set named BOTH. The data set BOTH is stored in WORK, a temporary library. To use the combined data set in other SAS/GRAPH programs, you would need to save the merged data set to a permanent library.
On the PROC GMAP statement, the DATA= option points to the combined data set, BOTH. The ID statement specifies _MAP_GEOMETRY_ as the variable that contains the spatial data.
proc sort data=sites out=sites; by state; run; proc sort data=maps.us2 out=mymap; by state; run; |
data both; merge mymap sites; by state; run; |
goptions reset=all border; ods listing close; ods html body="hazmat_sites.html"; |
title1 "Region Map Created with a Feature Table"; footnote1 j=r "GMPSPATL"; |
proc gmap data=both; id _map_geometry_; choro region/discrete; run; quit; |
ods html close; ods listing; |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.