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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 514 views
  • 0 likes
  • 2 in conversation