Hi. On further thought, these two also work ...
data example; input id status :$1. @@; datalines; 100 C 200 A 300 C 400 C 500 C 400 C 300 A 200 A 100 C 500 A ;
* use SQL;
proc sql; create table want as select distinct * from example where status = 'C' union all select * from example where status = 'A' order id, status desc; quit;
* or, use SORT plus a simple data step;
proc sort data=example; by id descending status; run;
data want; set example; by id; if (first.id and status eq 'C') or status eq 'A'; run;
... View more