Date: Fri, 25 Jan 2008 12:49:22 -0500
Reply-To: "Birken, John A. (CDC/CCHIS/NCHS)" <zbq5@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Birken, John A. (CDC/CCHIS/NCHS)" <zbq5@CDC.GOV>
Subject: Re: Best way to code states - Staste list in proc format
Content-Type: text/plain; charset=us-ascii
Melody:
This code should do the trick:
PROC FORMAT ;
VALUE $STATE
' 0' = 'United States...................'
' 1' = 'Alabama.................'
' 2' = 'Alaska.................'
' 3' = 'Arizona.................'
' 4' = 'Arkansas..............'
' 5' = 'California..............'
' 6' = 'Colorado..............'
' 7' = 'Connecticut..............'
' 8' = 'Delaware...............'
' 9' = 'Dist of Columbia..............'
'10' = 'Florida..............'
'11' = 'Georgia..............'
'12' = 'Hawaii..............'
'13' = 'Idaho..............'
'14' = 'Illinois..............'
'15' = 'Indiana..............'
'16' = 'Iowa..................'
'17' = 'Kansas..............'
'18' = 'Kentucky..............'
'19' = 'Louisiana..............'
'20' = 'Maine..................'
'21' = 'Maryland..............'
'22' = 'Massachusetts..............'
'23' = 'Michigan..............'
'24' = 'Minnesota..............'
'25' = 'Mississippi..............'
'26' = 'Missouri..............'
'27' = 'Montana..............'
'28' = 'Nebraska..............'
'29' = 'Nevada..............'
'30' = 'New Hampshire..............'
'31' = 'New Jersey..............'
'32' = 'New Mexico..............'
'33' = 'New York (excl.NYC).......'
'34' = 'New York City..............'
'35' = 'North Carolina..............'
'36' = 'North Dakota..............'
'37' = 'Ohio..................'
'38' = 'Oklahoma..............'
'39' = 'Oregon..............'
'40' = 'Pennsylvania..............'
'41' = 'Rhode Island..............'
'42' = 'South Carolina..............'
'43' = 'South Dakota..............'
'44' = 'Tennessee..............'
'45' = 'Texas..................'
'46' = 'Utah..............'
'47' = 'Vermont..............'
'48' = 'Virginia..............'
'49' = 'Washington..............'
'50' = 'West Virginia..............'
'51' = 'Wisconsin..............'
'52' = 'Wyoming..............' ;
RUN ;
HTH,
John jbirken@cdc.gov
/* STATE FORMATTED OUTPUT */
put
@1StateNum $ state.
.
.
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Melodyp
Sent: Friday, January 25, 2008 10:33 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Best way to code states
On Jan 24, 5:34 pm, nos...@HOWLES.COM ("Howard Schreier <hs AT dc-sug
DOT org>") wrote:
> On Thu, 24 Jan 2008 09:38:35 -0600, data _null_, <datan...@GMAIL.COM>
wrote:
> >On Jan 24, 2008 9:28 AM, Melodyp <pearsonmel...@gmail.com> wrote:
> >> What I want is, how can I code State from the current GA , FL,
> >> CA..etc to some numbers like 00 for GA, 01 for FL, 11 for CA,
etc...
>
> >stFips = stfips(state);
>
> >But I don't see why you need to do this. Codes are codes. The two
> >character postal code just a good as the FIPS.
>
> Actually, FIPS encompasses both numeric codes and 2-letter alphabetic
> abbreviations. The postal abbreviations and FIPS abbreviations are the
> same, at least for the 50 states and DC.
>
> http://www.itl.nist.gov/fipspubs/fip5-2.htm
>
>
>
> >Better, perhaps
> >because most folks know what they are.
>
> >> My problem is I have at least 45 states, is there any way, I can
> >> use some number like 0, or 1 to code? or there is a more efficient
way?
>
> >Are you asking how to code the states into dummy indicator variables?
>
> >> Thank you,
> >> Melody- Hide quoted text -
>
> - Show quoted text -
Thank you everybody for your invaluable response.
I really appricaite your help.
Have a good day.
Melody
|