Hi Guys,
Good Evening
How to get sorted datasets and notsorted datasets list in a library
I am not sure if this is what you are asking, but in the output data set from PROC CONTENTS there is a SORTED variable. It will have a value of 1 if the data set is sorted or missing (.) if it is not. Here is a simple example.
proc sort data=sashelp.class out=class;
by age;
run;
proc sort data=sashelp.cars out=cars;
by type;
run;
data test;
x=1;
run;
proc contents data=work._all_ noprint out=allds(keep=libname memname sorted);
run;
data allds;
set allds;
by libname memname;
if first.memname then output;
run;
proc print data=allds;
run;
Looks like you can pull this from dictionary.tables:
proc sql ;
select memname, sortname, sorttype, sortchar
from dictionary.tables
where libname="WORK"
;
quit ;
See also this thread, which uses dictionary.columns :
https://communities.sas.com/t5/SAS-Programming/Keeping-the-defined-sortedby-values-in-the-metadata/t...
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.