SAS Function-- Convert state name to two character USPS state code

Reply
Contributor
Posts: 60

SAS Function-- Convert state name to two character USPS state code

Hi,

Is there any SAS function which converts state name to two character US postal code?

For example, North Carolina should give 37

i do not have abbreviated state name to use stfips function.

Thanks,

SK

Super User
Posts: 10,500

Re: SAS Function-- Convert state name to two character USPS state code

37 is FIPS not POSTAL Code. Postal would be NC.

The dataset SASHELP.Zipcode has full name 2 letter postal code and 2 digit FIPS codes, so you could build a look up data set and either create an informat or use merge or SQL to join to your data.

proc sql;

     create table statecodes as

     select distinct statename, statecode, state

     from sashelp.zipcode;

quit;

Contributor
Posts: 60

Re: SAS Function-- Convert state name to two character USPS state code

Thank you very much for the clarification. It works.

very much appreciated.

Thanks,

Saravanan

Ask a Question
Discussion stats
  • 2 replies
  • 2662 views
  • 0 likes
  • 2 in conversation