proc sort data=try ; by name yesno; data try1; set try; by name yesno; x=first.name; y=last.name; if first.name=1 then b=0; b+1; if first.yesno=1 then c=0; c+1; acc_price+price; /*if last.name=1 or last.yesno=1 then output;*/ drop x y; name yesno price b c acc_price 1 chris yes 60 6 4 200 2 chris no 50 2 2 60 3 chris no 10 1 1 10 4 chris yes 10 3 1 70 5 chris yes 40 5 3 140 6 chris yes 30 4 2 100 7 ken no 30 1 1 230 8 ken yes 10 4 3 340 9 ken yes 40 3 2 330 10 ken yes 60 2 1 290 11 tom yes 70 4 1 470 12 tom no 30 3 3 400 13 tom no 20 2 2 370 14 tom no 10 1 1 350 1 chris no 50 2 2 60 2 chris yes 60 6 4 200 3 ken no 30 1 1 230 4 ken yes 10 4 3 340 5 tom no 30 3 3 400 6 tom yes 70 4 1 470 really stuck, nowhere near the answer, please help me!
... View more