Skip Navigation
*To search for student contact information, login to FlashLine and choose "My Campus" tab.

Search by campus:

SAS Syntax Basics Screenshots Tutorial

SAS Syntax Basics

  • Statements in SAS are like sentences. The punctuation though is a semicolon (;) rather than a period (.)
  • Most statements (but not all) start with an identifying key word (e.g. proc, data, label, options, format...)
  • Statements are strung together into sections similar to paragraphs. These paragraphs in a Windows OS are ended with the word "run" and a semicolon.

SAS 9.1.4 Syntax 1

SAS Syntax Rules

  • SAS statements are format free.
  • One or more blanks or special characters are used to separate words.
  • They can begin and end in any column.
  • A single statement can span multiple lines.
  • Several statements can be on the same line.

SAS Free Format

SAS 9.1.4 Syntax 2

Using the free-format Syntax

rules of SAS though can make it difficult for others (or you) to read your

program. This is akin to

writing a page of text with little attention to line and paragraph breaks. You may still have

Capital letters and periods, but where a sentence begins and ends may be a bit confusing.

SAS 9.1.4 Syntax 1

Using the free-format Syntax rules of SAS though can make it difficult for others (or you) to read your program. This is akin to writing a page of text with little attention to line breaks. you may still have capital letters and periods, but where a sentence begins and ends may be a bit confusing. Isn't this paragraph and this example of a sas program easier to read?

SAS 9.1.4 Syntax 8

SAS Comments can be used to provide additional information, reminders, or to keep a part of the program from running without deleting it. Note that above example has a comment in green about the labels. Another comment (in green) keeps the options statement from running with the rest of the program.

  • Type /* to begin a comment
  • Type your comment text
  • Type */ to end the comment
  • Or type an * at the beginning of a line. Everything between the * and the ; will be commented.
  • Alternatively, highlighting the text that you would like to comment and use the keys Ctrl / to comment the line. To uncomment a line, highlight and use the Ctrl Shift / keys.

For additional questions or assistance, contact Tina Ughrin.

Research Software Tutorial Survey

1. This tutorial was helpful. This field is required

2. Suggestions for changes or additions to this tutorial.

3. How did you find out about this webpage?