Create a flag and use RETAIN to hold it across rows.
Data want;
srt have;
by id;
retain flag;
if first.id then flag=0;
if flag=1 then call missing(res);
if res='XXX' then flag=1;
run;
2025 SAS Hackathon: There is still time!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!