Search code examples
sassas-macro

SAS macro variable change


In general how do we deal with the situation where macro variables need to be modified inside a macro; for example, suppose I have this macro:

%macro test (arg=); 
array arrayone [&arg];   /* This is ok */
array arraytwo [&arg+1] /* This is not ok. How to make it work? */ 
... 

How do we manage these situation when I want %test(3) and then the arraytwo needs to take dimension 4... ?


Solution

  • Change it to

    array arraytwo[%EVAL(&ARG + 1)] ;