Hello,

Please help, new in SAS Macros.

Trying to do something like this, please correct me.

OPtions Symbolgen Mprint Mlogic;
proc sql;
select MAX(MO_END) format 10. into: MCDMAX /* eg- Date to Num format- 31Aug2019-21792*/
from MHH_view;quit;

proc sql;
select MAX(MO_END) format 10. into: IDPMAX /* eg- Date to Num format-30Sep2019-21822*/
from IDPHH_view;quit;
%put IDPMAX=&IDPMAX.;
%put MCDMAX=&MCDMAX.;
/* Check if XZY is updated with latest month data then pick the latest month data and append to ABC */
%If (&mcdmx.=&idpmx.) %THEN %Do;
proc append
base=ABC
data=XYZ
run;
%End;

I am getting error - ERROR: The %IF statement is not valid in open code.