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,700 courses taught by industry experts.
Processing sorted data in groups - SAS Tutorial
From the course: SAS® 9.4 Cert Prep: Part 09 Summarizing Data
Processing sorted data in groups
- [Instructor] The execution phase of the DATA step includes some very useful features that makes it easy to determine when each group of values in table begins or ends. First, you create an output table that is sorted by a column that has groups you want to analyze. Then you use the same BY statement in the DATA step to tell SAS that you want to process the data in groups. When a DATA step includes a BY statement followed by a column name, two special columns, First.bycol and Last.bycol are added to the PDV. In this example code the column names are First.Basin and Last.Basin. During the execution phase the First. and Last. variables are assigned a value of zero or one. The First. variable is one, for the first row within a group, and zero for all other rows. Similarly, the Last. variable is one for the last row within a group and zero for all other rows. These temporary variables contain important information that…
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)