SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
Documents the purpose of the statement or program
Valid: anywhere
Category: Log Control
Syntax
*message ;
or
/* message */
Arguments
* message ;
-
specifies the text that explains or documents the statement or program.
-
Range: These comments can be any length and are terminated with a semicolon.
-
Restriction: These comments must be written as separate statements.
-
Restriction: These comments cannot contain internal semicolons or unmatched quotation marks.
-
Tip: Inside a macro, a comment in this form is often disregarded:
*message;
-
When creating macros, therefore, use the PL/1-style comment:
/* message */
-
/* message */
-
specifies the text that explains or documents the statement or program.
-
Range: These comments can be any length.
-
Tip: These comments can contain semicolons and unmatched quotation marks.
-
Tip: You can write these comments within statements or anywhere a single blank can appear in your SAS code.
-
Tip: This is the only style of comment that can be used to actually comment out code.
Details
You can use the comment statement anywhere in a SAS program to document the purpose of the program, explain unusual segments of the program, or describe steps in a complex program or calculation. SAS ignores text in comment statements during processing.
CAUTION:
-
Avoid placing the /* comment symbols in columns 1 and 2. In some operating environments, SAS may interpret a /* in columns 1 and 2 as a request to end the SAS program or session. For details, see the SAS documentation for your operating environment.
Examples
These examples illustrate the two types of comments:
-
This example uses the * message ; format:
*This code finds the number in the BY group;
-
This example uses the * message ; format:
*---------------------------------------* This uses one comment statement to draw a box. *---------------------------------------*;
-
This example uses the /* message */ format:
input @1 name . /* last name */ @200 test 8. /* score test */ @50 age 3.; /* customer age */
-
This example uses the /* message */ format:
/* For example 1 use: x=abc; for example 2 use: y=ghi; */