SAS Programs and Macro Processing |
This section describes the typical pattern that SAS follows to process a program. These concepts are helpful for understanding how the macro processor works with other parts of SAS. However, they are not required for most macro programming. They are provided so that you can understand what is going on behind the scenes.
Note: The concepts in this section present a logical representation, not a detailed physical representation, of how SAS software works.
When you submit a program, it goes to an area of memory called the input stack. This is true for all program and command sources: the SAS windowing environment, the SCL SUBMIT block, the SCL COMPILE command, or from batch or noninteractive sessions. The input stack shown in the following figure contains a simple SAS program that displays sales data. The first line in the program is the top of the input stack.
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 and how to control the timing of macro execution in your programs. The following sections show you how a simple program is tokenized and processed.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.