<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sort datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973525#M377708</link>
    <description>&lt;P&gt;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.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 Aug 2025 15:58:56 GMT</pubDate>
    <dc:creator>Kathryn_SAS</dc:creator>
    <dc:date>2025-08-28T15:58:56Z</dc:date>
    <item>
      <title>sort datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973519#M377706</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;
&lt;P&gt;Good Evening&lt;/P&gt;
&lt;P&gt;How to get sorted&amp;nbsp; datasets and notsorted datasets&amp;nbsp; list&amp;nbsp; in a library&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 15:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973519#M377706</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2025-08-28T15:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: sort datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973525#M377708</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2025 15:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973525#M377708</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-08-28T15:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: sort datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973530#M377709</link>
      <description>&lt;P&gt;Looks like you can pull this from dictionary.tables:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
  select memname, sortname, sorttype, sortchar
  from dictionary.tables 
  where libname="WORK" 
  ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See also this thread, which uses dictionary.columns :&amp;nbsp;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Keeping-the-defined-sortedby-values-in-the-metadata/td-p/823697" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Keeping-the-defined-sortedby-values-in-the-metadata/td-p/823697&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 16:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sort-datasets/m-p/973530#M377709</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-08-28T16:02:05Z</dc:date>
    </item>
  </channel>
</rss>

