How to create a new macro variable from existing macro variables using calculations in SAS?

I would like to create a new macro variable from other macro variables that already exist.

I tried several options for call symput , %eval and input no avail ...

I would like d evaluate the value 3/30 = .10.


 ***** taken directly from the sas help files... ; %let a=1+2; %let b=10*3; %let c=5/3; %let eval_a=%eval(&a); %let eval_b=%eval(&b); %let eval_c=%eval(&c); %put &a is &eval_a; %put &b is &eval_b; %put &c is &eval_c; * not sure why this evaluates to 1, but I'm sure it documented somewhere... ; ***** This evaluates to 0... %let d = %eval(%eval(&a) / %eval(&b)) ; %put &d ; 

Thank you very much...

+4
source share
1 answer

% eval returns only an integer. To get the decimal value, you need to use% sysevalf.

+4
source

All Articles