I am on SAS version 7.15 HF2 (7.100.5.6112)(64-bit) Is it possible to keep a data set sorted (where the sorted flag is "Yes" and the Validated flag is "Yes") when doing operations on the data set? I am specifically looking at an instance where I'm deleting a column unrelated to the sort order, and my data set is losing it's sorted properties, which is very annoying as I'm working with an extremely large data set, so having to re-sort* every time is very time consuming. *I am aware of the option to proc sort with the pre sort option, where it just checks to see if the data set is in the proper order, this is still very time consuming on my data even though the data set has retained it's order. Some example code below to demonstrate what I'm running into. data test;
input c1 c2 c3 c4 $3.;
datalines;
1 3 5 YES
3 5 1 YES
2 6 8 YES
1 2 7 YES
6 1 9 YES
9 1 3 NO
4 1 1 NO
;
/*sort on first two columns*/
proc sort data=test;
by c1 c2;
run;
/* Confirm data is sorted and validated*/
proc contents data=test varnum;
/*Remove unrelated third column*/
data test2(drop=c3);
set test;
run;
/*Confirm the data has lost it's sorted flags*/
proc contents data=test2 varnum; Is there any way to prevent this loss of metadata? It seems extremely strange that SAS loses that flag when it is not altering the order of the rows (confirmed through proc sort with the presorted option) or removing any of the columns in the by statement.
... View more