06-29-2017 07:50 AM
I want to ask a question about cumulative sum. I think I can explain better by using the simple sample. So, I have the following dataset:
Group Time Value
A 14:25 5
A 14:25 10
A 14:26 8
B 14:25 4
B 14:25 7
C 14:25 12
C 14:25 3
C 14:26 6
C 14:26 9
I want to get the following datasets:
Time A B C
14:25 15 (5+10) 11 (4+7) 15(12+3)
14:26 8 0 15(6+9)
Thanks in advance for your helps.
06-29-2017 07:53 AM
PROC SUMMARY to get the sums you want.
PROC REPORT or PROC TRANSPOSE to get the table you want from the sums calculated above.
06-29-2017 08:00 AM
This is just a guess as not typing in that data nor, guessing he strcuture - post test data in the form of a datastep!
proc sq; create table INTER as select TIME, GROUP, sum(VALUE) as VALUE from HAVE: group by TIME, GROUP; quit; proc transpose data=inter out=want; by time; var value; id group; run;
Need further help from the community? Please ask a new question.