<?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 is giving me one extra row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495684#M130872</link>
    <description>&lt;P&gt;And how will we tell from that?&amp;nbsp; Provide test data in the form of a datastep!&lt;/P&gt;
&lt;P&gt;The sql looks wrong to me, you are using distinct, and counting with a where clause.&amp;nbsp; Seems to be counter intuitive.&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table nat_1 as
  select loc_nat,
         count(mbr_id) as other
  from   employee4
  group by loc_nt
  having loc_nat="National";
quit;&lt;/PRE&gt;</description>
    <pubDate>Fri, 14 Sep 2018 13:57:08 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-09-14T13:57:08Z</dc:date>
    <item>
      <title>Count is giving me one extra row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495680#M130868</link>
      <description>&lt;P&gt;I am reading a SAS data set in PROC SQL and using COUNT. It is giving me one extra count - I suspect it is counting the header as well. How do I fix this ?&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Nat_1 AS&lt;BR /&gt;SELECT DISTINCT Loc_Nat,&lt;BR /&gt;COUNT(MBR_ID) AS Other&lt;BR /&gt;FROM Employee4&lt;BR /&gt;WHERE Loc_Nat = 'National'&amp;nbsp;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495680#M130868</guid>
      <dc:creator>VarunD</dc:creator>
      <dc:date>2018-09-14T13:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count is giving me one extra row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495684#M130872</link>
      <description>&lt;P&gt;And how will we tell from that?&amp;nbsp; Provide test data in the form of a datastep!&lt;/P&gt;
&lt;P&gt;The sql looks wrong to me, you are using distinct, and counting with a where clause.&amp;nbsp; Seems to be counter intuitive.&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table nat_1 as
  select loc_nat,
         count(mbr_id) as other
  from   employee4
  group by loc_nt
  having loc_nat="National";
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495684#M130872</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-14T13:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count is giving me one extra row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495700#M130883</link>
      <description>&lt;P&gt;Please post a sample of what you 'HAVE' and what your desired output 'WANT'&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 14:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495700#M130883</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-14T14:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Count is giving me one extra row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495709#M130888</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194984"&gt;@VarunD&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am reading a SAS data set in PROC SQL and using COUNT. It is giving me one extra count - I suspect it is counting the header as well. How do I fix this ?&lt;/P&gt;
&lt;P&gt;Here's the code:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Nat_1 AS&lt;BR /&gt;SELECT DISTINCT Loc_Nat,&lt;BR /&gt;COUNT(MBR_ID) AS Other&lt;BR /&gt;FROM Employee4&lt;BR /&gt;WHERE Loc_Nat = 'National'&amp;nbsp;&lt;BR /&gt;QUIT;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The "header" would only get counted if you imported the header as a value for the variables.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 14:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495709#M130888</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-14T14:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count is giving me one extra row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495715#M130894</link>
      <description>I am sorry, I found the issue with the data. Thanks for your response!</description>
      <pubDate>Fri, 14 Sep 2018 14:57:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495715#M130894</guid>
      <dc:creator>VarunD</dc:creator>
      <dc:date>2018-09-14T14:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count is giving me one extra row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495716#M130895</link>
      <description>Sorry the issue was with data. I found it. Thanks!</description>
      <pubDate>Fri, 14 Sep 2018 14:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-is-giving-me-one-extra-row/m-p/495716#M130895</guid>
      <dc:creator>VarunD</dc:creator>
      <dc:date>2018-09-14T14:57:25Z</dc:date>
    </item>
  </channel>
</rss>

