Hi,
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.
Hi:
As a comparison, either PROC REPORT or PROC TABULATE could produce a report with only 1 pass through the data.
cynthia
PROC SUMMARY to get the sums you want.
PROC REPORT or PROC TRANSPOSE to get the table you want from the sums calculated above.
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;
Hi:
As a comparison, either PROC REPORT or PROC TABULATE could produce a report with only 1 pass through the data.
cynthia
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.