整数演算を使用して、算術演算式や論理式を評価します。
| 種類: | マクロ評価関数 |
| 参照項目: | %SYSEVALF関数 |
%let d=%eval(10+20); /* Correct usage */ %let d=%eval(10.0+20.0); /* Incorrect usage */
%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;
1+2 is 3 10*3 is 30 5/3 is 1
%macro test(finish);
%let i=1;
%do %while (&i<&finish);
%put the value of i is &i;
%let i=%eval(&i+1);
%end;
%mend test;
%test(5)The value of i is 1 The value of i is 2 The value of i is 3 The value of i is 4
%macro compare(first,second); %if &first>&second %then %put &first > &second; %else %if &first=&second %then %put &first = &second; %else %put &first<&second; %mend compare; %compare(1,2) %compare(-1,0)
1 < 2 -1 < 0