09-29-2015 04:04 PM
I use SAS 9.2 at my workplace (and if this issue has been solved in newer versions, please let me know so that I can dream of the easy solution when my employer decides to upgrade) and I was wondering if anyone had a complete solution to this issue. The problem occurs when I *accidentally* submit multiple SAS statements with rsubmit statements but forget to include endrsubmit statements before submitting the next rsubmit. When this happens, I get this error:
ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id.
NOTE: Subsequent lines will be ignored until ENDRSUBMIT.
If I have submitted at most 3 consecutive rsubmit statements, I can do this:
and I will then see
ERROR: Remote submit to UNKNOWN canceled.
and again be able to use rsubmit in my SAS session. Any time I *accidentally* submit 4 or more consecutive rsubmit statements I have to kill the SAS remote connection and start over. Any subsequent rsubmit results in:
NOTE: Remote submit to REMOTEID commencing.
NOTE: Remote submit to REMOTEID complete.
without anything actually being executed. I realize that there are solutions to preventing me from making this mistake (i.e. http://analytics.ncsu.edu/sesug/2007/CC16.pdf), but I would like to know if there is an actual solution if this mistake is made.
09-29-2015 05:25 PM - edited 09-29-2015 11:24 PM
One way to avoid this problem is to not use RSUBMIT blocks in your code, but instead set up and use an RSUBMIT button in Display Manager - prevention is better than cure. This avoids having an unmatched RSUBMIT statement entirely. If you want to run locally, use the local SUBMIT button, to run remotely press the remote SUBMIT button.
Of course there may be times when you want mix local and remote submits in the same program but generally in that case you would just run the whole program locally and the RSUBMIT statements control the switching to remote running.
Regarding SAS recovering from more than 3 RSUBMITs - I would put this in the same category as submitting code with unmatched quotes, defining macros without %MEND statements etc...there is only so much SAS can do when users make "unclosed" mistakes. Killing your SAS session and starting over can often be the quickest way to recover.
09-30-2015 09:37 AM
This is not a way to recover the remote SAS session. This is a way to start over, which I am forced to do whenever this happens. The reason why I posted was to see if anyone knew of a way to solve the problem. There are ways to recover from many other mistakes (like forgotten commas or %mend in macros, http://v8doc.sas.com/sashtml/macro/z1302436.htm) no matter how deeply they go, so in fact there is often a *lot* that "SAS can do." I find it interesting that you can recover from 3 consecutive rsubmits but no more. I am hoping that someone out there knows of a clever trick to solve this occasional problem that happens from an accidental submission.