Figure 2.1 Submitted Programs Are Sent to the Input Stack
Once a program reaches the input stack, SAS transforms the stream of characters into
individual tokens. These tokens are transferred to different parts of SAS for processing,
such as the DATA step compiler and the macro processor. Knowing how SAS recognizes
tokens and how they are transferred to different parts of SAS will help you understand
how the various parts of SAS and the macro processor work together. Also, how to
control the timing of macro execution in your programs. The following sections show
you how a simple program is tokenized and processed.
How SAS Processes Statements without Macro
Activity
The process that SAS uses to extract words and symbols from the input stack is called
tokenization. Tokenization is performed by a component of SAS called the word
scanner, as shown in Figure 2.2 on page 17. The word scanner starts at the first
character in the input stack and examines each character in turn. In doing so, the word
scanner assembles the characters into tokens. There are four general types of tokens:
Literal
a string of characters enclosed in quotation marks.
16 Chapter 2 • SAS Programs and Macro Processing