Previous Page | Next Page

Functions and CALL Routines

ZIPNAMEL Function



Converts zip codes to mixed case state names.
Category: State and Zip Code

Syntax
Arguments
Details
The Basics
How the Zip Code Is Translated to the State Postal Code
Comparisons
Examples
See Also

Syntax

ZIPNAMEL(zip-code)


Arguments

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, ZIPNAMEL assumes that the value is 01040.

Details


The Basics

If the ZIPNAMEL function returns a value to a variable that has not yet been assigned a length, by default the variable is assigned a length of 20.

ZIPNAMEL returns the name of the state or U.S. territory that corresponds to its five-digit zip code argument. ZIPNAMEL returns mixed-case character values up to 20 characters long.


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.


Comparisons

The ZIPCITY, ZIPNAME, ZIPNAMEL, and ZIPSTATE functions accept the same argument but return different values:


Examples

The following SAS statements produce these results.

SAS Statements Results
state1=zipnamel('27511');
put state1;
 
North Carolina
state2=zipnamel('01040');
put state2;
 
Massachusetts
state3=zipnamel(1040);
put state3;
 
Massachusetts
state4=zipnamel(59017);
put state4;
 
Montana
length zip $10.;
zip='90049-1392';
zip=substr(zip,1,5);
state5=zipnamel(zip);
put state5;
 



California


See Also

Functions:

ZIPCITY Function

ZIPFIPS Function

ZIPNAME Function

ZIPSTATE Function

Previous Page | Next Page | Top of Page