GMAP Procedure

Example 11: Using GfK GeoMarketing Map Data When Labelling Provinces on a Map

Features:

MAP= required argument referring to GfK map data

DATA= required argument referring to response data

ID statement

CHORO statement options :
ANNOTATE=
NOLEGEND
COUTLINE=
STAT=
Other features:

GREMOVE procedure

SORT procedure

Annotate Facility

Data set: MAPSGFK.BELARUS (map data)
Sample library member: GMPGLABL
CAUTION:
The GfK GeoMarketing map data set used in this example is licensed to be used only with SAS/GRAPH.
This example uses the Annotate facility to add labels to each area in a map of Belarus. The CHORO statement assigns the Annotate data set to the map. The %MAPLABEL annotate macro is used to create and position the map labels. For more information about this macro, see %MAPLABEL Macro.
Labeling Provinces on a Map with GfK Map Data

Program

goptions reset=all border;
title "Labeling Provinces with the MAPLABEL Macro";
footnote j=r "This map drawn with GfK map data";
proc sort data=mapsgfk.belarus out=belarus;
by id1 id; 
run;
proc gremove data=belarus out=belarus_outline;
by id1;
id id;
run;
%annomac;
%maplabel (belarus_outline, mapsgfk.belarus_attr, work.labelout, id1name, id1,
           font=Albany AMT, color=black, size=1.5, hsys=3);
proc gmap map=belarus data=belarus;
   id id1 id;
   choro id1 / nolegend annotate=labelout coutline=gray stat=first;
run;
quit;

Program Description

Set the graphics environment.
goptions reset=all border;
Define the title and the footnote for the map.
title "Labeling Provinces with the MAPLABEL Macro";
footnote j=r "This map drawn with GfK map data";
Sort the GfK data by region and district variables.
proc sort data=mapsgfk.belarus out=belarus;
by id1 id; 
run;
Use the GREMOVE procedure to remove the internal boundaries from the Belarus map.This prepares the data for the %MAPLABEL macro, which will determine the centroid of each province and then center each province label.
proc gremove data=belarus out=belarus_outline;
by id1;
id id;
run;
Create the Annotate data set. The %ANNOMAC macro enables the annotate macros. The %MAPLABEL annotate macro creates the annotate data set.
%annomac;
%maplabel (belarus_outline, mapsgfk.belarus_attr, work.labelout, id1name, id1,
           font=Albany AMT, color=black, size=1.5, hsys=3);
Produce the choropleth map.The NOLEGEND option suppresses the legend. The ANNOTATE= option specifies the data set to annotate the map. The COUTLINE= option outlines each province in gray. The STATISTIC= option specifies that the GMAP procedure will match the first observation from the BELARUS data set and output the response value from this observation only.
proc gmap map=belarus data=belarus;
   id id1 id;
   choro id1 / nolegend annotate=labelout coutline=gray stat=first;
run;
quit;