Hello,
Are below two DATA step (test1, test2) same ? I am assuming the NOT FIRST.ID is implied in test2.
data test;
input id x;
cards;
1 2
1 2
2 3
2 2
;
run;
data test1;
set test;
by id;
retain val;
if first.id then val = 1;
else if not first.id and x > 1 then val = 5;
run;
data test2;
set test;
by id;
retain val;
if first.id then val = 1;
else if x > 1 then val = 5;
run;