Search notes:

SAS: recovering an interactive session

The following code snippet was found in Lessons Learned: Valuable (But Hidden) SAS Details (by Dante diTommaso and Benjamin Szilagyi).
It is supposed to recover from apparently unrecoverable errors such as unbalanced quotes, bad macro definitions etc.
Instead of terminating the SAS session and start from scratch, the snippet should be executed until it prints ERROR: Procedure SAVE_ME not found.
Then, the session is recovered.
*))%*))'"*/; %mend; proc save_me; run;
Github repository about-SAS, path: /programming/recover-interactive-session.sas
This piece of code closes any unmatched quote, open parenthesis, open comments and fragments of started macro definitions.
I once recoverd a session with this snippet by executing it 10 times! So, don't give up when using it.
It looks like this snippet does not work in Enterprise Guide because of its sandwich statements.

See also

SAS Programming Language

Index