Contents Index <<Browse<< >>Browse>>
Here are the hidden details of how SAS processed the data cards in the previous example. Each data step program contains two IMPLICIT pieces.
The SAS data step contains an implicit loop. The programming statements in a data step are executed once for each data card. This is how the successive data cards are read. The values of all variables defined in the data step are erased immediately before each pass through this implicit loop. (The retain statement can be used to circumvent this behavior.)
The SAS data step also contains an implicit output statement. After the final program line of the data step the current values of ALL variables are written to the SAS data set. This is how the SAS data set is created.
The data step program operates conceptually as though it were written like this.
data first;
do while there are data cards;
input name $ age;
output;
loop;
cards;
john 12
jane 11
jack 13
amy 10
run;
The output statement can be used by the programmer to control when variables are written to the data set. The implicit loop is always present. Keep these facts in mind as you write your data step programs.
Contents Index <<Browse<< >>Browse>>
Copyright © 1997 by Jerry Alan Veeh. All rights reserved.