Previous Page | Next Page

The GMAP Procedure

Example 11: Creating a Map Using the Feature Table


Procedure Features:

ID statement

CHORO statement option:

DISCRETE

ODS Features:

ODS HTML statement:

BODY=

Other Features:

MERGE statement

GOPTIONS statement

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 sample program uses the following procedures and statements:

The following example creates the response data set SITES and merges it with the feature table US2. It then uses the combined data set to generate a map.

[Creating a Map Using the Spatial Map Data Set]

 Note about code
data sites;
   length stcode $ 2;
   input region stcode $ sites @@;
   state=stfips(stcode);
   datalines;
 6 AR  12 10 AK   7  4 AL  12  9 AZ  10
 9 CA  90  8 CO  15  1 CT  15  3 DE  18
 4 FL  52  4 GA  15  9 HI   4  7 IA  16
10 ID   8  5 IL  38  5 IN  30  7 KS  10
 4 KY  16  6 LA  15  1 MA  30  3 MD  13
 1 ME  12  5 MI  72  5 MN  30  7 MO  22
 4 MS   1  8 MT   8  4 NC  22  8 ND   0
 7 NE  10  1 NH  18  2 NJ 105  6 NM   9
 9 NV   1  2 NY  78  5 OH  34  6 OK  10
10 OR  10  3 PA 100  4 PR  56  1 RI  12
 4 SC  26  8 SD   2  4 TN  14  6 TX  26
 8 UT  12  3 VA  25  1 VT   8 10 WA  49
 5 WI  40  3 WV   6  8 WY   3
;
run;
 Note about code
proc sort data=sites out=sites;
   by state;
run;

proc sort data=maps.us2 out=mymap;
   by state;
run;
 Note about code
data both;
   merge mymap sites;
   by state;
run;
 Note about code
goptions reset=all border;
ods listing close;
ods html body="hazmat_sites.html";
 Note about code
title1 "Region Map Created with a Feature Table";
footnote1 j=r "GMPSPATL";
 Note about code
proc gmap data=both;
   id _map_geometry_;
   choro region/discrete;
run;
quit;
 Note about code
ods html close;
ods listing;

Previous Page | Next Page | Top of Page