<?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 Summary functions are restricted to the SELECT and HAVING clauses only ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591842#M169628</link>
    <description>&lt;P&gt;Hello Everyone , I had this Error While I was Trying to run this Code , can anyone give me first an explanation why i do get it and then a hand to resolve it , that would be Great , Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create Table Proof as 
select c.id_user_uni , c.division_id as division_id , ro.cod as matr, count(*) as cont
      from Ods.R_Ord o
	  inner join DMC.cust c
	   on user_id = user_ID_dup
	  inner join ods.R_r ro
	   on ro.ordi_id = o.id_ordi AND RO.SERVICE = 0
	  inner join ods.R_matr m
	   on ro.matr_id = id_matrvand flag = 0
	  group by 
	      ID_User_Uni,
		  C.division_ID,
		  Ro.Cod
	      Having Count(*) &amp;gt; 1 
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This first Query Fine For me , the problem lies in this one :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create Table Transpo as 
select id_user_uni, division_id, sum(cont) as tot_items_ident, max(cont) as max_items_ident
from Proof 
group by
      Id_User_Uni,
      Divisione_ID
Order by 
      Sum(Conta) DESC
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2019 12:26:57 GMT</pubDate>
    <dc:creator>Midi</dc:creator>
    <dc:date>2019-09-26T12:26:57Z</dc:date>
    <item>
      <title>Summary functions are restricted to the SELECT and HAVING clauses only ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591842#M169628</link>
      <description>&lt;P&gt;Hello Everyone , I had this Error While I was Trying to run this Code , can anyone give me first an explanation why i do get it and then a hand to resolve it , that would be Great , Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create Table Proof as 
select c.id_user_uni , c.division_id as division_id , ro.cod as matr, count(*) as cont
      from Ods.R_Ord o
	  inner join DMC.cust c
	   on user_id = user_ID_dup
	  inner join ods.R_r ro
	   on ro.ordi_id = o.id_ordi AND RO.SERVICE = 0
	  inner join ods.R_matr m
	   on ro.matr_id = id_matrvand flag = 0
	  group by 
	      ID_User_Uni,
		  C.division_ID,
		  Ro.Cod
	      Having Count(*) &amp;gt; 1 
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This first Query Fine For me , the problem lies in this one :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create Table Transpo as 
select id_user_uni, division_id, sum(cont) as tot_items_ident, max(cont) as max_items_ident
from Proof 
group by
      Id_User_Uni,
      Divisione_ID
Order by 
      Sum(Conta) DESC
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 12:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591842#M169628</guid>
      <dc:creator>Midi</dc:creator>
      <dc:date>2019-09-26T12:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the SELECT and HAVING clauses only ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591845#M169629</link>
      <description>&lt;P&gt;Try to assign that in SELECT clause and DROP later&amp;nbsp; i.e&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create Table Transpo(drop=temp) as 
select id_user_uni, division_id, sum(cont) as tot_items_ident, max(cont) as max_items_ident,    Sum(Conta) as temp
from Proof 
group by
      Id_User_Uni,
      Divisione_ID
Order by 
      temp DESC
 ;
quit;&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;</description>
      <pubDate>Thu, 26 Sep 2019 12:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591845#M169629</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-26T12:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the SELECT and HAVING clauses only ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591846#M169630</link>
      <description>&lt;P&gt;Thank's That Worked Perfectly&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 12:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/591846#M169630</guid>
      <dc:creator>Midi</dc:creator>
      <dc:date>2019-09-26T12:37:23Z</dc:date>
    </item>
  </channel>
</rss>

