Chapter Contents |
Previous |
Next |
The GMAP Procedure |
The GMAP procedure requires a map data set and a response data set. These two data sets must contain the required variables or the procedure stops with an error message. You can use the same data set as both the map data set and the response data set, as long as the requirements are met. If a different data set is used as the response data set, it must contain an ID variable that is identical to the ID variable in the map data set.
About Map Data Sets |
The X and Y variable values in the map data set do not have to be in any specific units because they are rescaled by the GMAP procedure based on the minimum and maximum values in the data set. The minimum X and Y values are in the lower-left corner of the map, and the maximum X and Y values are in the upper-right corner.
Map data sets in which the X and Y variables contain longitude and latitude should be projected before you use them with PROC GMAP. See The GPROJECT Procedure for details.
Optionally, the map data set also can contain a variable named SEGMENT to identify map areas that comprise noncontiguous polygons. Each unique value of the SEGMENT variable within a single map area defines a distinct polygon. If the SEGMENT variable is not present, each map area is drawn as a separate closed polygon that indicates a single segment.
The observations for each segment of a map area in the map data set must occur in the order in which the points are to be joined. The GMAP procedure forms map area outlines by connecting the boundary points of each segment in the order in which they appear in the data set, eventually joining the last point to the first point to complete the polygon.
Any variables in the map data set other than the ones mentioned above are ignored for the purpose of determining map boundaries.
About SAS/GRAPH Map Data Sets |
In addition to the variables described in About Map Data Sets, the SAS/GRAPH map data sets may also contain the following variables:
The GMAP procedure uses the values of the X and Y variables to draw the map. Therefore, if you want to produce an unprojected map by using the values in LONG and LAT, you would have to rename LONG and LAT to X and Y first.
SAS/GRAPH includes
a number of predefined map data sets. These data sets are described in SAS/GRAPH Map Data Sets.
Most Institute-supplied map data sets
contain four coordinate variables (X, Y, LONG, and LAT). In this case, X
and Y are always projected values that will be used by the GRAPH procedures
(by default). If you need to use the unprojected values that are contained
in the LONG and LAT variables, you will need to rename the LONG and LAT variables
to X and Y since the GMAP procedure automatically uses X and Y. See Input Map Data Sets that Contain Both Projected and Unprojected Values
for more details.
The Institute-supplied map data sets that contain X and Y variables (and no LONG and LAT variables), are usually projected maps. However, there are a few map data sets for the US and Canada that contain X and Y values that are unprojected longitude and latitude. In this case, you will need to use the GPROJECT procedure to project the map (see The GPROJECT Procedure).
Note: You can determine
whether a SAS map data set is projected
or unprojected by looking at the description of each variable that is displayed
when you use the CONTENTS procedure or by browsing the MAPS.METAMAPS data
set.
There are several map data sets available with SAS/GRAPH that allow you to easily label maps:
See the MAPS.METAMAPS data set for details on each of the Institute-supplied map data sets.
About Response Data Sets |
A response data set is a SAS data set that contains
The response data set can contain other variables in addition to these required variables.
The values of the map area identification variables in the response data set determine the map areas to be included on the map unless you use the ALL option in the PROC GMAP statement. That is, unless you use ALL in the PROC GMAP statement, only the map areas with response values are shown on the map. As a result, you do not need to subset your map data set if you are mapping only a small section of the map. However, if you map the same small section frequently, create a subset of the map data set for efficiency.
For choropleth, block, and prism maps, the response
variables can be either character or numeric. For surface maps, the response
variables must be numeric with only positive values.
Numeric response variables are always treated as continuous
variables unless the DISCRETE option is used in the action statement.
The exception to this is that the MIDPOINTS= option
chooses specific response level values. Any response variable values that
do not match one of the specified response level values are ignored. For
example, if the response variable contains the names of ten regions and you
specify these midpoints, only the observations for
Midwest
,
Northeast
, and
Northwest
are included on the map:
midpoints='Midwest' 'Northeast' 'Northwest'
These options are exceptions to this:
If the response variable values are continuous, the GMAP procedure assigns response level intervals automatically unless you specify otherwise. The response levels represent a range of values rather than a single value.
The BLOCK, CHORO, and PRISM statements assign patterns to response levels. In CHORO and PRISM maps, response levels are shown as map areas. However, in BLOCK maps, response levels are shown as blocks. The default fill pattern for the response level is solid.
PATTERN statements can define the fill patterns and colors for both blocks and map areas. PATTERN definitions that define valid block patterns are applied to the blocks (response levels), and PATTERN definitions that define valid map patterns are applied to map areas.
See PATTERN Statement for more information on fill pattern values and default pattern rotation.
About Identification Variables |
Displaying Map Areas and Response Data |
Whether the GMAP procedure draws a map area and whether it displays patterns for response values depends on the contents of the response data set and on the ALL and MISSING options. Displaying Map Areas and Response Data describes the conditions under which the procedure does or does not display map areas and response data.
If the response data set... | And if... | Then the procedure... |
includes the map area | the map area has a response value | draws the map area and displays the response data |
includes the map area | the map area has no response value (that is, the value is missing) | draws the map area but leaves it empty |
includes the map area | the map area has no response value and the MISSING option is used in the map statement | draws the map area and displays a response level for the missing value |
does not include the map area | the ALL option is used in the PROC GMAP statement | draws the map area but leaves it empty |
does not include the map area | the ALL option is not used | does not draw the map area |
Summary of Use |
To use the GMAP procedure, you must do the following:
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.