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 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Sep 2009 11:30:50 -0700
Reply-To:     "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject:      Re: New Field in Table
In-Reply-To:  <f4bb431f-447c-41e1-b4c4-6323b436bbf3@m11g2000vbl.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"

Your solution does not assign the desired value to the new variable. It only affects how the new variable is printed. For example, if longitude is 11, id will be 11 but displayed as 1.

If the OP needs the new variable to have the desired value, then replacing your id = longitude; with id = put(longitude, myfmt.); should do it.

-----Original Message----- From: Amar Mundankar Sent: Thursday, September 17, 2009 12:06 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: New Field in Table

On Sep 17, 5:25 am, miimes1 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;


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