Reputation: 401
I'd like to create a new macro variable from other macro variables that already exist.
I have tried multiple variations of call symput
, %eval
, and input
to no avail...
I would like d
to evaluate to 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's documented somewhere... ;
***** This evaluates to 0...
%let d = %eval(%eval(&a) / %eval(&b)) ;
%put &d ;
Thanks so much...
Upvotes: 4
Views: 5257
Reputation: 7602
%eval will only return an integer. To get the decimal, you need to use %sysevalf.
Upvotes: 5