<?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: Sorting complex folder names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710380#M218667</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var :$15.;
cards; 
test1.nm7

test100.nm7

test1001.nm7

test2.nm7

test3.nm7
;

proc sql;
 create table want as
 select *
 from have
 order by input(compress(scan(var,1,'.'),,'kd'),32.);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The idea is to extract and sort the numerical part in the pattern.&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;var&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test1.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test2.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test3.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test100.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test1001.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Sat, 09 Jan 2021 14:39:55 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2021-01-09T14:39:55Z</dc:date>
    <item>
      <title>Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710379#M218666</link>
      <description>&lt;P&gt;I have the following data under the variable name folder.&lt;/P&gt;
&lt;P&gt;Folder&lt;/P&gt;
&lt;P&gt;test1.nm7&lt;/P&gt;
&lt;P&gt;test100.nm7&lt;/P&gt;
&lt;P&gt;test1001.nm7&lt;/P&gt;
&lt;P&gt;test2.nm7&lt;/P&gt;
&lt;P&gt;test3.nm7&lt;/P&gt;
&lt;P&gt;I would like to sort this data to give me the test in the following numerical order.&lt;/P&gt;
&lt;P&gt;Folder&lt;/P&gt;
&lt;P&gt;test1.nm7&lt;/P&gt;
&lt;P&gt;test2.nm7&lt;/P&gt;
&lt;P&gt;test3.nm7&lt;/P&gt;
&lt;P&gt;test100.nm7&lt;/P&gt;
&lt;P&gt;test1001.nm7&lt;/P&gt;
&lt;P&gt;Can someone tell me how to do this?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 14:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710379#M218666</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2021-01-09T14:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710380#M218667</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var :$15.;
cards; 
test1.nm7

test100.nm7

test1001.nm7

test2.nm7

test3.nm7
;

proc sql;
 create table want as
 select *
 from have
 order by input(compress(scan(var,1,'.'),,'kd'),32.);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The idea is to extract and sort the numerical part in the pattern.&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;var&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test1.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test2.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test3.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test100.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;test1001.nm7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sat, 09 Jan 2021 14:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710380#M218667</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-09T14:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710385#M218670</link>
      <description>&lt;P&gt;There is an option for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort sortseq=LINGUISTIC(NUMERIC_COLLATION=ON);
   by var;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 131px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53366i9E00C04D4E959293/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 15:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710385#M218670</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2021-01-09T15:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710386#M218671</link>
      <description>&lt;P&gt;Much thanks guru&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp; as always.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 15:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710386#M218671</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-09T15:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710389#M218674</link>
      <description>I will give it a try later but the prior post resolved the issue.&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Jan 2021 16:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710389#M218674</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2021-01-09T16:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710427#M218697</link>
      <description>Could be simpler as :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; select *&lt;BR /&gt; from have&lt;BR /&gt; order by input(scan(var,1,,'kd'),32.);&lt;BR /&gt;</description>
      <pubDate>Sun, 10 Jan 2021 10:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710427#M218697</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-10T10:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting complex folder names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710447#M218706</link>
      <description>It does work I had put in something wrong. I will accept it as a solution.&lt;BR /&gt;</description>
      <pubDate>Sun, 10 Jan 2021 14:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-complex-folder-names/m-p/710447#M218706</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2021-01-10T14:49:00Z</dc:date>
    </item>
  </channel>
</rss>

