Data Step Processing [8-9]


Phase 2: Execution Phase

The execution phase is the second phase of the data step processing.

During the execution phase, the data is read into the input buffer and subsequently the PDV and the data set, one observation at a time.

Let's take a look at our example.

Data Profile;
Input Name $ Age;
Khan 28
Natalia 32
Tommy 29
Lee 34

In the execution phase, the first line of data is read into the input buffer:

Input Pointer

Once the data is in the input buffer, SAS uses the input pointer to read the data into the PDV.

The input pointer is placed at the beginning of the input buffer:

The input pointer then reads the data into the PDV:

The data read into the PDV becomes the variable values. They are then written to the data set.

Note: the _n_ and _error_ variables exist only in the PDV. They are not written to the data set.

Once the current record is written to the data set, SAS resets the values in the PDV prior to reading in the second record.

The variables created by the INPUT statement, such as the NAME and AGE variables, are reset to missing.

The value of _n_ goes up by 1. This indicates the start of the second data step iteration.

The _error_ variable is reset to 0 if changed.

This concludes the first iteration of the execution phase.