I need some help regarding how to check a certain condition for every unique PatientId in my data. In my mock data here we have 4 unique PatientId's. There are 8 possible doctor visits that every patient should do. I want to check, for every unque patient, what visits that are not done. PatientId VisitNumber
1 2
1 3
2 1
2 2
2 4
2 5
2 6
2 8
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
4 1
4 6
4 8 Optimal output would be: PatientId VisitsExcluded
1 1,4,5,6,7,8
2 3,7
3 .
4 2,3,4,5,7 How would you do it? What to write instead of [missing code], or do you have any other go? * VisitsExcluded (of VisitNumber 1-8);
proc sql;
create table want as
select PatientId, case
when VisitNumber [missing code]
else "" end as EventSeq_missing
from have
group by PatientId;
quit;
... View more