|
Hi again Max,
%eval does not know that non-integers are numbers. It thinks they are
character strings.
So when you ask for %eval(10.1+2), %eval things you are trying to add
two character strings and give you an error because it knows you can't
add character strings.
82 %put %eval(10.1+2);
ERROR: A character operand was found in the %EVAL function or %IF
condition where a numeric operand
is required. The condition was: 10.1+2
However, %eval is happy to *compare* two character strings:
70 %put %eval(b>a);
1
So when you ask %eval to compare 10.1 and 2, it sees 10.1 as a
character, and says "oh, Max wants me to compare the character string
10.1 to the character string 2, I can do that", which is why it
happily does the comparison, and returns a 0 because the character
string 10.1 is not greater than the character string 2.
73 %put %eval(10.1>2);
0
Kind Regards,
--Quentin
On Sun, Oct 2, 2011 at 8:44 PM, bbser 2009 <bbser2009@gmail.com> wrote:
> Hi there,
>
> Just a quick question.
> It was that non-integers should not occur in %eval().
> But why does the first one below result in an error message in the log while
> the second one not?
>
> %put %eval(10.1+2);
> %put %eval(10.1>2);
>
> Thank you for commenting.
>
> Regards, Max
> (Maaxx)
>
|