<?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: proc sort in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329690#M62553</link>
    <description>&lt;P&gt;No screenshot is included. Please include your code/log and what version of SAS you're using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems this should work as of SAS 9.2+&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/31/369.html" target="_blank"&gt;http://support.sas.com/kb/31/369.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2017 05:34:14 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-02-03T05:34:14Z</dc:date>
    <item>
      <title>proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329685#M62552</link>
      <description>&lt;DIV&gt;&amp;nbsp;how to sort&amp;nbsp;character/alphabetical data in logical order (without sorting uppercase letters and lowercase letters separately)?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I tried to use SORTSEQ = LINGUISTIC option, but I get the error in the screenshot below.&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329685#M62552</guid>
      <dc:creator>mrinmoy</dc:creator>
      <dc:date>2017-02-03T05:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329690#M62553</link>
      <description>&lt;P&gt;No screenshot is included. Please include your code/log and what version of SAS you're using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems this should work as of SAS 9.2+&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/31/369.html" target="_blank"&gt;http://support.sas.com/kb/31/369.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329690#M62553</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-03T05:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329692#M62554</link>
      <description>&lt;P&gt;I have a month variable and i want it in a month order like jan fab march etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried to use SORTSEQ = LINGUISTIC option, but I get the error in the screenshot below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sas: 9.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error: Translation table for sort sequence LINGUIST no found&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329692#M62554</guid>
      <dc:creator>mrinmoy</dc:creator>
      <dc:date>2017-02-03T05:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329695#M62555</link>
      <description>&lt;P&gt;Proc sort won't sort it the way you want. You'll need to create a new variable that has the month in a format that will sort according to a calendar.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 06:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329695#M62555</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-03T06:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329696#M62556</link>
      <description>&lt;P&gt;Convert your month variable to a SAS date and sort the SAS date, then your data will be in correct date order.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 06:20:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329696#M62556</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-02-03T06:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329722#M62557</link>
      <description>&lt;P&gt;And if you need only months, not complete dates (eg because you want to work with months across years), then store the months as numbers 1-12 and apply a custom format to show month names.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 09:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/329722#M62557</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-03T09:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/330208#M62596</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use SQL, which is more flexible to order data the way you want it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just use an available informat&amp;nbsp;or create one that will create the sequence needed, for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc format;
         invalue MNTH (upcase)
                     'JAN'=1  'FEB'=2  'MAR'=3
                     'APR'=4  'MAY'=5  'JUN'=6
                     'JUL'=7  'AUG'=8  'SEP'=9
                     'OCT'=10 'NOV'=11 'DEC'=12
                      other=-1;
run; * create custom informat;

proc sql;
create table WANT as
select *
from HAVE
order by input(VAR,MNTH.); * order using the informat;
quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ORDER BY will accept functions and you can combine more than one variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 15:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/330208#M62596</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-02-06T15:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/330232#M62597</link>
      <description>&lt;P&gt;Given the fixed and relatively&amp;nbsp;limited number of values of the sort variable, this is a case where your knowledge of the data&amp;nbsp;might avoid the need for proc sort, possibly&amp;nbsp;saving lots of intermediate disk input/output activity:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have (where=(month='JAN'))
      have (where=(month='FEB'))
      have (where=(month='MAR'))
      have (where=(month='APR'))
      have (where=(month='MAY'))
      have (where=(month='JUN'))
      have (where=(month='JUL'))
      have (where=(month='AUG'))
      have (where=(month='SEP'))
      have (where=(month='OCT'))
      have (where=(month='NOV'))
      have (where=(month='DEC'))
	open=defer;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "open=defer" option tells SAS not to allocate&amp;nbsp;memory to simultaneously creating input&amp;nbsp;buffers for all&amp;nbsp;12 SET datasets.&amp;nbsp; Just use the same buffer 12 times, in sequence.&amp;nbsp;&amp;nbsp; You can get away with this option if&amp;nbsp;(1) all the buffers would accomodate the same&amp;nbsp;variables and (2) you do not use a BY statement (which would require SAS to determine record order by comparing&amp;nbsp;inputs from all sources).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, the&amp;nbsp;downside of this approach is that, even though no utility/intermediate files are created (i.e. no excess disk output), it does read&amp;nbsp;dataset HAVE 12 times.&amp;nbsp;&amp;nbsp; There is a tradeoff between number of sort levels and sort-utility file needs.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 16:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort/m-p/330232#M62597</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-06T16:17:26Z</dc:date>
    </item>
  </channel>
</rss>

