We can read the last observation to a new dataset using end = dataset option.
For example:
- data example.newdataset;
- set example.olddataset end=last;
- If last;
- run;
Where newdataset is a new data set to be created and olddataset is the existing data set. last is the temporary variable (initialized to 0) which is set to 1 when the set statement reads the last observation.