Chapter 9: Arithmetic
The basics may bore you, but the details will delight you.
9.1 Basic Rules
The %LET statement automatically ignores arithmetic:
%let total = 3 * 5 ;
Here, &TOTAL is five characters long, and the third character is an asterisk. As usual, leading and trailing blanks are ignored. For the %LET statement to perform arithmetic, it must apply a function:
%let total = %eval(3 * 5); → 15
%let total = %sysevalf(3 * 5); → 15
The %EVAL function performs integer arithmetic, dropping any remainders:
%let total = %eval(10 / 4); → 2
%let total = %eval(2.5 * 4); → error, decimal points not allowed
%let total = %eval(10./4.); ...