BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am struggling with trying to create a computed column that calculates the cumulative values of another column. This does not seem like it would be a difficult task, however, there does not appear to be a function that does this. Does anyone know of a function, or some trick in order to generate cumulative values within enterprise guide?
4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12
Actually, this is one of the things that are hard to do in PROC SQL and I'm not even sure that it can be done. You are asking to do a running total and that requires an assigned order to the data. SQL is designed to be done without any order while it is working.

This is easy to do in a data step, but that requires a code task.

Doc Muhlbaier
Duke
deleted_user
Not applicable
I was able to figure this out for anyone who is interested in knowing.

data work.NewTableName;
set work.TableYourFieldisIn;
'NewCumulativeColumnName'n + 'FieldForCumulativeColumnToSum'n;
run;

This will put out a new table containing the information from your reference table as well as your new cumulative column.
deleted_user
Not applicable
Oh yeah, i forgot to mention that the above entry can be done in a "Code Step" in EG
anzabob
Fluorite | Level 6
Hahaa thanks this still helped me 13 years later 😄

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 2272 views
  • 1 like
  • 3 in conversation