- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Could you please say what is the context in the "SORTEDBY=_NULL_" (unfortunately I can not ask the author) in the following code:
DATA test (SORTEDBY=_NULL_);
SET pretest;
RUN;
The dataset pretest was previously sorted by one variable.
Thank you!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As the SORTEDBY= Data Set Option Documentation says it "removes any existing sort indicator." 🙂
A small example demonstrates the option
data SomeData;
input x @@;
datalines;
3 2 5 1 6 4 8 5
;
proc sort data=SomeData;
by x;
run;
/* SAS knows that SomeData is sorted (Sorted=Yes) */
proc contents data=SomeData;
run;
/* Sortedby=_null_ forces SAS to forget the sort information (Sorted=No) */
data test(sortedby=_null_);
set SomeData;
run;
proc contents data=test;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As the SORTEDBY= Data Set Option Documentation says it "removes any existing sort indicator." 🙂
A small example demonstrates the option
data SomeData;
input x @@;
datalines;
3 2 5 1 6 4 8 5
;
proc sort data=SomeData;
by x;
run;
/* SAS knows that SomeData is sorted (Sorted=Yes) */
proc contents data=SomeData;
run;
/* Sortedby=_null_ forces SAS to forget the sort information (Sorted=No) */
data test(sortedby=_null_);
set SomeData;
run;
proc contents data=test;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, draycut. I just do not understand for what was it needed that "SAS to forget the sort information"...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In that step it is not needed since SAS will not be storing any SORTEDBY information for a dataset created in that way.
Perhaps they had a previous process that did generate the data in a sorted order and they wanted to force SAS to store the fact it was sorted. So they were in the habit of using the SORTEDBY= dataset option and instead of removing it totally they just set the list of variables to _NULL_.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Taken from the documentation:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000131184.htm
removes any existing sort indicator
Regards,
Amir.