GMAP Procedure

Example 19: Using GfK GeoMarketing Map Data While Rotating and Tilting a Surface Map

Features:

MAP= required argument referring to GfK map data

DATA= argument referring to response data

ID statement

SURFACE statement options :
STATISTIC=
CONSTANT=
NLINES=
ROTATE=
TILT=
Other features:

System option FMTSEARCH=

SQL procedure

Data sets: MAPSGFK.EUROPE (map data)

DEMOGRAPHICS (table of response data)

Format: ison2a
Sample library member: GMPGROSU
CAUTION:
The GfK GeoMarketing map data set used in this example is licensed to be used only with SAS/GRAPH.
This example tilts and rotates the surface map and uses more lines to draw the surface. Not all the countries that are represented in the GfK map data set have demographic data in the response data set.
Rotating and Tilting a Surface Map with GfK Map Data

Program

options fmtsearch=(sashelp.mapfmts);
proc sql;
create table demographics(drop=iso id rename=(oiso=iso isoalpha2=id)) as
select demo.*, names.id, names.isoalpha2, 
  put(names.iso,z3.) as oiso format=$3.
from sashelp.demographics as demo
join
newnames as names
on names.id=demo.id
;
quit;
goptions reset=all border;
title1 "Population in Europe (2005)";
footnote1 j=r "This map drawn with GfK map data";
proc gmap map=mapsgfk.europe data=demographics;
id id;
surface pop / stat=mean
              constant=4
              nlines=100
              rotate=40
              tilt=60;
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(drop=iso id rename=(oiso=iso isoalpha2=id)) as
select demo.*, names.id, names.isoalpha2, 
  put(names.iso,z3.) as oiso format=$3.
from sashelp.demographics as demo
join
newnames as names
on names.id=demo.id
;
quit;
Set the graphics environment.
goptions reset=all border;
Define the title and footnote for the map.
title1 "Population in Europe (2005)";
footnote1 j=r "This map drawn with GfK map data";
Produce the surface map.The STATISTIC= option adds together all of the observations matching a given ID value and this sum is divided by the number of nonmissing observations matched. The CONSTANT= option specifies a value that is less than the default value, resulting in spikes that are narrower at the base. The NLINES= option specifies the maximum number of map lines, which gives the best map shape resolution. The ROTATE= and TILT= options adjust the map orientation to make the crowded spikes in the northeast portion of the map easier to distinguish.
proc gmap map=mapsgfk.europe data=demographics;
id id;
surface pop / stat=mean
              constant=4
              nlines=100
              rotate=40
              tilt=60;
run;
quit;