Your displayed data set doesn't have duplicates that I can see. This won't give you the formatting youw ant but it's close. The label of 'without adverse event likely belongs to the TRTAN column.
proc transpose data=have out=want; by trtan; id aesevn; idlabel aesev; var count; run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!