Is it possible in SAS to invoke a call to a macro using a macro variable whose value is the macro's name? Something like the following:
%MACRO TEST (macroName, var1, var2, var3, var4, var5);
%put LOG: %¯oName(&var1);
%MEND;
%TEST(testName,testVar1);
In response to Richard's answer. I tried following your solution, but am still getting an "apparent invocation of macro YearMonthString not resolved" using the following code:
%MACRO YearMonthString(nYear,nMonth);
/* Builds a string in the format YYYYMM using passed nYear and nMonth */
%local returnVal;
/*Build the string */
%let returnVal = &nYear.%AddLeadingZerosToMakeNumXLength(2,&nMonth);
/*Write to LOG */
%put MACRO LOG: YearMonthString(nYear= &nYear, nMonth= &nMonth) will return &returnVal;
/* return returnVal */
&returnVal
%MEND;
%MACRO TEST (macroName, var1, var2, var3, var4, var5);
%local loopCount;
%let loopCount = 1;
%do i=1 %to 13;
%¯oName.(&var1,&loopCount);
%let loopCount = %eval(&loopCount+1);
%end;
%MEND;
%TEST(YearMonthString,2018,8,,,);
Yes you can! The construct is
%
&
macro-symbol. Here is a demonstration: