Say I want to define a macro variable "num" to be 10 to the negative 2 power (0.01). I do:
%let num=%eval(10**(-2));
%put &num.;
but I get
%put &num.;
SYMBOLGEN: Macro variable NUM resolves to 0
0
What's wrong here? Thanks.
To work with floating point numbers use %SYSEVALF().
The %EVAL function evaluates expressions using integer arithmetic. The %SYSEVALF function evaluates expressions using floating point arithmetic.
%let num=%sysevalf(10**(-2));
%put &num.;
To work with floating point numbers use %SYSEVALF().
The %EVAL function evaluates expressions using integer arithmetic. The %SYSEVALF function evaluates expressions using floating point arithmetic.
%let num=%sysevalf(10**(-2));
%put &num.;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.