Converts ZIP codes to mixed case state names
Category: State and ZIP Code
ZIPNAMEL ( zip-code )
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 zeroes. For example, if you enter 1040, ZIPNAMEL assumes that the value is 01040.
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.
The ZIPCITY, ZIPNAME , ZIPNAMEL, and ZIPSTATE functions take the same argument but return different values:
ZIPCITY returns the uppercase name of the city and the two-character postal code that corresponds to its five-digit ZIP code argument.
ZIPNAME returns the uppercase name of the state or U.S. territory that corresponds to its five-digit ZIP code argument.
ZIPNAMEL returns the mixed case name of the state or U.S. territory that corresponds to its five-digit ZIP code argument.
ZIPSTATE returns the uppercase two-character state postal code (or world-wide GSA geographic code for U.S. territories ) that corresponds to its five-digit ZIP code argument.
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 |
state5=zipnamel(24862); put state5; | West Virginia |
Functions:
'ZIPCITY Function' on page 919
'ZIPFIPS Function' on page 920
'ZIPNAME Function' on page 921
'ZIPSTATE Function' on page 924