Many applications require that you determine when the
DATA step processes the last observation in the input data set. For
example, you might want to perform calculations only on the last observation
in a data set, or you might want to write an observation only after
the last observation has been processed. For this purpose, you can
use the END= option for the SET, MERGE, MODIFY, or UPDATE statements.
The syntax for this option is:
SET SAS-data-set-list END=variable;
The END= option defines a temporary variable whose value is 1 when the DATA step is processing the last observation. At all other times, the value of variable is 0. Although ...