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 😄

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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