<?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 SAS Enterprise Guide 4.3 Query Builder: Simple Count in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166128#M12791</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was attempting to use the query builder to get a two column summary table that showed the first column as the Age Group for my observations, and the second column being the number of times each age group shows up in the data.&amp;nbsp; Here was the code the query builder created:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATE TABLE WORK.QUERY_FOR_CUMULATIVE_W_AGEGROUP AS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT t1.AgeGroup, (Count(t1.AgeGroup)) AS COUNT_of_AgeGroup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM WORK.CUMULATIVE_W_AGEGROUP t1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP BY t1.AgeGroup;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I run this code, the counts aren't correct.&amp;nbsp; I can't figure out what it is trying to count, but they add up to 1,000.&amp;nbsp; I have over 2 million rows, and I checked the table it calls, and every row has an entry, so I'm not sure why the count is off.&amp;nbsp; I was able to get at the information using the summary table tools, but this technique is going to be important for me to use in other calculations.&amp;nbsp; Any thoughts on what's causing it not to work as expected?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Feb 2014 00:46:33 GMT</pubDate>
    <dc:creator>DrNO811</dc:creator>
    <dc:date>2014-02-07T00:46:33Z</dc:date>
    <item>
      <title>SAS Enterprise Guide 4.3 Query Builder: Simple Count</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166128#M12791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was attempting to use the query builder to get a two column summary table that showed the first column as the Age Group for my observations, and the second column being the number of times each age group shows up in the data.&amp;nbsp; Here was the code the query builder created:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATE TABLE WORK.QUERY_FOR_CUMULATIVE_W_AGEGROUP AS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT t1.AgeGroup, (Count(t1.AgeGroup)) AS COUNT_of_AgeGroup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM WORK.CUMULATIVE_W_AGEGROUP t1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP BY t1.AgeGroup;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I run this code, the counts aren't correct.&amp;nbsp; I can't figure out what it is trying to count, but they add up to 1,000.&amp;nbsp; I have over 2 million rows, and I checked the table it calls, and every row has an entry, so I'm not sure why the count is off.&amp;nbsp; I was able to get at the information using the summary table tools, but this technique is going to be important for me to use in other calculations.&amp;nbsp; Any thoughts on what's causing it not to work as expected?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 00:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166128#M12791</guid>
      <dc:creator>DrNO811</dc:creator>
      <dc:date>2014-02-07T00:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Enterprise Guide 4.3 Query Builder: Simple Count</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166129#M12792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the name of the input table . . . .perhaps you are accidentally querying an already pre-summarized or filtered table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a program node, make sure you have it set to run on the right server, and copy/paste and run (F8) the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table agg_count as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count ( * ) as obs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from cumulative_W_agegroup&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the counts are the same as the query you posted, then I suspect you are referencing the wrong table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 02:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166129#M12792</guid>
      <dc:creator>Fugue</dc:creator>
      <dc:date>2014-02-07T02:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Enterprise Guide 4.3 Query Builder: Simple Count</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166130#M12793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm afraid I don't have anything to add beyond what Fugue has said. It looks like the code should work, I don't see any reason why your results are wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Fugue says, make sure it's being run on the correct server, that's all I can think of.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 14:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166130#M12793</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-02-07T14:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Enterprise Guide 4.3 Query Builder: Simple Count</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166131#M12794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;You could try a different way to count your variable by creating a "listing" variable that is equal to 1, and then summing it up by the specific group.&lt;/P&gt;&lt;P&gt;1. Create a new variable using the "advanced expression" and enter: 1 &lt;/P&gt;&lt;P&gt;2. Name it as "listing".&lt;/P&gt;&lt;P&gt;3. Pick the "sum" function from the summery options.&lt;/P&gt;&lt;P&gt;It will count the correct amount of OBS like a charm &lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 12:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-4-3-Query-Builder-Simple-Count/m-p/166131#M12794</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2014-02-10T12:06:10Z</dc:date>
    </item>
  </channel>
</rss>

