【发布时间】:2015-05-22 09:56:11
【问题描述】:
%macro test(k);
%if &k le 0 %then %put < 0 ;
%else %put > 0;
%mend test;
%test(-5);
%test(3.1);
但是%test(-3.1);会报错
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
&k le 0
我不知道为什么这种简单的值比较会导致错误。一开始我猜是因为.。但是输入 3.1 似乎一切顺利。
【问题讨论】:
-
%sysevalf(&k le 0)解决了这个问题。但是为什么-5不需要sysevalf? -
代码没问题。我看不出有任何理由让它不起作用。可能重启应用再试一次
-
同意NEOmen,代码没问题