Detecting the End of a Data Set

Overview

Instead of reading specific observations, you might want to determine when the last observation in an input data set has been read, so that you can perform specific processing. For example, you might want to write only one observation that contains grand totals for numeric variables.
To create a temporary numeric variable whose value is used to detect the last observation, use the END= option in the SET statement.
Syntax, END= option:
END=variable
variable creates and names a temporary variable that contains an end-of-file marker. The variable, which is initialized to 0, is set to 1 when the SET statement reads the last observation of the data set.
This variable is not added to the data set. ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.