GREDUCE Procedure

Example: Reducing the Map of Canada

Features:

ID statement

Sample library member: GRDCANAD
This example illustrates major features of the GREDUCE procedure. Because the example uses one of the map data sets that are supplied with SAS/GRAPH, you might need to replace SAS-data-library in the LIBNAME statement with the actual location of the SAS library that contains the Institute-supplied map data sets on your system. If your site automatically assigns the libref MAPS to the SAS library that contains the Institute-supplied map data sets, delete the LIBNAME statement in this example.
In this example, the GREDUCE procedure creates the DENSITY variable for the CANADA2 map data set that is provided with SAS/GRAPH. First, the map is displayed at its original density by using the GMAP procedure.
Map of Canada
Second, the map is displayed by using density values of 0 to 2.
Map of Canada After Using GREDUCE procedure

Program

goptions reset=all border;
title1 "Canada";
title2 "Using all DENSITY values";
pattern value=msolid repeat=12 color=white;
proc gmap map=maps.canada2 data=maps.canada2 all;
  id province;
  choro province / nolegend coutline=blue;
run;
proc greduce data=maps.canada2 out=can2;
   id province;
run;
title2 "Using only DENSITY values 0 to 2";
proc gmap map=can2
          data=can2 all density=2;
   id province;
   choro province / nolegend coutline=blue;
run;
quit;

Program Description

Set the graphics environment.
goptions reset=all border;
Define the title for the first map.
title1 "Canada";
title2 "Using all DENSITY values";
Define pattern characteristics.
pattern value=msolid repeat=12 color=white;
Show the unreduced map. The ID statement specifies the variable in the map data set that defines unit areas.
proc gmap map=maps.canada2 data=maps.canada2 all;
  id province;
  choro province / nolegend coutline=blue;
run;
The GREDUCE procedure creates a new map data set, CAN2, containing a DENSITY variable. The ID statement specifies the variable in the map data set that defines unit areas.
proc greduce data=maps.canada2 out=can2;
   id province;
run;
Define the title for the second map.
title2 "Using only DENSITY values 0 to 2";
Show reduced map with density levels 0-2. The DENSITY= option specifies the density levels that are used.
proc gmap map=can2
          data=can2 all density=2;
   id province;
   choro province / nolegend coutline=blue;
run;
quit;