[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: FIPS Codes
From:       "Michael S. Zdeb" <msz03 () HEALTH ! STATE ! NY ! US>
Date:       2005-02-28 18:56:30
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic