Posts

Showing posts with the label %eval and %sysevalf macro functions

%EVAL AND %SYSEVALF MACRO FUNCTIONS: GETTING TO KNOW THEM BETTER.

With the exception of %sysevalf function, integer arithmetic is the only way macro statements perform arithmetic calculations. Following are the few examples of macro statements performing integer arithmetic calculations: %let one= %eval (3+5); %let two= %eval (5*2); %let three= %eval (9/3); %let four= %eval (5/2); %put The value of one is &one; %put The value of two is &two; %put The value of three is &three; %put The value of four is & four; Open the Log file and see the results as follows: The value of one is 8 The value of two is 10 The value of three is 3 The value of four is 2 The value for macro variable four, should be 2.5, instead it shows only two. That happens because if we perform division on integers, integer arithmetic doesn’t take the fractional part into account. When we try to execute the integer arithmetic calculations of values with functional part, : %let last= %eval (5.0+3.0); /*INCORRECT*/ %EVAL function only supports integer arithmeti...