I am hoping for your help! I have a set with approved, decline, incomplete, etc transactions. I need to get the latest transaction (due to duplication of transactions; they only differ on the status Approve/decline/etc), but if we need to keep all approved (one transaction can be approved twice, we need to see it). Task: I need to keep all of the "Approved" transactions, and then just the latest (from the rest of the results). Not all of the transactions have Approved status. One transaction can have 2 Approvals, while other transaction can have Decline and Decline (in such case I need the latest decline).
This is not working:
proc sql;
create table XYZ as
select *
from MKZ
where approve_decline='Approve'
group by Trans_id_proxy
or (having datetimevar=max(datetimevar))
order by account_number
;
quit;
Thank you!