Do you mean whether the data set is sorted, meaning having been sorted previously by Proc Sort or Proc SQL?
Or do you mean whether the data set is in a particular order, regardless of having been sorted?
For example, this data set is ordered by ID. But is has not been sorted.
data have;
input ID x;
datalines;
1 10
2 20
3 30
;
As a consequence, running Proc Contents against the data like this
proc contents data = have;
run;
will tell you that the data is not sorted. Because it has not been sorted (nor validated) by SAS.
If what you are after is a check of whether the data is in some particular order, then the Presorted Option on the Proc Sort Statement is the way to go.
... View more