• +
• @
• /
Placement and Spacing of Words in SAS Statements
Spacing Requirements
Here are the spacing requirements for words in SAS statements:
• You can begin SAS statements in any column of a line and write several statements
on the same line.
• You can begin a statement on one line and continue it on another line, but you cannot
split a word between two lines.
• A blank is not treated as a character in a SAS statement unless it is enclosed in
quotation marks as a literal or part of a literal. Therefore, you can put multiple blanks
any place in a SAS statement where you can put a single blank. It has no effect on
the syntax.
• The rules for recognizing the boundaries of words or tokens determine the use of
spacing between them in SAS programs. If SAS can determine the beginning of each
token due to cues such as operators, you do not need to include blanks. If SAS
cannot determine the beginning of each token, you must use blanks. See Examples
on page 23.
Although SAS does not have rigid spacing requirements, SAS programs are easier to
read and maintain if you consistently indent statements. The examples illustrate useful
spacing conventions.
Examples
• In this statement, blanks are not required because SAS can determine the boundary
of every token by examining the beginning of the next token:
total=x+y;
The first special-character token, the equal sign, marks the end of the name token
total. The plus sign, another special-character token, marks the end of the name
token x. The last special-character token, the semicolon, marks the end of the y
token. Though blanks are not needed to end any tokens in this example, you can add
them for readability, as shown here:
total = x + y;
• This statement requires blank spaces because SAS cannot recognize the individual
tokens without them:
input group 15 room 20;
Without blanks, the entire statement up to the semicolon fits the rules for a name
token: it begins with a letter or underscore, contains letters, digits, or underscores
thereafter, and is less than 32,767 bytes long. Therefore, this statement requires
blanks to distinguish individual name and number tokens.
Words in the SAS Language 23