There are some tools worth learning ... they will be invaluable in your future programming. After sorting:
data want;
set have;
by person_id recu_day;
if first.person_id then admission=1;
else if first.recu_day then admission + 1;
run;
The BY statement in the DATA step creates temporary variables FIRST. and LAST. for each variable that is in the BY statement. You'll need to both study and practice with them.
... View more