<?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: avoid sorting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455084#M115083</link>
    <description>but it is showing an error.&lt;BR /&gt;ERROR: BY variables are not properly sorted on data set WORK.A.&lt;BR /&gt;</description>
    <pubDate>Wed, 18 Apr 2018 09:40:59 GMT</pubDate>
    <dc:creator>sathya66</dc:creator>
    <dc:date>2018-04-18T09:40:59Z</dc:date>
    <item>
      <title>avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455066#M115071</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I want to avoid sorting while doing merge because my below tables are already in sorting order. I think index will help but I am not sure.&lt;/P&gt;&lt;P&gt;or is there any method if the tables are already in sorting order then merge or sort kind of approach.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=a ;
			by id;
		run;

		proc sort data=b;
			by id;
		run;

		data b;
			merge  a(in=a) b(in=b);
					by id;
					if a=b ;
		run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SS&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455066#M115071</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T09:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455071#M115074</link>
      <description>&lt;P&gt;If your data sets are already in order, you don't need to run PROC SORT.&amp;nbsp; Just proceed directly to the DATA step with MERGE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The BY statement requires a data set that is in order.&amp;nbsp; It doesn't matter how the data set came to be in order.&amp;nbsp; It does not require sorting, if the data set is already in order.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455071#M115074</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-18T09:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455073#M115075</link>
      <description>&lt;P&gt;Maxim 2: Read the log. If the tables are already sorted as you need them, this will show in the log. Then no additional sorting needs to be done.&lt;/P&gt;
&lt;P&gt;Indexes only improve performance if they can be used to select small subsets of data; in whole-dataset joins like yours they usually worsen overall performance.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455073#M115075</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T09:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455078#M115078</link>
      <description>&lt;P&gt;Adding the option "presorted" to proc sort, will prevent datasets from being sorted if they are already sorted.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455078#M115078</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-04-18T09:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455084#M115083</link>
      <description>but it is showing an error.&lt;BR /&gt;ERROR: BY variables are not properly sorted on data set WORK.A.&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455084#M115083</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T09:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455089#M115084</link>
      <description>&lt;P&gt;If you are getting that error message, it means the observations are not in order.&amp;nbsp; Of course you need to run PROC SORT when the observations are not in order.&amp;nbsp; I thought you were asking if you could skip the PROC SORT when the data set was already in order.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455089#M115084</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-18T09:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: avoid sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455090#M115085</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93352"&gt;@sathya66&lt;/a&gt; wrote:&lt;BR /&gt;but it is showing an error.&lt;BR /&gt;ERROR: BY variables are not properly sorted on data set WORK.A.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then your dataset is NOT sorted.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/avoid-sorting/m-p/455090#M115085</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T09:43:04Z</dc:date>
    </item>
  </channel>
</rss>

