The easiest way to create a comment in SAS is to highlight the text and press Ctrl + /.
You can just as easily remove the comment by highlighting the text again and pressing Ctrl + /.
If you would rather create a comment manually, you can also type /* at the beginning of the text and then type */ at the end of the text you’d like to turn into a comment.
The following example shows how to do this in practice.
Example: Create Comments in SAS
Suppose we have the following code in SAS:
The first four lines of the code simply describe what the rest of the code does.
Thus, we want to turn these lines into comments.
To turn the first four lines into comments, we can highlight each of the first four rows and press Ctrl + /:
Notice that a forward slash with an asterisk (/*) has been added to the beginning of each line and an asterisk and a forward slash (*/) have been added to the end of each line.
This indicates that those four lines are comments.
We can just as easily uncomment the first four lines by highlighting each line and pressing Ctrl + / once again:
Note that the forward slashes and asterisks have been removed from each of the first four lines.
This indicates that each line is no longer a comment.
Note: When you convert one or more lines into comments in SAS, the text turns green. This is a clear indication that you have converted those specific lines into comments.
The following tutorials explain how to perform other common operations in SAS: