<?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: 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/603263#M174796</link>
    <description>&lt;P&gt;If I understand correctly, I am afraid summary functions are not permitted in an on clause, and so this complicates to further nest like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

Proc Sql;
Create Table Work.Tbl_Dt_Tip_Count(drop=min max) As
      Select
            Prep.Date
          , Prep.Name
          , Count(distinct Code || name || put(Year, 8.)) As Count
	  From
	     (
		    Select 
			      A.Date
			    , B.Name
				, B.Code
				, B.Year
		 From 
	          Work.Want_Day A
 	  Left join
	          (select *,min(dt_start) as min, max(Dt_end) as max) B
          
		  on   min&amp;lt;=Date&amp;lt;=max
		 
   ) Prep
      Group by

            Date
          , Name;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Nov 2019 15:59:43 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-11-11T15:59:43Z</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/603258#M174792</link>
      <description>&lt;P&gt;Hello Everyone , I Have This Block of code that i'm trying to run :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Sql;
Create Table Work.Tbl_Dt_Tip_Count As
      Select
            Prep.Date
          , Prep.Name
          , Count(distinct Code || name || put(Year, 8.)) As Count
	  From
	     (
		    Select 
			      A.Date
			    , B.Name
				, B.Code
				, B.Year
		 From 
	          Work.Want_Day A
 	  Left join
	          Ext_Data.Tbl_Date B
          
		  on  Date &amp;gt;= min(dt_start)
		  and Date &amp;lt;= Max(Dt_end)
   ) Prep
      Group by

            Date
          , Name
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but i ran onto this error :&lt;/P&gt;
&lt;P&gt;Summary functions are restricted to the SELECT and HAVING clauses only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any help would be much appreciated , thank u&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 15:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/603258#M174792</guid>
      <dc:creator>Midi</dc:creator>
      <dc:date>2019-11-11T15:52:33Z</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/603259#M174793</link>
      <description>&lt;P&gt;Does this run without error?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so you may have to break this out into two datasets and then do your count.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Sql;
Create Table Work.Tbl_Dt_Tip_Count As
      Select
            Prep.Date
          , Prep.Name
	  From
	     (
		    Select 
			      A.Date
			    , B.Name
				, B.Code
				, B.Year
		 From 
	          Work.Want_Day A
 	  Left join
	          Ext_Data.Tbl_Date B
          
		  on  Date &amp;gt;= min(dt_start)
		  and Date &amp;lt;= Max(Dt_end)
   ) Prep
      Group by

            Date
          , Name
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Nov 2019 15:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/603259#M174793</guid>
      <dc:creator>Krueger</dc:creator>
      <dc:date>2019-11-11T15:55:58Z</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/603263#M174796</link>
      <description>&lt;P&gt;If I understand correctly, I am afraid summary functions are not permitted in an on clause, and so this complicates to further nest like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

Proc Sql;
Create Table Work.Tbl_Dt_Tip_Count(drop=min max) As
      Select
            Prep.Date
          , Prep.Name
          , Count(distinct Code || name || put(Year, 8.)) As Count
	  From
	     (
		    Select 
			      A.Date
			    , B.Name
				, B.Code
				, B.Year
		 From 
	          Work.Want_Day A
 	  Left join
	          (select *,min(dt_start) as min, max(Dt_end) as max) B
          
		  on   min&amp;lt;=Date&amp;lt;=max
		 
   ) Prep
      Group by

            Date
          , Name;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Nov 2019 15:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summary-functions-are-restricted-to-the-SELECT-and-HAVING/m-p/603263#M174796</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-11T15:59:43Z</dc:date>
    </item>
  </channel>
</rss>

