SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3

ZIPNAME Function

Converts ZIP codes to uppercase state names

Category: State and ZIP Code

Syntax

ZIPNAME ( zip-code )

Arguments

zip-code

Details

If the ZIPNAME 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.

ZIPNAME returns the name of the state or U.S. territory that corresponds to its five-digit ZIP code argument. ZIPNAME returns character values up to 20 characters long, all in uppercase.

Comparisons

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

Examples

The following SAS statements produce these results.

SAS Statements

Results

state1=zipname('27511'); put state1;

NORTH CAROLINA

state2=zipname('01040'); put state2;

MASSACHUSETTS

state3=zipname(1040); put state3;

MASSACHUSETTS

state4=zipname('59017'); put state4;

MONTANA

state5=zipname(24862); put state5;

WEST VIRGINIA

See Also

Functions:

Категории