SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
JamesD
Calcite | Level 5
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;

Does anyone know what it is? Thanks.
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
The one I use is:
*'; *"; stop; run; quit; %mend;

which is a variation of the string recommended on page 15 of this document:
http://support.sas.com/publishing/pubcat/chaps/61025.pdf

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."

cynthia
JamesD
Calcite | Level 5
Thanks! That's exactly what I was looking for, but better.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2 replies
  • 2207 views
  • 0 likes
  • 2 in conversation