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

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…

Contents