Date: Wed, 23 Sep 2009 08:37:52 -0400
Reply-To: Kevin Xu <kevinsascontractor@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Xu <kevinsascontractor@GMAIL.COM>
Content-Type: text/plain; charset=ISO-8859-1
I have a question:
I have a numerical variable, and I would like to compare it with a certain
number of fixed numbers and choose the one closest
the number variable that can have numerical values, the fixed numbers are:
if the variable has value of 2, then I would like to change 2 to 3 because 3
is the closest number to 2.
if the variable has a value of 7, then I want to change 7 to 6 because 6 is
the closest number to 7.
if the variable has a value of 4.5, then either 3 or 6 can be the answer.
I think I can use if statement, but I am wondering if an array or another
easier method can do this?
Thanks for help!