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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.