# Using the GREDUCE Procedure

## Specifying Density Levels

GREDUCE uses default criteria for determining the appropriate DENSITY variable value for each observation in the input map data set. If you do not want to use the default criteria, use PROC GREDUCE options to select the following:
• the maximum number of observations for each DENSITY level
• the minimum distance that an intermediate point must lie from a line between two end points to be included in the level
If you do not explicitly specify criteria, the procedure computes and uses default values.
GREDUCE creates seven density levels, numbered 0 through 6. Specify criteria for density levels 1 through 5. You cannot define criteria for level 0, which is reserved for map vertex points, such as common corners of unit areas. You also cannot define criteria for level 6, which is assigned to those points that do not meet the criteria for any lower level.
Specify the maximum number of observations per density level using Nn= in the PROC GREDUCE statement, and specify the minimum point distance using En= . You must have knowledge of the X and Y variable values in the particular input map data set to determine appropriate values for En=. See the for details.
illustrates how to use the minimum distance parameter to determine which points belong in a particular density level. At density level n, only point C lies at a distance greater than the En= value (70) from a line between points A and B. Thus, after reduction only point C remains between points A and B at density level n, and the resulting reduced boundary is shown in See Douglas and Peucker (1973) for details of the algorithm used.
GREDUCE uses the usual Euclidean distance formula to determine the distance between points. For example, the distance d between the points (x0,y0) and (x1,y1) is GREDUCE uses the usual Euclidean distance formula to determine the distance between points. For example, the distance d between the points (x0,y0) and (x1,y1) is
If this distance function is not suitable for the coordinate system in your input map data set, transform the X and Y values to an appropriate coordinate system before using GREDUCE. An example of inappropriate coordinates is latitude and longitude values around one of the poles. In this case, the data values should be projected before they are reduced. See for more information about map projection.
If you specify both Nn= and En= values for a density level, GREDUCE attempts to satisfy both criteria. However, the number of points for any level is never reduced below the number of points in density level 0. If you specify a combination of Nn= or En= values such that the resulting DENSITY values are not in order of increasing density, a note is printed in the SAS log, and the DENSITY values are calculated in increasing order of density.

## Subsetting a Map Data Set

A map data set that is processed by GREDUCE does not automatically result in a map that uses fewer points. By default, the GMAP procedure produces a map that uses all of the points in the map data set, even if the data set has been processed by the GREDUCE procedure. To decrease the number of points that produce the map, you must create a subset of the original data set using a DATA step or the WHERE= data set option. For example, to create a subset of a map that uses only the DENSITY values 0, 1, and 2, use this DATA step:
data smallmap;
set map;
if density <= 2;
run;
Alternatively, you can use WHERE= in the PROC GMAP statement:
proc gmap map=map(where=(density<=2))
data=response;
Note: GREDUCE does not reduce the size of the output map data set compared to the input map data set. By default, the output map data set from PROC GREDUCE will be larger than the input map data set because it contains all of the variables and observations from the original data set, with the addition of the DENSITY variable if it was not present in the original data set. If the input map data set already had a DENSITY variable, the output map data set will be the same size as the input map data set.