In reply to Aditya Gade.

This is called the "cumulative sum." The typical implementation in the DATA step is to use the "sum statement" notation, as follows:

data Have;
do A = 1 to 10; output; end;
run;

data Want;
set Have;
cusum + A; /* equivalent to RETAIN cusum; cusum=SUM(cusum,A); */
run;