If you are given an...
Notifications
Clear all

If you are given an unsorted data set, how will you read the last observation to a new dataset

RSS

(@abhijith)
Noble Member
加入ed: 2 years ago
帖子:1350
23/03/2021 11:19 am

If you are given an unsorted data set, how will you read the last observation to a new dataset?

This topic was modified 1 year ago byAbhijith

Quote
(@abhijith)
Noble Member
加入ed: 2 years ago
帖子:1350
23/03/2021 11:22 am

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.


ReplyQuote
Share:
Baidu