Your ID has a clear pattern for a SCAN function starting from right to left-
length want_id $15;
want_id=scan(id,-1,' ');
data have ;
infile cards truncover expandtabs ;
input ID $28. Date Amount :comma10. ;
format amount comma10.2 ;
cards;
Robert, Andrews 222-22-1234 2019 1,234.00
Albert, Sanders 123-45-6789 2018 2,34.67
Zack, Snyder 111-22-3333 2020 1,234.77
;
data want ;
set have ;
length want_id $15 ;
want_id=scan(id,-1,' ') ;
run ;
proc print noobs ; run ;
ID
Date
Amount
want_id
Robert, Andrews 222-22-1234
2019
1,234.00
222-22-1234
Albert, Sanders 123-45-6789
2018
234.67
123-45-6789
Zack, Snyder 111-22-3333
2020
1,234.77
111-22-3333
... View more