GMAP Procedure

Example 17: Using GfK GeoMarketing Map Data to Produce a Simple Surface Map

Features:

MAP= required argument referring to GfK map data

DATA= argument referring to response data

ID statement

SURFACE statement option STAT=

Other features:

System option FMTSEARCH=

SQL procedure

Data sets: MAPSGFK.EUROPE (map data)

DEMOGRAPHICS (table of response data)

Format: ison2a
Sample library member: GMPGSURF
CAUTION:
The GfK GeoMarketing map data set used in this example is licensed to be used only with SAS/GRAPH.
This example produces a surface map that shows the annual population growth rate of countries in Europe. Not all the countries that are represented in the GfK map data set have demographic data in the response data set. The CONSTANT= and NLINES= options are not used. Therefore, the GMAP procedure draws a surface that consists of 50 lines and uses the default decay function to calculate spike height and base width. And because the ROTATE= and TILT= options are not used, the map is rotated 70 degrees around the Z axis and tilted 70 degrees with respect to the X axis.
Producing a Simple Surface 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 "Population Annual Growth Rate Percentage";
title2 "Europe (1995-2005)";
footnote1 j=r "This map drawn with GfK map data";
proc gmap map=mapsgfk.europe data=demographics;
id id;
surface popagr / stat=sum;
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 titles and the footnote for the map
title1 "Population Annual Growth Rate Percentage";
title2 "Europe (1995-2005)";
footnote1 j=r "This map drawn with GfK map data";
Produce the surface map.Use the option STATISTIC=SUM to chart the summed value of all observations with a given matching ID. The ID statement specifies the variable in the map data set and the response data set that defines the map areas.
proc gmap map=mapsgfk.europe data=demographics;
id id;
surface popagr / stat=sum;
run;
quit;