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: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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