Previous Page | Next Page

The GMAP Procedure

Using FIPS Codes and Province Codes

The map area identification variable in some SAS/GRAPH map data sets contain standardized numeric codes. The data sets for the United States contain a variable whose values are FIPS (Federal Information Processing Standards) codes. The data sets for Canada contain standard province codes or census division codes. When you use the GMAP procedure with a traditional map data set, the variables that identify map areas in your response data set must have the same values as the map area identification variables in the traditional map data set.

If both a feature table and a response data set contain FIPS Codes or Province Codes, then once both data sets have been sorted, an SQL or DATA step MERGE can be used to merge the two data sets using the variable containing the codes. However, with the merged response and feature table, the identification variable used in the GMAP procedure must be the $GEOREF formatted variable that contains the spatial information. See $GEOREF format for more information.

If the map area identification variables in your response data set are state or province names or abbreviations, convert them to FIPS codes or province codes before using the response data set with one of the map data sets supplied by SAS. U.S. FIPS Codes lists the FIPS codes for the United States and Canadian Province Codes lists the standard codes for Canadian provinces.

Note:   Alternatively, you can convert the FIPS code or province codes in your map data set to match the names in your response data.  [cautionend]

U.S. FIPS Codes
FIPS Code State FIPS Code State
01 Alabama 30 Montana
02 Alaska 31 Nebraska
04 Arizona 32 Nevada
05 Arkansas 33 New Hampshire
06 California 34 New Jersey
08 Colorado 35 New Mexico
09 Connecticut 36 New York
10 Delaware 37 North Carolina
11 District of Columbia 38 North Dakota
12 Florida 39 Ohio
13 Georgia 40 Oklahoma
15 Hawaii 41 Oregon
16 Idaho 42 Pennsylvania
17 Illinois 44 Rhode Island
18 Indiana 45 South Carolina
19 Iowa 46 South Dakota
20 Kansas 47 Tennessee
21 Kentucky 48 Texas
22 Louisiana 49 Utah
23 Maine 50 Vermont
24 Maryland 51 Virginia
25 Massachusetts 53 Washington
26 Michigan 54 West Virginia
27 Minnesota 55 Wisconsin
28 Mississippi 56 Wyoming
29 Missouri 72 Puerto Rico

Canadian Province Codes
Province Code Province
10 Newfoundland
11 Prince Edward Island
12 Nova Scotia
13 New Brunswick
24 Quebec
35 Ontario
46 Manitoba
47 Saskatchewan
48 Alberta
59 British Columbia
60 Yukon
61 Northwest Territories

Note:   The ID variables in Canadian maps are character.  [cautionend]

The MAPS.CNTYNAME data set contains a cross-reference of names and FIPS codes for all counties in the United States. The MAPS.CANCENS data set contains a cross-reference of census district names and codes for Canadian provinces.

Base SAS software provides several functions that convert state names to FIPS codes and vice versa. The following table lists these functions and a brief description of each. See SAS Language Reference: Dictionary for more information.

FIPS and Postal Code Functions
Function Description
STFIPS converts state postal code to FIPS state code
STNAME converts state postal code to state name in upper case
STNAMEL converts state postal code to state name in mixed case
FIPNAME converts FIPS code to state name in upper case
FIPNAMEL converts FIPS code to state name in mixed case
FIPSTATE converts FIPS code to state postal code

Previous Page | Next Page | Top of Page