Cumulative Totals
Monday, March 31, 2008
Jared

Linda Adams writes a nice piece of SAS code to create a variable of Cumulative Totals.  It is reproduced below:

    data one;
    input pulldate MMDDYY10.
    tsippT 12-14
    tsippC 15-18
    count 20;
    format pulldate date7.;
    cards;
    08/04/2006 34 24 1
    09/25/2006 343 200 2
    10/20/2006 678 398 3
    11/03/2006 713 406 4
    02/07/2007 857 451 5
    ;
    run;

    proc sort data=one;
    by pulldate;
    run;

    data two;
    set one;
    by pulldate;
    if first.count then sumT=0;
    sumT+tsippT;
    if last.pulldate;
    run;

    proc print data=two;
    run;

Article originally appeared on jaredprins (http://jaredprins.squarespace.com/).
See website for complete article licensing information.