Hi Members,
Please help me to understand the SAS documentation that says:
======================================================================
SAS comment statements of the form
*commentary;
or
comment commentary;
are complete SAS statements. Consequently, they are processed by the tokenizer and macro facility and cannot contain semicolons or unmatched quotation marks.
=======================================================================
My understand from the above documentation is that comments in this form are complete statements, and they can’t contain semicolons or unmatched quotation marks. And I am confused about the unmatched quotation marks because when I write the below program, SAS run it with no problem.
=======================================================================
proc print data=sashelp.cars;
*comme'''ntary;
run;
@marcuswong wrote:
======================================================================
SAS comment statements of the form
*commentary;
or
comment commentary;
are complete SAS statements. Consequently, they are processed by the tokenizer and macro facility and cannot contain semicolons or unmatched quotation marks.
=======================================================================
Interesting. I don't see the text you quote in the SAS documentation at https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=lestmtsglobal&docsetTarge...
Where is it from?
This is very interesting. This would have caused problems in the past. I wonder if SAS finally fixed that flaw in their system.
@marcuswong wrote:
Hi Members,
Please help me to understand the SAS documentation that says:
======================================================================
SAS comment statements of the form
*commentary;
or
comment commentary;
are complete SAS statements. Consequently, they are processed by the tokenizer and macro facility and cannot contain semicolons or unmatched quotation marks.
=======================================================================
My understand from the above documentation is that comments in this form are complete statements, and they can’t contain semicolons or unmatched quotation marks. And I am confused about the unmatched quotation marks because when I write the below program, SAS run it with no problem.
=======================================================================
proc print data=sashelp.cars;
*comme'''ntary;
run;
The code you show is not involving the Macro facility.
Try this where the comment appears inside a macro:
%macro dummy; proc print data=sashelp.cars; *comme'''ntary; run; %mend; options mprint; %dummy;
If you are using macros basically you should either use the /* */ style of commenting or %*<text> ; to prevent the macro system from trying to interpret the comment.
@PaigeMiller @ballardw @CurtisMackWSIPP Thank you for the guidance.
Now I understand the clause is applying to comment within a macro.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.