Search notes:

SAS: Program compilation

The word scanner passes tokens to the compiler until a step boundary is reached (run, quit, proc …).
These tokens are then checked for syntactically correctness and, if correct, compiled.
The compiled code is the further passed to the execute module.

Order of compilation

In the following example, the macro compiler compiles and executes the %put as soon as it reaches its terminating ;.
The SAS language execution, however, executes its text only when the run; statement is reached.
Therefore, it first prints Hello from macro put, then Hello from statement put, although these two statements are in reverse order in the source code.

See also

Compilation of a macro
Global statements are not really executed. They take effect as soon as the compiler parses them.

Index