Hi All,
Could you please advise me, if Macros can be written within RSUBMIT and ENDRSUBMIT?
Rsubmit;
%MACRO SRTDT(BGNDTE=);
%do i = 1 %to 10;
%end;
%mend;
% SRTDT(BGNDTE=xxxxxxx);
ENDRSUBMIT;
Thank you!
You can, but be sure to test them. In the past I have had issues with the chunking used to send the blocks of code from the local to the remote machine causing issues for the parsing required to compile macros. In one case just inserting a couple of extra characters into a comment caused the macro to work again.
Instead compile the macro on the remote machine from a file on the remove machine.
rsubmit;
%include 'mymacro.sas' ;
%mymacro()
endrsubmit;
If the file only lives on the local machine you can use PROC UPLOAD to copy it to the remote machine first.
rsubmit;
filename mymacro temp;
proc upload infile='mymacro.sas' outfile=mymacro;
run;
%include mymacro;
%mymacro()
endrsubmit;
You can, but be sure to test them. In the past I have had issues with the chunking used to send the blocks of code from the local to the remote machine causing issues for the parsing required to compile macros. In one case just inserting a couple of extra characters into a comment caused the macro to work again.
Instead compile the macro on the remote machine from a file on the remove machine.
rsubmit;
%include 'mymacro.sas' ;
%mymacro()
endrsubmit;
If the file only lives on the local machine you can use PROC UPLOAD to copy it to the remote machine first.
rsubmit;
filename mymacro temp;
proc upload infile='mymacro.sas' outfile=mymacro;
run;
%include mymacro;
%mymacro()
endrsubmit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.