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.  

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 710 views
  • 1 like
  • 4 in conversation