LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 28 Feb 2005 13:56:30 -0500
Reply-To:     "Michael S. Zdeb" <msz03@HEALTH.STATE.NY.US>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Michael S. Zdeb" <msz03@HEALTH.STATE.NY.US>
Subject:      Re: FIPS Codes
Content-type: text/plain; charset=US-ASCII

Hi. You can get the state numbers with a function, STFIPS. However, you have to convert the full state names to their two character postal abbreviations. I don't think that there's a county function (could not find one), but...

If you have licensed SAS/Graph, there is a SAS-supplied data set CNTYNAME. Among the variables in the data set are: STATE and COUNTY, both NUMERIC FIPS codes; COUNTYNM, uppercase county name; STATENAME, mixed case state name. I'd convert all the text to uppercase in data set CNTYNAME and your data set, use COMPRESS to get rid of any blank spaces in names with more than one part then just use MERGE or SQL to match the two files. I haven't looked at every entry in CNTYNAME to see if there are any abbreviations (or periods) in the names. You'd have to match by state and county since county names repeat accross states.

Suggestion...

data names; set maps.cntyname (keep=state county countynm statename); countynm = compress(countynm); statename = upcase(compress(statename)); run;

<do the same with your data>

<merge or SQL>

Or, if you do not have SAS/Graph, take a look at...

http://ftp.sas.com/samples/A57495

It's the SAS code from my mapping book (yes, shameless self promotion). There's a data step in the code with county names, state abbreviations (not names, sorry), state and county FIPS codes. You can convert the 2-character state abbreviations to uppercase state names using the STNAME function.

Mike Zdeb U@Albany School of Public Health 1 University Drive Rensselaer, NY 12144-3456 (P)518-402-6479 (F)630-604-1475


Back to: Top of message | Previous page | Main SAS-L page