GMAP Procedure

Example 15: Using GfK GeoMarketing Map Data When Specifying Midpoints in a Prism Map

Features:

MAP= required argument referring to GfK map data

DATA= argument referring to response data

ID statement

FORMAT statement

PRISM statement options:
MIDPOINTS=
CDEFAULT=
Other features:

System option FMTSEARCH=

SQL procedure

Data sets: MAPSGFK.AFRICA (map data)

DEMOGRAPHICS (table of response data)

Format: ison2a
Sample library member: GMPGMDPT
CAUTION:
The GfK GeoMarketing map data set used in this example is licensed to be used only with SAS/GRAPH.
This example specifies a set of midpoints that are used to create the response levels.
Specifying Midpoints in a Prism Map with 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 "Adult Literacy Rate";
footnote1 j=r "This map drawn with GfK map data"; 
proc gmap data=demographics(where=(cont=94))
map=mapsgfk.africa(where=(lake=0)) density=low all;
id id;
format adultliteracypct percentn7.2;
prism adultliteracypct / midpoints=.10 to .90 by .20
                         cdefault=yellow;
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 "Adult Literacy Rate";
footnote1 j=r "This map drawn with GfK map data"; 
Produce the prism map. The WHERE= clause on the MAP= statement excludes lake regions from the 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 DEMOGRAPHICS does not include an observation for the map area. The output shows 3 such areas. The MIDPOINTS= option specifies the response levels for the map. The CDEFAULT= option sets the color of map areas that have missing data.
proc gmap data=demographics(where=(cont=94))
map=mapsgfk.africa(where=(lake=0)) density=low all;
id id;
format adultliteracypct percentn7.2;
prism adultliteracypct / midpoints=.10 to .90 by .20
                         cdefault=yellow;
run;
quit;