Below code submitted in EG 6.1 but I suspect it's applicable in DMS, Studio, etc.
Below are test scenarios based on a comment in my actual code (the 2nd comment is just to generate 262 characters)
* Workaround SAS's inability to include the datalines statement inside a macro ;
/*
This is a really long comment to generate 262 characters after the single quotation mark.
I sure wish the macro compiler could treat a single quote within a comment as just that,
a comment, instead of treating the single quote as a special character.
It works with slash-asterisk style commenting but not other commenting styles.
*/
data foo;x=1;run;
Submit this...so far, so good.
%* Workaround SAS's inability to include the datalines statement inside a macro ;
/*
This is a really long comment to generate 262 characters after the single quotation mark.
I sure wish the macro compiler could treat a single quote within a comment as just that,
a comment, instead of treating the single quote as a special character.
It works with slash-asterisk style commenting but not other commenting styles.
*/
data foo;x=1;run;
Submit this...oops.
But at least submitting ;*';*";*/;quit;run; fixes the issue.
But now I want to comment out the entire code block. So I use the "trick" of wrapping the code in an uncalled comment block:
%macro comment; * Workaround SAS's inability to include the datalines statement inside a macro ;
/*
%mend comment;
This is a really long comment to generate 262 characters after the single quotation mark.
I sure wish the macro compiler could treat a single quote within a comment as just that,
a comment, instead of treating the single quote as a special character.
It works with slash-asterisk style commenting but not other commenting styles.
*/
data foo;x=1;run;
Submit this...oops again.
At this point, submitting ;*';*";*/;quit;run; doesn't work, nor does %mend;;*';*";*/;quit;run;
At this point all I know to do is restart the workspace server.
However, submit this:
%macro comment;
/* Workaround SAS's inability to include the datalines statement inside a macro */
/*
This is a really long comment to generate 262 characters after the single quotation mark.
I sure wish the macro compiler could treat a single quote within a comment as just that,
a comment, instead of treating the single quote as a special character.
It works with slash-asterisk style commenting but not other commenting styles.
*/
data foo;x=1;run;
%mend comment;
That works.
So, whatever the macro and/or SAS compiler is doing in this last example, do this for the previous examples as well.
If a statement is a comment, then the contents of the comment shouldn't "break SAS".
I suspect that this could be harder than it appears, and would require a lot of testing for backwards compatibility.
But this issue bites me occasionally, when I forget and use a single quote in a comment, and in this case I lost a couple hours worth of WORK datasets when I had to restart the workspace server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.