ZIPFIPS Function

Converts ZIP codes to two-digit FIPS codes.

Category: State and ZIP Code

Syntax

ZIPFIPS(zip-code)

Required Argument

zip-code

specifies a numeric or character expression that contains a five-digit ZIP code.

Tip If the value of zip-code begins with leading zeros, you can enter the value without the leading zeros. For example, if you enter 1040, ZIPFIPS assumes that the value is 01040.

Details

The Basics

The ZIPFIPS function returns the two-digit numeric U.S. Federal Information Processing Standards (FIPS) code that corresponds to its five-digit ZIP code argument.

How the Zip Code Is Translated to the State Postal Code

To determine which state corresponds to a particular ZIP code, this function uses a zone table that consists of the start and end ZIP code values for each state. It then finds the corresponding state for that range of ZIP codes. The zone table consists of start and end ZIP code values for each state to allow for exceptions, and does not validate ZIP code values.
With very few exceptions, a zone does not span multiple states. The exceptions are included in the zone table. It is possible for new zones or new exceptions to be added by the U.S. Postal Service at any time. However, SAS software is updated only with each new release of the product.

Example

The following SAS statements produce these results.
SAS Statement
Result
fips1=zipfips('27511');
put fips1;
 
37
fips2=zipfips('01040');
put fips2;
 
25
fips3=zipfips(1040);
put fips3;
 
25
fips4=zipfips(59017);
put fips4;
 
30
fips5=zipfips(24862);
put fips5;
 
54