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: Identifying the first and last row in each group

Demo: Identifying the first and last row in each group - SAS Tutorial

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

Demo: Identifying the first and last row in each group

- [Instructor] Once again, we'll use the DATA Step Debugger in Enterprise Guide to observe how the first., last. variables are assigned values in the PDV during execution. So in our program, I'm going to start with the proc sort. So notice we're looking at the storm 2017 data as the input table, and I'm creating a sorted version of that table, keeping only Basin and Name, sorting by Basin. So we'll just select that step and Run the selection. It looks like the first 20 rows of this table have Basin equal to EP, and then we switch to a new group with Basin NA. Let's return to the program. Now in the DATA step I'm reading the sorted table, and I'm grouping the processing by Basin. Let's launch the debugger, and see what we have in the PDV. Because there is a by statement included, the variable's FIRST.Basin and LAST.Basin are included in the PDV. Now these variables are temporary, so they will actually be dropped before…

Contents