Friday, April 1, 2011

What happens when SAS compiles a DATA step?

When SAS compiles a DATA step, it performs below steps:
�� syntax scan
�� SAS source code translation to machine language
�� definition of input and output files
�� creates:
◊ input buffer (if reading any non-SAS data),
◊ Program Data Vector (PDV),
◊ and data set descriptor information
�� set variable attributes for output SAS data set
�� capture variables to be initialized to missing:
◊ Variables from input statement
◊ User defined variables other than sum statement

Retained variables:
◊ all SAS special variables
_N_
_ERROR_
◊ all vars in RETAIN statement
◊ all vars from SET, MERGE, or UPDATE
◊ accumulator vars in SUM statement(s)
◊ data elements in a _TEMPORARY_ array
◊ any variables that are created with options in the FILE or INFILE statements


Compile time only statements
�� drop, keep, rename
�� label
�� retain
⇒ length
⇒ format, informat
⇒ attrib
⇒ array
⇒ by

No comments: