BookmarkSubscribeRSS Feed
Hari2
Quartz | Level 8

Hi All,

 

I have to run sas code between RSUBMIT AND ENDRSUBMIT. 

 

The below 3 lines of code I will submit, it will call another program which is again stored in server itself. so I need to put that in between rsubmit and endrsubmit again. However I am getting error when I submit this as,

 

"ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id. Please help me to overcome this.

 

NOte: This is just a sample code, I have different programs in which I need to include multiple programs where those programs have lengthy of code between multiple rsubmit and endrsubmit statements.

"

rsubmit;

%include '/users/Startupcode.sas';

endrsubmit;

 

Startupcode.sas:

 

rsubmit;
data pathchk;
infile '/users/configfile.txt' dlm='$$$$$$$$$';
input var1 :$150.;
run;

endrsubmit;

4 REPLIES 4
jklaverstijn
Rhodochrosite | Level 12

Hi @Hari2,

 

If you rsubmit an rsubmit statement than that second rsubmit gets executed on the remote server. And thus it will only work if that remote server is itself also connected to a SAS/Connect session via signon. The message you see indicates that is not the case.

 

I would need more detail on what needs to run where in order to help you figure out the proper way of doing things.

 

Kind regards,

- Jan.

Hari2
Quartz | Level 8

Hi Jan,

 

Thanks.

 

basically, I need to call a program from another program through #include method and both the programs should be submitted to server. And, all programs are saved in server location.

So here, when I submit Program 1, it is running fine. and to invoke 2nd program through #include method , since it is saved in server path , I need to put #include statement b/n rsub and endrsub. but the 2nd program, again has sas code between rsubmit and endrsubmit statemnts. So here the issue is coming.

 

Thanks,

Hari.

 

Kurt_Bremser
Super User

Code between rsubmit and endrsubmit needs a connection to another SAS/CONNECT session. If that is not there, it won't work, period. Either set up that required session on the server-side session before the %include, or delete the rsubmit/endrsubmit from the include.

jklaverstijn
Rhodochrosite | Level 12

Do I correctly rephrase your question as:

 

"I have code in an external .sas file and want that rsubmitted."

 

?

 

If so, there is no straightforward syntax to do that that I know of. (Would be nice if there was, though). Can't you add the rsubmit/endrsubmit pair to the file you %include? Otherwise, how about running a datastep that reads your SAS code into a temp file with rsubmit/endrsubmit added and then %include that temp file?

 

Untested:

 

filename runme temp;
filename source '...';
data _null_;
   infile source end=eof; 
   put runme;
   if _n_=1 then put ' rsubmit';
   input;
   put _infile_;
   if (eof) then put 'endrsubmit;';
run;
%include runme;

Hope this helps,

- Jan.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 4 replies
  • 1689 views
  • 0 likes
  • 3 in conversation