GMAP Procedure

Example 12: Using Traditional Map Data When Labelling Provinces on a Map

Features:

MAP= required argument referring to traditional map data

DATA= required argument referring to response data

ID statement

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

The global PATTERN statement

Annotate Facility

Data set: MAPS.BELARUS (map data)
Sample library member: GMPLABEL
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 States on a U.S. Map With Traditional Map Data

Program

goptions reset=all border;
title "Labeling Provinces with the MAPLABEL Macro";
pattern1 value=empty color=blue repeat=6;
%annomac;
%maplabel (maps.belarus, maps.belarus2, work.labelout, idname, id,
          font=Arial Black, color=crimson, size=4, hsys=3);
proc gmap map=maps.belarus data=maps.belarus;
   id id;
   choro id / stat=sum nolegend annotate=labelout;
run;
quit;

Program Description

Set the graphics environment.
goptions reset=all border;
Define the title for the map.
title "Labeling Provinces with the MAPLABEL Macro";
Define pattern characteristics. PATTERN1 defines a single map pattern that is repeated for each of the six map areas (provinces). The pattern is an empty fill with a blue border. The VALUE= option defines a map or plot pattern. Specifying a color causes PATTERN1 to generate only one pattern definition. The REPEAT= option specifies the number of times to repeat the pattern definition.
pattern1 value=empty color=blue repeat=6;
Create the Annotate data set. The %ANNOMAC macro enables the annotate macros. The %MAPLABEL annotate macro creates the annotate data set.
%annomac;
%maplabel (maps.belarus, maps.belarus2, work.labelout, idname, id,
          font=Arial Black, color=crimson, size=4, hsys=3);
Produce the choropleth map.Use the option STATISTIC=SUM to chart the summed value of all observations with a given matching ID. The NOLEGEND option suppresses the legend. The ANNOTATE= option specifies the data set to annotate the map.
proc gmap map=maps.belarus data=maps.belarus;
   id id;
   choro id / stat=sum nolegend annotate=labelout;
run;
quit;