Chapter 3
Rules for Words and Names in the
SAS Language
Words in the SAS Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Definition of Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Types of Words or Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Placement and Spacing of Words in SAS Statements . . . . . . . . . . . . . . . . . . . . . . . 23
Names in the SAS Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Definition of a SAS Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Rules for User-Supplied SAS Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
SAS Name Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Summary of Default Rules for Naming SAS Data Sets and SAS Variables . . . . . . 33
Summary of Extended Rules for Naming SAS Data Sets and SAS Variables . . . . . 34
Words in the SAS Language
Definition of Word
A word or token in the SAS programming language is a collection of characters that
communicates a meaning to SAS and which cannot be divided into smaller units that can
be used independently. A word can contain a maximum of 32,767 bytes.
A word or token ends when SAS encounters one of the following:
the beginning of a new token
a blank after a name or a number token
the ending quotation mark of a literal token
Each word or token in the SAS language belongs to one of four categories:
names
literals
numbers
special characters
Types of Words or Tokens
There are four basic types of words or tokens:
21

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.