data d; input ID SAL CU$; datalines; 1234 30004 USD 1234 30012 USD 1289 30056 USD 1389 45009 INR 1456 56789 INR 1456 30067 USD 1567 30099 USD 1567 67890 GBP 1567 30088 INR 1567 30092 INR ; run; data s; length curr_joined $ 50; retain curr_joined ; set d; by id; if first.ID then curr_joined=CU; else if not exist(curr_joined) && findw(curr_joined,CU) =0 THEN curr_joined = catx(', ', curr_joined, CU); if last.ID; run;
... View more