<?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: want to know the flow of below subquery in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396894#M66563</link>
    <description>&lt;P&gt;You can use the _method and _tree PROC SQL options to better understand how SAS performs the query.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 17:44:46 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2017-09-18T17:44:46Z</dc:date>
    <item>
      <title>want to know the flow of below subquery</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396811#M66560</link>
      <description>&lt;P&gt;below query finding the third highest mark holder&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data abc1;&lt;BR /&gt;input id name$ sal;&lt;BR /&gt;datalines;&lt;BR /&gt;10 a 5000&lt;BR /&gt;11 b 10000&lt;BR /&gt;12 c 10000&lt;BR /&gt;13 a 9000&lt;BR /&gt;14 b 11000&lt;BR /&gt;15 c 4000&lt;BR /&gt;16 a 5800&lt;BR /&gt;17 b 11000&lt;BR /&gt;18 c 12000&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select * from abc1 as e1&lt;BR /&gt;where 2=(select count(distinct sal) from abc1 as e2 where e2.sal&amp;lt;e1.sal and e2.name=e1.name);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to know the flow of this query. how second dataset is created and how the inner where clause is exected before executing the outer loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 14:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396811#M66560</guid>
      <dc:creator>himanshu1</dc:creator>
      <dc:date>2017-09-18T14:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: want to know the flow of below subquery</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396853#M66562</link>
      <description>&lt;P&gt;Without a "create table" there is no second data set. The "select * from abc1 as e1" creates an alias to reference one instance of the data set abc1 as does the "select count(distinct sal) from abc1 as e2&amp;nbsp;" which creates an alias of the count of distinct values from abc1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Parantheses control order of operations in queries similar to within caluculations; the innermost set of () is resolved to send to the part outside for use.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 15:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396853#M66562</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-18T15:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: want to know the flow of below subquery</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396894#M66563</link>
      <description>&lt;P&gt;You can use the _method and _tree PROC SQL options to better understand how SAS performs the query.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 17:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396894#M66563</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-09-18T17:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: want to know the flow of below subquery</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396999#M66564</link>
      <description>&lt;P&gt;Small world -&amp;nbsp;&lt;A title="link" href="https://communities.sas.com/t5/Base-SAS-Programming/Self-join-in-SAS/m-p/394631" target="_self"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Self-join-in-SAS/m-p/394631&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Anyways, you can always break the query (and the subquery) into separate create tables. &amp;nbsp;That way, you will see went and what has been done. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 02:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/want-to-know-the-flow-of-below-subquery/m-p/396999#M66564</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-19T02:38:19Z</dc:date>
    </item>
  </channel>
</rss>

