GMAP Procedure

Example 10: Using Traditional Map Data to Produce a Simple Choropleth Map

Features:

MAP= required argument referring to traditional map data

DATA= required argument referring to response data

ID statement

CHORO statement option CDEFAULT=

Data sets: MAPS.EUROPE (map data)

SASHELP.DEMOGRAPHICS (response data)

Sample library member: GMPCHORO
This example produces a choropleth (two-dimensional) map that shows the population of countries in Europe. Since the DISCRETE option is not used, the response variable is assumed to have a continuous range of values. Because neither the LEVELS= nor MIDPOINTS= options are used, the GMAP procedure selects a number of levels based on the number of map areas. It then calculates the appropriate response levels. The legend shows the range of values for each level.
Producing a Simple Choropleth Map with Traditional Map Data

Program

goptions reset=all border;
title1 "Population in Europe";
proc gmap map=maps.europe(where=(id ne 405 and id ne 845))
          data=sashelp.demographics(where=(cont=93)) all;
  id id;
  choro pop / cdefault=yellow;
run;
quit;

Program Description

Set the graphics environment.
goptions reset=all border;
Define the title for the map.
title1 "Population in Europe";
Produce the choropleth map. The ALL argument specifies that the output should include all of the map areas from the map data set, even if the response data set SASHELP.DEMOGRAPHICS does not include an observation for the map area. The output shows 1 such area. The ID statement specifies the variable that is in both the map data set and the response data set that defines map areas. CDEFAULT= specifies the color for the map areas that have missing data. The WHERE= clause on the MAP= option excludes the islands of Greenland and Svalbard, which have no data in DEMOGRAPHICS data set. The WHERE= clause in the DATA= statement includes the Russian region countries Azerbaijan, Armenia, and Georgia.
proc gmap map=maps.europe(where=(id ne 405 and id ne 845))
          data=sashelp.demographics(where=(cont=93)) all;
  id id;
  choro pop / cdefault=yellow;
run;
quit;