<?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 SQL Left join and order by in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/226124#M40663</link>
    <description>&lt;P&gt;you say "Currently the implementation of proc sql without an order by variable will tend to order data by the values of the varaibles as they appear on the Select clause"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You mean that : sas will order the final data by the variables in select clause ?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2015 19:54:56 GMT</pubDate>
    <dc:creator>LineMoon</dc:creator>
    <dc:date>2015-09-17T19:54:56Z</dc:date>
    <item>
      <title>Proc SQL Left join and order by</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225948#M40615</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to write this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table test as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; t1.*, t2.v&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp; t1 left join t2&lt;/P&gt;&lt;P&gt;&amp;nbsp; on t1.w=t2.w;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any mather , if I do not use " order by ...", an other mean, sas can give any false result ?&lt;/P&gt;&lt;P&gt;if we do not write&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table test as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; t1.*, t2.v&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp; t1 left join t2&lt;/P&gt;&lt;P&gt;&amp;nbsp; on t1.w=t2.w&lt;/P&gt;&lt;P&gt;&amp;nbsp; order by m1,&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If yes, please can you give some exemples ?&lt;/P&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;</description>
      <pubDate>Wed, 16 Sep 2015 21:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225948#M40615</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2015-09-16T21:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Left join and order by</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225956#M40618</link>
      <description>&lt;P&gt;The presence or lack of an "order by" statement in SQL will not affect the number of observations&amp;nbsp;in the output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above statement would be true, in a join even if you "ORDER BY"&amp;nbsp;a variable that is not in the output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if you added something weird, like " &lt;FONT face="courier new,courier"&gt;ORDER BY monotonic(), ranuni(123)&lt;/FONT&gt; ", it should not affect the number of&amp;nbsp;&lt;SPAN&gt;observations in the output dataset.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 22:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225956#M40618</guid>
      <dc:creator>hbi</dc:creator>
      <dc:date>2015-09-16T22:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Left join and order by</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225958#M40619</link>
      <description>&lt;P&gt;I am not sure that I understand what you mean by "false result";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently the implementation of proc sql without an order by variable will tend to order data by the values of the varaibles as they appear on the Select clause. The order of set T1 in your example may not be the order it had going in.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 22:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225958#M40619</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-16T22:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Left join and order by</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225966#M40620</link>
      <description>&lt;P&gt;Your code works as is! The only problem might be if v and m1 are in both datasets. However, the result of either run wouldn't be false in such cases, just not what you might have expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 22:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225966#M40620</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-09-16T22:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Left join and order by</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225984#M40622</link>
      <description>&lt;P&gt;It might only be a transcription typo but the comma after &lt;STRONG&gt;m1&lt;/STRONG&gt; should be a semicolon. Otherwise, &lt;STRONG&gt;proc SQL&lt;/STRONG&gt; will be looking for a variable named &lt;STRONG&gt;quit&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 01:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/225984#M40622</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-09-17T01:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Left join and order by</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/226124#M40663</link>
      <description>&lt;P&gt;you say "Currently the implementation of proc sql without an order by variable will tend to order data by the values of the varaibles as they appear on the Select clause"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You mean that : sas will order the final data by the variables in select clause ?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 19:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Left-join-and-order-by/m-p/226124#M40663</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2015-09-17T19:54:56Z</dc:date>
    </item>
  </channel>
</rss>

