SYSFUNC and Missing Values
%SYSFUNC appears to incorrectly raise an ERROR condition when the called function returns a missing value.
data _null_; result = max(1,.); put 'max(1,.) is ' result; result = max(.,.); put 'max(.,.) is ' result; run;
max(1,.) is 1 max(.,.) is .
This is as expected. Now do the same thing without a DATA step, using %SYSFUNC:
%put max(1,.) is %sysfunc(max(1,.)); %put max(.,.) is %sysfunc(max(.,.));
The first statement passes a non-missing value to MAX, so the result is non-missing and the output is as above. In the second statement, both arguments are missing and MAX returns a missing value, causing %SYSFUNC to blow up:
ERROR: An error occurred while executing function MAX referenced by the %SYSFUNC or %QSYSFUNC macro function. NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set to a missing value. max(.,.) is .
This problem appears to be fixed in Version 9.2.