Hi all,
I'm trying to compare two variables macro (price_trd vs max_price) however as the example below that's not happening....
Please someone could give me a little help ?
TK'S IN ADVANCED!
########## CODE BELOW #########
options mlogic mprint;
%let price_trd = 93.68;
%put &price_trd.;
%let max_price = 100.94;
%put &max_price.;
%macro test;
%if &price_trd. < &max_price %then %do;
%put Pass HERE;
%end;
%mend;
%test;
Need to use %SYSEVALF() to do floating point calculations, otherwise macro will attempt to use %EVAL() which only does integer math.
Need to use %SYSEVALF() to do floating point calculations, otherwise macro will attempt to use %EVAL() which only does integer math.
Wrap the comparison in %sysevalf
E.G.
%if %sysevalf(&price_trd. LT &max_price) %then %do;
As always in the fine print (floating point arithmetic vs integer for %eval).
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.