HOME Module List Site Index About This Site glossary" Resources Innovative Technology Center UT Statistics Courses
Using SAS Choose Design ANOVA Compare Means Regression Examples
Using SAS Using SAS: Table of Contents

Common SAS syntax rules

If you are writing a program that will be used more than once, or by someone else, adding explanatory comments to the program is a wise thing to do. These can be instructions, reminders, explanations or any other text that helps you use the program. Comments are part of your SAS program, but are ignored by SAS when running the program. By default they are colored green in the Editor window.

SAS provides two methods for creating comments, single statement and unlimited text.

Single statement comment
      An asterisk in front of any statement makes that statement a comment. The comment is terminated by a semicolon, just like any other statement. Some examples are illustrated by this small SAS program.

******* comment on a separate line. Use multiple asterisks to highlight more ******;
*** note single statements can go across multiple lines. The comment continues until the first semicolon is seen;
DATA one; *comment between statements; INPUT x; **or at the end of a line; datalines;
**comments where data is expected will be treated like data. Do not do this!!!;

Unlimited text comments
      Any text between the symbols /* and */ will be treated as a comment. This can include multiple statements, and can be placed inside of statements, as this small example shows.

/* comment blocks of code that are not needed
DATA one;
INPUT x /*internal comment: this is the ind. variable */ y;

Be careful to pair the /* and */ symbols, as unexpected results can happen. For example, a */ by itself may cause problems. Do not put a space between the asterisk and the slash.


Related Topics:                                                                                                     Using SAS: Table of Contents

Home | Contact us | Module list & summary | Glossary/Terms | About this site | Stats courses | Links | Index