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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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