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;
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.