Chapter Contents

Previous

Next
%* comment

%* comment



Designates comment text

Type: Macro statement
Restriction: Allowed in macro definitions or open code


Syntax
Details
Comparisons
Example
Contrasting Comment Types

Syntax

%*comment;

comment
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 or a macro quoting function. Macro comments are not recognized when they are enclosed in quotation marks.

Quotation marks within a macro comment must match.


Comparisons

Macro comments and SAS comments in the form *comment; are complete statements. Consequently, they are processed by the tokenizer and cannot contain semicolons or unmatched quotation marks. SAS comments in the form *comment; are stored as constant text in a compiled macro.

SAS comments in the form /*comment*/ are not tokenized, but are processed as a string of individual characters. These comments can appear anywhere a single blank can appear and can contain semicolons or unmatched quotation marks. SAS comments in the form /*comment*/ are not stored in a compiled macro.


Example

Example 1: Contrasting Comment Types

This code defines and invokes the macro VERDATA, which checks for data errors. It contains a macro comment and comments in the form /*comment*/ and *comment;.

%macro verdata(in);
   %if %length(&in) > 0 %then %do;
         %* infile given;
      data check;
           /* Jim's data */
         infile ∈
         input x y z;
            * check data;
         if x<0 or y<0 or z<0 then list;
      run;
   %end;
   %else %put Error: No infile specified;
%mend verdata;

%verdata(ina)

When you execute VERDATA, the macro processor generates the following:

DATA CHECK;
   INFILE INA;
   INPUT X Y Z;
      * CHECK DATA;
   IF X<0 OR Y<0 OR Z<0 THEN LIST;
RUN;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.