Could you please explain how this works. I split the code into 2 parts but not able to understand. Part-1: data want;
do until(last.flag);
set temp;
by id flag notsorted;
end;
if last.id then found=1;
run; My observation: Here we get the days 1, 2,4,7 (I took for ID=1) Part-2: Data want2;
do until(last.flag);
put _all_;
set temp;
by id flag notsorted;
if found and flag then want='Y';output;
end;
/* drop flag found; */
run; I'm not able to understand how part2 works? I prepared an excel as per understanding. ID DAY Value Flag Found Want 1 1 3 0 1 1 2 2 1 1 Y 1 3 3 0 1 4 3 0 1 1 5 2 1 1 6 2 1 1 7 1 1 1 Y How come 5,6 got Y. Could you help in understanding the code please
... View more