Cumulative Sumation

#1
Hello,

I want to calculate cumulative sum of a column. To calculate column B via A

A B
5 5
10 15
5 20
10 30
20 50
5 55
10 65

What would be the easiest way in SAS?
 
#2
Hi
Below you see solution.

data test;
input a;
cards;
5
10
5
10
20
5
10
;
run;

data test ; set test ; id=1 ; run ;

proc sort data=test out=test; by id; run;


data test_out;
set test;
by id;
retain b;
if first.id then b=a; else b=b+a;
run;


Irena