Date: Thu, 17 Sep 2009 00:06:24 -0700
Reply-To: Amar Mundankar <amarmundankar@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Amar Mundankar <amarmundankar@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: New Field in Table
Content-Type: text/plain; charset=ISO-8859-1
On Sep 17, 5:25 am, miimes1 <michelle.i...@gmail.com> wrote:
> Hi Everyone,
>
> I am trying to create a new field in my sas table, but I want the new
> field to be based on attributes of another field. I want it based on
> if then statements. For example, I want to create a new column called
> COLUMN. I want to apply 65 different unique IDs, based on a longitude
> range.
>
> if longitude is between -81.5187 and -81.4987 then give COLUMN a 75;
>
> Any suggestions?
>
> Thanks,
> Michelle
Hi,
You can create a user defined format and as per the longitude range.
Apply that format to Id variable.
I hope this can help you.
data have;
input longitude;
cards;
10
25
32
49
50
;
proc format ;
value myfmt
10-20 = '1'
21-30 = '2'
31-40 = '3'
41-50 = '4'
;
run;
data want ;
set have;
id = longitude;
format id myfmt.;
run;
proc print data = want;
run;
Thanks and Regards,
Amar Mundankar.
|