Hi All, Getting an issue when using macro variable in macro condition. This code works if the macro variable values are whole numbers but if the values contain decimal values then SAS does not process the conditions correctly. In the below example, prow1 value is greater than prow2 value but somehow SAS is doing %IF condition &prow2. > &prow1. is TRUE Can you please help to identify issue and provide a resolution? options mlogic mprint;
%macro chk;
/*The prow values are obtained by using PROC SQL SELECT INTO but below are displayed for example purpose*/
%let prow1 = 13.23529;
%let prow2 = 5.714286;
%put prow1, prow2 ==> &prow1. , &prow2.;
%if &prow1. > &prow2. %then %do;
data chk;
a = "&prow1. > &prow2.";
run;
proc print data=chk;
run;
%end;
%if &prow2. > &prow1. %then %do;
data chk2;
a = "&prow2. > &prow1.";
run;
proc print data=chk2;
run;
%end;
%mend chk;
%chk;
And here is the LOG for above code: MLOGIC(CHK): Beginning execution.
MLOGIC(CHK): %LET (variable name is PROW1)
MLOGIC(CHK): %LET (variable name is PROW2)
MLOGIC(CHK): %PUT prow1, prow2 ==> &prow1. , &prow2.
prow1, prow2 ==> 13.23529 , 5.714286
MLOGIC(CHK): %IF condition &prow1. > &prow2. is FALSE
MLOGIC(CHK): %IF condition &prow2. > &prow1. is TRUE
MPRINT(CHK): data chk2;
MPRINT(CHK): a = "5.714286 > 13.23529";
MPRINT(CHK): run;
NOTE: The data set WORK.CHK2 has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
MPRINT(CHK): proc print data=chk2;
MPRINT(CHK): run;
NOTE: There were 1 observations read from the data set WORK.CHK2.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds Thank you!
... View more