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 (September 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 17 Sep 2010 12:53:59 -0400
Reply-To:   Nat Wooding <nathani@VERIZON.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nat Wooding <nathani@VERIZON.NET>
Subject:   Re: Using put statement with a numberic variable
In-Reply-To:   <SNT133-w63C7905403A17D8DEE87B6AB7B0@phx.gbl>
Content-Type:   text/plain; charset="US-ASCII"

Christine

Was your FIPS code calculated or was it an input variable? Rather than use Floor, Have you tried Round( Fips, 1 ) ?

Among the options with Proc Format are Round and Fuzz. Personally, I find the documentation a bit confusing since you have to hunt a lot to find out how to invoke options. I finally found a paper by Joseph Bilenas (http://www2.sas.com/proceedings/forum2008/174-2008.pdf ) that had some nice examples. Take a look at the following sample

Nat Wooding

Proc format ; value fips_RR (fuzz = .5 ) 1001 = '6' 1003 = '6' 1005 = '6' 1007 = '5' 1009 = '5' 27111 = '7' other='x'

; run;

Data Test; input fips; length region $1; region=put( fips , fips_RR. ); cards; 1001 1002 1003 1004 1005 1009.03 27111 ;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Christine Arriola Sent: Friday, September 17, 2010 12:13 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Using put statement with a numberic variable

Hello All,

I am trying to use a "put" & format statement to categorize FIPS county codes into regions. My FIPS code is a numeric variable. My code is below:

Proc format; value fips_RR 1001 = '6' 1003 = '6' 1005 = '6' 1007 = '5' 1009 = '5' other='x';

length region $1; region=put(fips,fips_RR.);

The problem is that some FIPS codes aren't getting categorized all the time. For example, for some obseravations FIPS code 27111 is categorized as Region=1. For other observations, it gets categorized into Region=X (other).

I thought it might be a precision thing, so I changed my code to: region=put(floor(fips),fips_RR.);

That didn't work and more FIPS codes fell into the other category.

Any suggestions on how to fix my put statement?

Many thanks, Christine

By the way, if I use the format in a proc print-

proc print; format fips fips_RR.;

the format works properly.


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