GMAP Procedure

Example 6: Using Traditional Map Data to Assign a Format to the Response Variable

Features:

MAP= required argument referring to traditional map data

DATA= required argument referring to response data

FORMAT statement

ID statement

AREA statement option MIDPOINTS=

BLOCK statement options:
LEGEND=
RELZERO
Other features:

FORMAT procedure

LEGEND statement

Data sets: MAPS.ASIA (map data)

SASHELP.DEMOGRAPHICS (response data)

Sample library member: GMPFORMT
This example creates formats for the response variables. The format for the POP variable defines and labels ranges of values. These ranges appear in the legend and make the map easier to understand. The example also uses the AREA statement to patterns the map areas by region.
Using Traditional Map Data When Assigning Format to the Response Variables

Program

goptions reset=all border;
proc format;
  value popfmt low-1000000="0-1"
               1000001-10000000="1-10"
               10000001-100000000="10-100"
               100000001-500000000="100-500"
               500000001-high="over 500";
run;
proc format;
  value $ regionfmt "SEAR" = "South-East Asia"
                    "EUR" = "Europe"
                    "EMR" = "Eastern Mediterranean"
                    "WPR" = "Western Pacific";
run;
title1 "Population Data for Asia (2005)";
legend1 label=("Population (Millions)");
proc gmap data=sashelp.demographics(where=(cont=95))
          map=maps.asia all;
   format pop popfmt.;
   format region $regionfmt.;
   id id;
   area region / midpoints="SEAR" "EUR" "EMR" "WPR";
   block pop / legend=legend1
               relzero;
run;
quit;

Program Description

Set the graphics environment.
goptions reset=all border;
Create a format for POP.POPFMT. defines the ranges of values for POP and labels the values.
proc format;
  value popfmt low-1000000="0-1"
               1000001-10000000="1-10"
               10000001-100000000="10-100"
               100000001-500000000="100-500"
               500000001-high="over 500";
run;
Create a format for REGION.REGIONFMT. labels the values for REGION.
proc format;
  value $ regionfmt "SEAR" = "South-East Asia"
                    "EUR" = "Europe"
                    "EMR" = "Eastern Mediterranean"
                    "WPR" = "Western Pacific";
run;
Define the title for the map.
title1 "Population Data for Asia (2005)";
Assign the legend label.
legend1 label=("Population (Millions)");
Produce the block maps. 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 SASHELP.DEMOGRAPHICS does not include an observation for the map area. The FORMAT statements assign POPFMT. to the POP variable and $REGIONFMT. to the REGION variable. The AREA statement assigns patterns to the map areas according to the values of the REGION variable. The RELZERO option specifies that the blocks values are relative to zero.
proc gmap data=sashelp.demographics(where=(cont=95))
          map=maps.asia all;
   format pop popfmt.;
   format region $regionfmt.;
   id id;
   area region / midpoints="SEAR" "EUR" "EMR" "WPR";
   block pop / legend=legend1
               relzero;
run;
quit;