## Define a numeric macro value with a power function

Solved
Frequent Contributor
Posts: 94

# Define a numeric macro value with a power function

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.

Accepted Solutions
Solution
‎09-07-2017 04:35 PM
Super User
Posts: 23,683

## Re: Define a numeric macro value with a power function

To work with floating point numbers use %SYSEVALF().

http://blogs.sas.com/content/sastraining/2011/09/23/sas-authors-tip-macro-functions-eval-and-syseval...

The %EVAL function evaluates expressions using integer arithmetic. The %SYSEVALF function evaluates expressions using floating point arithmetic.

``````%let num=%sysevalf(10**(-2));
%put &num.;``````

All Replies
Solution
‎09-07-2017 04:35 PM
Super User
Posts: 23,683

## Re: Define a numeric macro value with a power function

To work with floating point numbers use %SYSEVALF().

http://blogs.sas.com/content/sastraining/2011/09/23/sas-authors-tip-macro-functions-eval-and-syseval...

The %EVAL function evaluates expressions using integer arithmetic. The %SYSEVALF function evaluates expressions using floating point arithmetic.

``````%let num=%sysevalf(10**(-2));
%put &num.;``````

Frequent Contributor
Posts: 94

## Re: Define a numeric macro value with a power function

That works great. Thank you.
☑ This topic is solved.