If you are given an unsorted data set, how will you read the last observation to a new dataset?
We can read the last observation to a new dataset using end = dataset option.
For example:
1
2
3
4
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.