%* Macro Comment Statement

Designates comment text.
Type: Macro statement
Restriction: Allowed in macro definitions or open code

Syntax

%*commentary;

Required Argument

commentary
is a descriptive message of any length.

Details

The macro comment statement is useful for describing macro code. Text from a macro comment statement is not constant text and is not stored in a compiled macro. Because a semicolon ends the comment statement, the comment cannot contain internal semicolons unless the internal semicolons are enclosed in quotation marks. Macro comment statements are not recognized when they are enclosed in quotation marks.
Macro comment statements are complete macro statements and are processed by the macro facility. Quotation marks within a macro comment must match.
Only macro comment statements and SAS comments of the form /*commentary*/ in macro definitions or open code might be used to hide macro statements from processing by the macro facility.

Comparisons

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. SAS comment statements of the form
*commentary;
or
comment commentary;
are stored as constant text in a compiled macro. These two types will execute any macro statements within a comment. SAS recommends not to use these within a macro definition.
SAS comments in the form
/*commentary*/
are not tokenized, but are processed as a string of characters. These comments can appear anywhere a single blank can appear and can contain semicolons or unmatched quotation marks. SAS comments in the form
/*commentary*/
are not stored in a compiled macro.

Example: Contrasting Comment Types

This code defines and invokes the macro VERDATA, which checks for data errors. It contains a macro comment statement and SAS comments in the form /*commentary*/ and *commentary;
%macro verdata(in, thresh);
    *%let thresh = 5;
    /* The preceding SAS comment does not hide the %let statement
        as does this type of SAS comment.
        %let thresh = 6;
    */
   %if %length(&in) > 0 %then %do;
         %* infile given;
      data check;
           /* Jim's data */
         infile ∈
         input x y z;
            * check data;
         if x<&thresh or y<&thresh or z<&thresh then list;
      run;
   %end;
   %else %put Error: No infile specified;
%mend verdata;
%verdata(ina, 0)
When you execute VERDATA, the macro processor generates the following:
DATA CHECK;
   INFILE INA;
   INPUT X Y Z;
      * CHECK DATA;
   IF X<5 OR Y<5 OR Z<5 THEN LIST;
RUN;