allen802 data b(drop=amount); set a; by id; if first.id then total=0; total+amount; if last.id; run; data c; merge a b; by id; if first.id then tot=0; tot+amount; percent=tot/total;output; run;