BookmarkSubscribeRSS Feed
Andres_Fuentes1
Calcite | Level 5

Hello everyone, I hope you are very well, I have a problem that has not worked for me at all, I need to accumulate a numeric column by group and date. The example table is the following:

 

GROUPDATETOTALCUMULATIVE_BY_GROUP
A01-01-20221212
A02-01-20221527
A03-01-2022330
A04-01-2022333
A05-01-20221649
A06-01-2022756
B01-01-202233
B02-01-202269
B03-01-20221827
B04-01-2022633
B05-01-2022235
B06-01-20221247
C01-01-20221616
C02-01-2022420
C03-01-20221939
C04-01-20221655
C05-01-2022459
C06-01-2022665

 

Thanks.

1 REPLY 1
PaigeMiller
Diamond | Level 26

 

 

/* Untested Code */
data want;
    set have;
    by group;
    if first.group then cumulative_by_group=0;
    cumulative_by_group+total;
run;
--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 482 views
  • 0 likes
  • 2 in conversation