Date: Tue, 10 Feb 2009 16:41:24 -0600
Reply-To: Mary <mlhoward@avalon.net>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Re: Numeric to Numeric Conversion
Content-Type: text/plain; charset="iso-8859-1"
But you aren't doing a binary search here- you are simply comparing numeric values- a binary search would be when you are searching
an array or data set variable such as using SQL.
Did you see the thread last week:
Performance: IF vs. Informat vs. Format?
IF statements did not necessarily perform slower, in fact, they were faster in some cases.
-Mary
----- Original Message -----
From: Bucher Scott
To: Mary ; SAS-L@LISTSERV.UGA.EDU
Sent: Tuesday, February 10, 2009 4:33 PM
Subject: RE: Re: Numeric to Numeric Conversion
In my case this would results in hundreds of 'if-then' statements. Formatted lookups use a binary search, which would be much faster; and if I took the time to create a hash per Jack's suggestion, it would be still faster.
-Scott
From: Mary [mailto:mlhoward@avalon.net]
Sent: Tuesday, February 10, 2009 5:27 PM
To: Bucher Scott; SAS-L@LISTSERV.UGA.EDU
Subject: Re: Re: Numeric to Numeric Conversion
Scott,
I really don't understand why using a logic statement is out of the question here.
Why is it that this:
if x >= 0 and x <=211 then
x=40;
Is such a difficult solution? It does seem that if you have a lot of these, you could load
up a dataset and generate the IF statements with the lower and the upper value and the
recoded value as variables.
-Mary
----- Original Message -----
From: Bucher Scott
To: SAS-L@LISTSERV.UGA.EDU
Sent: Tuesday, February 10, 2009 2:47 PM
Subject: Re: Numeric to Numeric Conversion
Thanks all,
I tried the various suggestions but all seem to produce the same
problem. Changing the variable type to 'I' or using VVALUE() both
produce the notes. Others have suggested recoding the values using logic
(e.g. if 0 <= x <= 211 then x = 40;) or using the proc format statement
to hardcode the values, but the format contains hundreds of values,
which why I used a control data statement.
So at this point I agree with Howard: " In my opinion, there are some
missing tools. PROC FORMAT should be able to create NNFORMATs, and there
should be a NNPUT function. 'NN' means numeric-to-numeric." Where is the
SAS Software Ballot? ;)
-Scott