<?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 Developers</title>
    <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734307#M1165</link>
    <description>&lt;P&gt;Please show us example of your input data. Please show us the desired output.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 15:04:00 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-04-15T15:04:00Z</dc:date>
    <item>
      <title>Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734283#M1161</link>
      <description>&lt;P&gt;I want to display the number of project having x applications (in the dataset 1 row = 1 application, thats why I consider 1 ID_Project as 1 application) :&lt;/P&gt;&lt;PRE&gt;SELECT 
(CASE 
      WHEN COUNT(ID_Project) = 1 THEN 'Projects with 1 application'
      WHEN COUNT(ID_Project) = 2 THEN 'Projects with 2 applications'
      WHEN COUNT(ID_Project) = 3 THEN 'Projects with 3 applications'
      ELSE 'Projects with 3+ applications'
END), COUNT(ID_Project)
FROM TEST2

GROUP BY 
(CASE 
      WHEN COUNT(ID_Project) = 1 THEN 'Projects with 1 application'
      WHEN COUNT(ID_Project) = 2 THEN 'Projects with 2 applications'
      WHEN COUNT(ID_Project) = 3 THEN 'Projects with 3 applications'
      ELSE 'Projects with 3+ applications'
END); &lt;/PRE&gt;&lt;P&gt;I have the following error "Summary functions are restricted to the select and having clauses only". I know that I can't use count in the group by but I think Its mandatory if I want to have categories.&lt;/P&gt;&lt;P&gt;Thanks for your help !&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 14:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734283#M1161</guid>
      <dc:creator>Adir92</dc:creator>
      <dc:date>2021-04-15T14:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734284#M1162</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I want to display the number of project having x applications&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;PROC FREQ would be a whole lot easier.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value custf 1='Projects with 1 application'
         2='Projects with 2 applications'
         3='Projects with 3 applications'
         4-high='Projects with &amp;gt;3 applications';
run;
proc freq data=have;
     tables id_project;
     format id_project custf;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Apr 2021 14:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734284#M1162</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T14:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734296#M1163</link>
      <description>Thank you for your answer. I didn't now those procedures. But when we use proc format, aren't we subtituting the values of 1,2,3... on our table with the string ? Because I don't have such values</description>
      <pubDate>Thu, 15 Apr 2021 14:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734296#M1163</guid>
      <dc:creator>Adir92</dc:creator>
      <dc:date>2021-04-15T14:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734297#M1164</link>
      <description>I tried the code and it returns the number of applications for each project. But I want the number of projects that have 1,2,3... applications. Its like 4 rows and 2 columns for the output.</description>
      <pubDate>Thu, 15 Apr 2021 14:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734297#M1164</guid>
      <dc:creator>Adir92</dc:creator>
      <dc:date>2021-04-15T14:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734307#M1165</link>
      <description>&lt;P&gt;Please show us example of your input data. Please show us the desired output.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734307#M1165</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T15:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734316#M1166</link>
      <description>&lt;P&gt;Its a very confidential dataset but I made an exemple table that looks pretty similar with the required columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table :&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tableTEST2.PNG" style="width: 127px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57900iF9FF0D03ED1CE6DD/image-dimensions/127x224?v=v2" width="127" height="224" role="button" title="tableTEST2.PNG" alt="tableTEST2.PNG" /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Nbr Projects&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Projects with 1 application&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Projects with 2 applications&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Projects with 3 applications&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Projects with &amp;gt;3 applications&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734316#M1166</guid>
      <dc:creator>Adir92</dc:creator>
      <dc:date>2021-04-15T15:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734319#M1167</link>
      <description>&lt;P&gt;So project 1000 has 8 applications and project 5000 has 2 applications? I think using PROC FREQ twice gets you what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value custf 1='Projects with 1 application'
         2='Projects with 2 applications'
         3='Projects with 3 applications'
         4-high='Projects with &amp;gt;3 applications';
run;
proc freq data=have;
     tables id_project/noprint out=applications;
run;
proc freq data=applications;
     tables count;
     format count custf.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734319#M1167</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T15:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734320#M1168</link>
      <description>Exactly ! I tried the code. It tells me that the count variable is not found.&lt;BR /&gt;&lt;BR /&gt;PS: And in the data (data = ) variable I put the name of the dataset (test2) right ?</description>
      <pubDate>Thu, 15 Apr 2021 15:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734320#M1168</guid>
      <dc:creator>Adir92</dc:creator>
      <dc:date>2021-04-15T15:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Summary functions are restricted to the select and having clauses only</title>
      <link>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734322#M1169</link>
      <description>Its working ! Thanks you so much !</description>
      <pubDate>Thu, 15 Apr 2021 15:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734322#M1169</guid>
      <dc:creator>Adir92</dc:creator>
      <dc:date>2021-04-15T15:39: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/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734323#M1170</link>
      <description>&lt;P&gt;Good news!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Summary-functions-are-restricted-to-the-select-and-having/m-p/734323#M1170</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T15:42:58Z</dc:date>
    </item>
  </channel>
</rss>

