<?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: Can any one help Why the error is coming? in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79036#M501</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If we do any aggregate function we can't implement any conditions using where clause. So that we use having clause to implement the condition.&lt;/P&gt;&lt;P&gt;if you assign a variable for the resultant value of aggregate function you have to use calculated in its condition part other wise you use the aggregate function in condition.The following coding is correct. Test it...&lt;/P&gt;&lt;P&gt;Proc sql;&lt;/P&gt;&lt;P&gt;Select id,sum(credit) from department group by id having sum(credit)&amp;gt;100;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2012 10:48:42 GMT</pubDate>
    <dc:creator>antony_allianz</dc:creator>
    <dc:date>2012-07-31T10:48:42Z</dc:date>
    <item>
      <title>PROC SQL returns ERROR: Summary functions are restricted to the SELECT and HAVING</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79034#M499</link>
      <description>&lt;P&gt;194 proc sql;&lt;/P&gt;
&lt;P&gt;195&amp;nbsp; select id, sum(no) as Total&lt;/P&gt;
&lt;P&gt;196&amp;nbsp; from one&lt;/P&gt;
&lt;P&gt;197&amp;nbsp; where calculated total &amp;gt; 100&lt;/P&gt;
&lt;P&gt;198&amp;nbsp; group by id;&lt;/P&gt;
&lt;P&gt;ERROR: Summary functions are restricted to the SELECT and HAVING clauses only.&lt;/P&gt;
&lt;P&gt;199&amp;nbsp; quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;u can find the one dataset in the attachment.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 18:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79034#M499</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2017-07-06T18:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can any one help Why the error is coming?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79035#M500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's how it should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select id, sum(no) as Total&lt;/P&gt;&lt;P&gt;&amp;nbsp; from one&lt;/P&gt;&lt;P&gt;&amp;nbsp; group by id&lt;/P&gt;&lt;P&gt;&amp;nbsp; having sum(no)&amp;gt; 100&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "where" clause gets executed before the "group by" but you would need the summed variable which only can be created as part of the grouping already in the where clause. That can't work and that's why the ERROR is telling you that you can't use a summary function in the where clause (that's where you try to use the calculated variable).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 08:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79035#M500</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-07-31T08:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can any one help Why the error is coming?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79036#M501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If we do any aggregate function we can't implement any conditions using where clause. So that we use having clause to implement the condition.&lt;/P&gt;&lt;P&gt;if you assign a variable for the resultant value of aggregate function you have to use calculated in its condition part other wise you use the aggregate function in condition.The following coding is correct. Test it...&lt;/P&gt;&lt;P&gt;Proc sql;&lt;/P&gt;&lt;P&gt;Select id,sum(credit) from department group by id having sum(credit)&amp;gt;100;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 10:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79036#M501</guid>
      <dc:creator>antony_allianz</dc:creator>
      <dc:date>2012-07-31T10:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Can any one help Why the error is coming?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79037#M502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do not use where before "group by". can not put "where" for summurized conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; proc sql;&lt;/P&gt;&lt;P&gt;select id, sum(no) as Total from one&lt;/P&gt;&lt;P&gt;group by id &lt;/P&gt;&lt;P&gt;having calculated total &amp;gt; 100;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 11:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79037#M502</guid>
      <dc:creator>yaswanthj</dc:creator>
      <dc:date>2012-07-31T11:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can any one help Why the error is coming?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79038#M503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "calculated" will be used only when you use a calculated member (variable), not a aggregation. To verify, you can used SAS Enterprise Guide. In your case it is not used, because having already say aggregation variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 12:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79038#M503</guid>
      <dc:creator>lacrefa</dc:creator>
      <dc:date>2012-07-31T12:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can any one help Why the error is coming?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79039#M504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry an error , from the original message its is only the () were missing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SELECT DISTINCT t1.No, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (COUNT(t1.Arm_Id)) AS COUNT_of_Arm_Id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM WORK.TWO AS t1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP BY t1.No&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt; HAVING &lt;SPAN style="text-decoration: underline;"&gt;(&lt;/SPAN&gt;CALCULATED COUNT_of_Arm_Id&lt;SPAN style="text-decoration: underline;"&gt;)&lt;/SPAN&gt; &amp;gt; 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 12:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/PROC-SQL-returns-ERROR-Summary-functions-are-restricted-to-the/m-p/79039#M504</guid>
      <dc:creator>lacrefa</dc:creator>
      <dc:date>2012-07-31T12:31:30Z</dc:date>
    </item>
  </channel>
</rss>

