<?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: count(*) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847196#M334960</link>
    <description>&lt;P&gt;sorry it should be a semi-colon&lt;/P&gt;
&lt;P&gt;assuming no code typo, what should count(*) for each row?&lt;/P&gt;</description>
    <pubDate>Thu, 01 Dec 2022 05:37:31 GMT</pubDate>
    <dc:creator>HeatherNewton</dc:creator>
    <dc:date>2022-12-01T05:37:31Z</dc:date>
    <item>
      <title>count(*)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847185#M334955</link>
      <description>&lt;PRE&gt;PROC SQL;
   create table summary_ead_&amp;amp;p_yymmdd as
   select portfolio, product, ead,
       sum(ccf*rel_cnt)/sum(rel_cnt) as dcwccf
       avg(ccf) as dawccf
       count(*) as cnt
   from acct_list_final_&amp;amp;P_yymmdd
where ead in ('PHI','ALP')
   group by portfolio, product, ead,
quit;
 &lt;/PRE&gt;
&lt;P&gt;cnt= count(*) - no of rows in dataset&lt;/P&gt;
&lt;P&gt;but there is a clause 'where ead in ('PHI', 'ALP')'&lt;/P&gt;
&lt;P&gt;so does count(*) include only those fulfilling where ead in ('PHI', 'ALP') or&lt;/P&gt;
&lt;P&gt;all rows in dataset acct_list_final_&amp;amp;P_yymmdd regardless of where statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 02:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count/m-p/847185#M334955</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-12-01T02:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: count(*)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847186#M334956</link>
      <description>Only rows with the right values for ead get counted.  The same applies across the board.  Only rows with the right values for ead get used to compute sums, means, counts.</description>
      <pubDate>Thu, 01 Dec 2022 02:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count/m-p/847186#M334956</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-12-01T02:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: count(*)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847187#M334957</link>
      <description>So for each row cnt=1 or cnt=total no of row in whole table fulfiling the ead condition?</description>
      <pubDate>Thu, 01 Dec 2022 03:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count/m-p/847187#M334957</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-12-01T03:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: count(*)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847192#M334958</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;PROC SQL;
   create table summary_ead_&amp;amp;p_yymmdd as
   select portfolio, product, ead,
       sum(ccf*rel_cnt)/sum(rel_cnt) as dcwccf
       avg(ccf) as dawccf
       count(*) as cnt
   from acct_list_final_&amp;amp;P_yymmdd
where ead in ('PHI','ALP')
   group by portfolio, product, ead,
quit;
 &lt;/PRE&gt;
&lt;P&gt;cnt= count(*) - no of rows in dataset&lt;/P&gt;
&lt;P&gt;but there is a clause 'where ead in ('PHI', 'ALP')'&lt;/P&gt;
&lt;P&gt;so does count(*) include only those fulfilling where ead in ('PHI', 'ALP') or&lt;/P&gt;
&lt;P&gt;all rows in dataset acct_list_final_&amp;amp;P_yymmdd regardless of where statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If that is the actual code you submitted the comma after Ead in the Group by is going to cause problems. See this LOG from similar code:&lt;/P&gt;
&lt;PRE&gt;109  proc sql;
110     select sex,age, mean(height) as mheight
111     from sashelp.class
112     group by sex,age,
113  quit;
ERROR: The following columns were not found in the contributing tables: quit.
&lt;/PRE&gt;
&lt;P&gt;So your output could have nothing because the comma before Quit isn't going to allow anything much to happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 04:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count/m-p/847192#M334958</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-01T04:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: count(*)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847196#M334960</link>
      <description>&lt;P&gt;sorry it should be a semi-colon&lt;/P&gt;
&lt;P&gt;assuming no code typo, what should count(*) for each row?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 05:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count/m-p/847196#M334960</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-12-01T05:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: count(*)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count/m-p/847197#M334962</link>
      <description>&lt;P&gt;COUNT(*) counts&amp;nbsp;&lt;U&gt;all&lt;/U&gt; rows; if a GROUP BY is present, the summary functions (of which COUNT is one) will calculate for each group, otherwise for the whole dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 06:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count/m-p/847197#M334962</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-01T06:31:43Z</dc:date>
    </item>
  </channel>
</rss>

