ZIPSTATE Function


ZIPSTATE Function

Converts ZIP codes to two-character state postal codes

Category: State and ZIP Code

Syntax

ZIPSTATE ( 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 zeroes. For example, if you enter 1040, ZIPSTATE assumes that the value is 01040.

Details

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

ZIPSTATE returns the two-character state postal code (or world-wide GSA geographic code for U.S. territories ) that corresponds to its five-digit ZIP code argument. ZIPSTATE returns character values in uppercase.

Note: The first three digits of the ZIP code identifies a zone. ZIPSTATE evaluates the zone, and provides a state for that zone. It does not validate the ZIP code.

Comparisons

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.

Examples

The following SAS statements produce these results.

SAS Statements

Results

  state1=zipstate('27511');   put state1;  
  NC  
  state2=zipstate('01040');   put state2;  
  MA  
  state3=zipstate(1040);   put state3;  
  MA  
  state4=zipstate(59017);   put state4;  
  MT  
  state5=zipstate(24862);   put state5;  
  WV  

See Also

Functions:

  • 'ZIPFIPS Function' on page 920

  • 'ZIPNAME Function' on page 921

  • 'ZIPNAMEL Function' on page 923

  • 'ZIPCITY Function' on page 919




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net