Table of Contents
SAS, also known as Statistical Analysis System, allows users to create comments within their code in order to provide additional information or explanations. Comments are lines of text that are not executed as part of the code, but serve as notes for the user or other programmers. To create comments in SAS, the user can simply begin the line with an asterisk (*) or use the /* and */ symbols to enclose the comment. This will indicate to SAS that the line is a comment and should not be executed. For example:
*This is a comment in SAS;
/* This is also a comment in SAS */
Comments can be used to document the purpose of certain code, provide instructions, or clarify complex sections. They can also be used to temporarily deactivate a section of code without deleting it. Overall, the use of comments in SAS can enhance the readability and organization of code for better understanding and collaboration among programmers.
Create Comments in SAS (With Examples)
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.
The following tutorials explain how to perform other common operations in SAS:
Cite this article
stats writer (2024). How can I create comments in SAS? Can you provide some examples?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-create-comments-in-sas-can-you-provide-some-examples/
stats writer. "How can I create comments in SAS? Can you provide some examples?." PSYCHOLOGICAL SCALES, 25 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-create-comments-in-sas-can-you-provide-some-examples/.
stats writer. "How can I create comments in SAS? Can you provide some examples?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-create-comments-in-sas-can-you-provide-some-examples/.
stats writer (2024) 'How can I create comments in SAS? Can you provide some examples?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-create-comments-in-sas-can-you-provide-some-examples/.
[1] stats writer, "How can I create comments in SAS? Can you provide some examples?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I create comments in SAS? Can you provide some examples?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
