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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1306 views
  • 1 like
  • 3 in conversation