Look at the differences between data set a1, a2 and a3:
data a00;
input a b;
cards;
2 2
3 3
5 5
;
run;
data a01;
x=1;
run;
data a1;
if _n_=1 then do;
set a01;
end;
set a00;
run;
data a2;
if _n_=1 then do;
x=1;
end;
set a00;
run;
data a3;
retain x;
if _n_=1 then do;
x=1;
end;
set a00;
run;
data a1;
if _n_=1 then do;
set a01;
end;
set a00;
run;
1) first step of data a1: _n_=1, read in set a01 and retain the value of x=1; goes down and read the first value of set a00; combined together we get (x a b)=(1 2 2)
5) if there is no set a00, then how many obs will we get? (the answer is 2)
No comments:
Post a Comment