The error is easy to see from the log:
29 call execute(cats('%nrstr(Run_code')); 30 Run; ERROR: Expected close parenthesis after macro function invocation not found.
You do not close the %NRSTR() function call.
But what is Run_code?? That is not a valid SAS command. And it does not have either % or & so it has nothing to do with the macro processor either. And it is not a variable in the data step, since there are no variables in that data step.
Don't you want to run the macro RRR?
%RRR(2410)
%RRR(2411)
%RRR(2412)
%RRR(2501)
So just do that.
data _null_;
start='01OCT2024'd;
end='01JAN2025'd;
do offset=0 to intck('month',start,end);
call execute(cats('%nrstr(%rrr)(',put(intnx('month',start,offset),yymmn4.),')'));
end;
run;
Example:
1 %macro rrr / parmbuff; 2 %put Running macro call &sysmacroname.&syspbuff.; 3 %mend rrr; 4 data _null_; 5 start='01OCT2024'd; 6 end='01JAN2025'd; 7 do offset=0 to intck('month',start,end); 8 call 8 ! execute(cats('%nrstr(%rrr)(',put(intnx('month',start,offset),yymmn4.),')' 8 ! )); 9 end; 10 run; NOTE: CALL EXECUTE generated line. 1 + %rrr(2410) Running macro call RRR(2410) 2 + %rrr(2411) Running macro call RRR(2411) 3 + %rrr(2412) Running macro call RRR(2412) 4 + %rrr(2501) Running macro call RRR(2501)
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.