| Date: | Fri, 17 Sep 2010 16:13:15 +0000 |
| Reply-To: | Christine Arriola <cmarriola@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Christine Arriola <cmarriola@HOTMAIL.COM> |
| Subject: | Using put statement with a numberic variable |
| Content-Type: | text/plain; charset="iso-8859-1" |
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.
|