GREMOVE Procedure

Example 2: Creating an Outline Map of Africa

Features:

PROC GREMOVE options DATA= and OUT=

Other features:

GMAP procedure

Sample library member: GRMAFRIC
This example processes the MAPS.AFRICA map data set, supplied with SAS/GRAPH, to produce a new map data set that contains no internal boundaries. This is done by adding a new variable, REGION, to the map data set and setting it equal to 1. Unit areas from the input map data set that have the same BY-variable value are combined into one unit area in the output map data set.
The MAPS.AFRICA Data Set shows some of the variables that are present in the original map data set:
The MAPS.AFRICA Data Set
                            MAPS.AFRICA Data Set
                 OBS     ID    SEGMENT       X          Y

                   1    125       1       0.57679    1.43730
                   2    125       1       0.57668    1.43467
                   3    125       1       0.58515    1.42363
                   .
                   .
                   .
                3462    990       1       1.04249    0.50398
                3463    990       1       1.04184    0.50713
                3464    990       1       1.04286    0.50841
Map Before Removing Borders (GRMAFRIC(a)) shows the map before processing:
Map Before Removing Borders (GRMAFRIC(a))
Map before Removing Borders (GRMAFRIC(a))
The new AFRICA map data set is created with a new variable, REGION. The AFRICA Data Set shows the variables that are present in the new map data set created by the GREMOVE procedure:
The AFRICA Data Set
                           AFRICA Data Set
               OBS       X          Y       SEGMENT    REGION

                 1    0.24826    1.02167       1          1
                 2    0.25707    1.02714       1          1
                 3    0.26553    1.03752       1          1
                 .
                 .
                 .
               982    1.19071    1.30043       3          1
               983    1.18675    1.30842       3          1
               984    1.18518    1.32822       3          1
Map After Removing Borders shows the new map after PROC GREMOVE has removed all of the interior boundaries:
Map After Removing Borders
Map after Removing Borders

Program

goptions reset=all border;
data newaf;
   set maps.africa;
   region=1;
run;
proc gremove data=newaf out=africa;
   by region;
   id id;
run;
title "Africa with Boundaries";
footnote j=r "GRMAFRIC(a) ";
pattern value=mempty color=blue;
proc gmap map=maps.africa data=maps.africa all;
   id id;
   choro id / nolegend levels=1;
run;
title "Africa without Boundaries";
footnote j=r "GRMAFRIC(b) ";
proc gmap data=africa map=africa;
   id region;
   choro region / nolegend levels=1;
run;
quit;

Program Description

Set the graphics environment.
goptions reset=all border;
Create the NEWAF data set. This new map data set contains all the variables in the MAPS.AFRICA map data set supplied with SAS/GRAPH plus the added variable REGION.
data newaf;
   set maps.africa;
   region=1;
run;
Remove the unit areas from the AFRICA data set. DATA= specifies the input map data set and OUT= specifies the output map data set. The input map data set has a variable called REGION that is used as the BY-variable to identify the new unit areas. The ID statement specifies the current unit areas from the input map data set.
proc gremove data=newaf out=africa;
   by region;
   id id;
run;
Define the title and footnote.
title "Africa with Boundaries";
footnote j=r "GRMAFRIC(a) ";
Define pattern characteristics.
pattern value=mempty color=blue;
Display the original map.
proc gmap map=maps.africa data=maps.africa all;
   id id;
   choro id / nolegend levels=1;
run;
Define a new title and footnote for the map.
title "Africa without Boundaries";
footnote j=r "GRMAFRIC(b) ";
Display the map with no boundaries. ID specifies the variable, REGION, that identifies the unit areas in the processed data set.
proc gmap data=africa map=africa;
   id region;
   choro region / nolegend levels=1;
run;
quit;