GMAP Procedure

Example 1: Using GfK GeoMarketing Map Data to Produce a Simple Block Map

Features:

MAP= required argument referring to GfK map data

DATA= argument referring to response data

ID statement

BLOCK statement options:
BLOCKSIZE=
RELZERO
Other features:

System option FMTSEARCH=

SQL procedure

Data sets: MAPSGFK.ASIA (map data)

DEMOGRAPHICS (table of response data)

Format: ison2a
Sample library member: GMPGSIMP
CAUTION:
The GfK GeoMarketing map data set used in this example is licensed to be used only with SAS/GRAPH.
This example uses GfK map data to produce a block map that shows the population of countries in Asia. 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= option is used, the GMAP procedure selects a number of levels based on the number of map areas. It then calculates the appropriate response levels. The elongated countries in the output indicate that GfK uses a different projection method than does output created with a traditional Asia map data set.
Simple Block Map From GfK Map Data

Program

options fmtsearch=(sashelp.mapfmts);
proc sql; 
create table demographics(rename=(iso=oiso newiso=iso id=oldid newid=ID)) as
select demo.*, 
put(demo.iso,z3.) as newiso format=$3.,
put(demo.iso,ison2a.) as newid 
from sashelp.demographics as demo
;
alter table demographics
modify ID char(15) label='Alpha2 Country Code';
quit;
goptions reset=all border;
title1 "Population in Asia";
footnote1 j=r "This map drawn with GfK map data";
proc gmap data=demographics(where=(cont=95))
          map=mapsgfk.asia (where=(resolution <=4)) all;
   id iso;
   block pop / blocksize=1 relzero;
run;
quit;

Program Description

Specify the format catalog to search that has the predefined ISO alpha2 code.
options fmtsearch=(sashelp.mapfmts);
Create a table named demographics using sashelp.demographics as the base and changing its variables to match GfK variable types and lengths. This table will be used as the response data set. Note that the ISO variable was numeric in the original sashelp.demographics data but is the character variable OISO in the GfK map data set. The format 'ison2a' uses the country's ISO numeric code to output the country's ISO alpha2 code. Also note that the ID variable was a numeric geographic locator code (glc) in the original sashelp.demographics data but is represented by the ISOALPHA2 variable in the GfK map data set.
proc sql; 
create table demographics(rename=(iso=oiso newiso=iso id=oldid newid=ID)) as
select demo.*, 
put(demo.iso,z3.) as newiso format=$3.,
put(demo.iso,ison2a.) as newid 
from sashelp.demographics as demo
;
alter table demographics
modify ID char(15) label='Alpha2 Country Code';
quit;
Set the graphics environment.
goptions reset=all border;
Define the title and footnote for the map.
title1 "Population in Asia";
footnote1 j=r "This map drawn with GfK map data";
Produce the block map.Specify the demographics table just created as the response data set. Specify a GfK map data set named mapsgfk.asia. The ALL argument specifies that the output should include all of the map areas from the map data set. The ID statement specifies the variable that is in both the map data set and the response data set and defines map areas. Note that the ISO variable is character. The BLOCK statement specifies the variable in the response data set that contains the response values for each of the map areas. The BLOCKSIZE= option specifies the width of the blocks. The RELZERO option specifies that the block values are relative to zero.
proc gmap data=demographics(where=(cont=95))
          map=mapsgfk.asia (where=(resolution <=4)) all;
   id iso;
   block pop / blocksize=1 relzero;
run;
quit;