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 within groups - SAS Tutorial
From the course: SAS® 9.4 Cert Prep: Part 09 Summarizing Data
Demo: Creating an accumulating column within groups
- [Instructor] So you've seen how you can use First dot or Last dot variables to keep only the first or last row within groups. This is only one of many practical benefits of this syntax. You can also use First dot, Last dot variables to prompt for some action to occur at the beginning or end of each group. Let's take a look at the weather data for Houston again. We created an accumulating total for the daily rain column during the entire year, using a SUM statement. But what if we want to create a month-to-date total column? In other words, we want to create an accumulating column named MTD or month-to-date rain, but reset it each time a new month begins. Let's see how to do this in a demo. Here we'll use the First dot variable to reset an accumulating column for rain totals at the beginning of each month. Let's take a look at this data stat. We're reading the weather, Houston table, and we're creating a data set…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Answering questions about groups43s
-
(Locked)
Processing sorted data in groups1m 11s
-
(Locked)
Demo: Identifying the first and last row in each group4m 8s
-
(Locked)
Subsetting rows in the Execution phase2m 29s
-
(Locked)
Demo: Creating an accumulating column within groups2m 59s
-
(Locked)
Using multiple BY columns1m 14s
-
(Locked)