BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Santt0sh
Lapis Lazuli | Level 10

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!

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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;
Santt0sh
Lapis Lazuli | Level 10
Hi Tom,

Thank you for your quick response!
I will try to follow, what you have suggested.

Regards

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 502 views
  • 1 like
  • 2 in conversation