Partitioned Running Totals in SAS

后端 未结 4 444
忘掉有多难
忘掉有多难 2021-01-24 17:51

How can I create a new column for an existing dataset that is the running total of an existing column - partitioned by some identifier?

ID |  Value |     New Val         


        
4条回答
  •  孤城傲影
    2021-01-24 18:36

    Here's another option:

    data want;
    do until (last.id);
        set have;
        by id;
        new_value + value;
        output;
    end;
    new_value = 0;
    run;
    

提交回复
热议问题