SAS Macros - Part 4 - A finishing touch to Macro

We have already covered most about Macros our previous articles.  This article has been written in order to give it a finishing touch.

Just to summarize, we are covering useful options %EVAL, %SYSFUNC, Concatenation of macro variables, Call Execute and  %Include and much more.

So are you ready for savoring this platter ?

Link to the previous articles of the series:

SAS Macros - Part 1 - Global Macro Variables

SAS Macros - Part 2 - Macro and Local Macro Variables

Let's delve on the topics one by one.

1. %Eval

While we assign any macro, the value are stored as character, even the numeric values are stored as character. So when we do an arithmetic operations while assigning a macro variable, calculations don't take place, unless you force SAS to do so. %EVAL is that force.


There are several useful Base SAS function that are not directly applicable in Macro, %Sysfunc helps enable those function to make our life easy.

Example 1:

%Let a= 400;
%Let b= 500 ;

What do you expect below line would resolve into :

 %let c = max(&a, &b); 
 %put &c ;

Answer :    max(400, 500)

What about this :

 %let c = %sysfunc(max(&a, &b)); 

 %put &c ;

Answer :    500

List of functions available with the usage of %Sysfunc :

Next ... Concatenation of Macro Variables >>>

Enjoy reading our other articles and stay tuned with ...

Kindly do provide your feedback in the 'Comments' Section and share as much as possible.