Hi,
Consider the following tables:
BigTable:
Obs Name score
1 Jack 10
2 Mary 11
SmallTable:
Obs Tool
1 screwdriver
and the following code:
data MyTable;
SET BigTable;
if _N_=1 then SET SmallTable;
run;
I'll get:
Obs Name score Tool
1 Jack 10 screwdriver
2 Mary 11 screwdriver
However, I don't understand why the value of "tool" is still "screwdriver" for the second observation. Indeed, when the data step comes to the second record of BigTable in the first set statement, _N_ has been incremented, its value is 2 and then the if..then statement returns false; that is, the "SET SmallTable" statement should NOT be executed !
However, it is...
Please help me to understand what happens.
Thanks a lot