At one time I used to know a string of characters that you could submit that would match any unbalanced quotes and or comments in code that was submitted and needed the matching quote to stop running. It was something like */*'/*"/*/;run;
I keep submitting it over and over until I see this message in the log, because, as it says on page 15:
"Depending on how deep a hole you have dug for yourself, you might need to run this line several times. You’ll know you’re done when you see an error message that says “No matching %MACRO statement for this %MEND statement.” The line works on unbalanced quotes because anything between an asterisk and the next semicolon is treated as a comment by SAS, unless there is an open quote, in which case it is just part of the quote. For example, *”; will close a double quote if one is open, but will not start a new quote."