Performing a Calculation Based on the Last Observation
Understanding When the Last Observation Is Processed
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 ...
Get Step-by-Step Programming with Base SAS 9.4 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.