11Oct/090
Detecting the end of a SAS data set ( end= )
The END= option can help you determine when you have reached the last record in your dataset. Here is a syntax example:
data new_ds;
set old_ds end=end_var;
if end_var=1 then text='This is the last variable';
run;
The end= option creates a temporary variable, in the example it is end_var. This variable is not written to the output dataset. The variable is numeric and has a value of 1 to specify the last record.
Do not use this option with the point option.
This option is helpful when you only want to output the last record (good for summing data).
data new_ds (drop=transactional_record);
set old_ds end=last_record;
sum_var+transactional_record;
if last_record=1;
run;