BookmarkSubscribeRSS Feed
marcuswong
Fluorite | Level 6

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;

 

 

 

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

@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?

--
Paige Miller
CurtisMackWSIPP
Lapis Lazuli | Level 10

This is very interesting.  This would have caused problems in the past.  I wonder if SAS finally fixed that flaw in their system.

 

 

ballardw
Super User

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

 

marcuswong
Fluorite | Level 6

@PaigeMiller @ballardw @CurtisMackWSIPP Thank you for the guidance.

Now I understand the clause is applying to comment within a macro.  

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1067 views
  • 1 like
  • 4 in conversation