From the course: SAS® 9.4 Cert Prep: Part 09 Summarizing Data

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Demo: Creating an accumulating column

Demo: Creating an accumulating column - SAS Tutorial

From the course: SAS® 9.4 Cert Prep: Part 09 Summarizing Data

Demo: Creating an accumulating column

- Suppose we want to look at rain fall data as part of our storm research. We'll start with a small geographic area and analyze daily rain fall totals in Houston, Texas, during 2017. We want to create a new column that stores a year to date rain fall total. Notice the assignment statement for YTD or year to date rain. We want to take the previous value of year to date rain and add it to the value of daily rain for each row. Will it work? Let's try it in a demo. Once again, we'll use the DATA Step Debugger and Enterprise Guide to observe how the default behavior of the PDV must be modified in order to create an accumulating column. So the program we're starting with, we're reading the weather Houston data, trying to create a new data set called Houston rain, and our assignment statement is attempting to calculate year to date rain. It's calculated by adding what would be the previous value of year to date rain…

Contents