this is my code:
data a ;
y = month(date()) ;
CALL SYMPUT ('y', y)
;
run ;
OPTIONS MINOPERATOR ;
%MACRO TEST;
%IF &y. NOT IN (1,4,7,10)
%THEN %DO ;
PROC SQL ;
SELECT INPUT(Legacy_Bnk_Order_Ctrl_Id,4.) INTO: parameter_acc separated by ','
FROM WORK.parameter_acc_table
;
RUN ;
%END ;
%ELSE %DO ;
%LET parameter_acc = '0' ;
%PUT ¶meter_acc. ;
%END ;
%MEND TEST;
%TEST;
I am getting the following LOG info and ERROR:
SYMBOLGEN: Macro variable Y resolves to 9 ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &y. NOT IN (1,4,7,10) ERROR: The macro TEST will stop executing.
You cannot just insert the keyword NOT into the middle of an expression using the IN operator. Instead use it to negate the result of the IN operator.
%if NOT &y in (A,B) ...
Here is cleaned up code:
data a ;
y = month(date()) ;
CALL SYMPUTX('y', y);
run ;
%MACRO TEST / minoperator mindelimiter=',';
%IF not &y. IN (1,4,7,10) %THEN %DO ;
PROC SQL noprint;
SELECT INPUT(Legacy_Bnk_Order_Ctrl_Id,4.)
INTO :parameter_acc separated by ','
FROM WORK.parameter_acc_table
;
quit;
%END ;
%ELSE %DO ;
%LET parameter_acc = 0 ;
%END ;
%PUT ¶meter_acc. ;
%MEND TEST;
%let parameter_acc = BEFORE MACRO CALL;
%TEST;