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

STNAME Function

Converts state postal codes to uppercase state names

Category: State and ZIP Code

Syntax

STNAME ( postal-code )

Arguments

postal-code

Details

The STNAME function converts a two-character state postal code (or world-wide GSA geographic code for U.S. territories ) to the corresponding state name in uppercase.

Note: For Version 6, the maximum length of the value that is returned is 200 characters. For Version 7 and beyond, the maximum length is 20 characters.

Comparisons

The STFIPS, STNAME, and STNAMEL functions take the same argument but return different values. STFIPS returns a numeric U.S. Federal Information Processing Standards (FIPS) code. STNAME returns an uppercase state name. STNAMEL returns a mixed case state name.

Examples

SAS Statements

Results

fips=stfips ('NC'); put fips;

37

state=stname('NC'); put state;

NORTH CAROLINA

state=stnamel('NC'); put state;

North Carolina

See Also

Functions:

Категории