Detecting the End of a Data Set
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:
This variable is not added to the data set. ...