<?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: PROC SQL AND BLANK RECORDS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53968#M14950</link>
    <description>Try to do your count as a sub-query in the from clause:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select  'How many widgets' as description, countx&lt;BR /&gt;
from (select count (*) as countx from z);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
    <pubDate>Wed, 15 Oct 2008 10:30:06 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2008-10-15T10:30:06Z</dc:date>
    <item>
      <title>PROC SQL AND BLANK RECORDS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53967#M14949</link>
      <description>I use SAS SQL to test for exceptions to rules that produce a count. I do this by building a string variable that contains text describing the exception with another variable that contains the exception count.&lt;BR /&gt;
This is all done within the one SQL statement:&lt;BR /&gt;
eg:&lt;BR /&gt;
SELECT 'How many widgits' as DESCRIPTION,&lt;BR /&gt;
COUNT (*)  AS COUNTX&lt;BR /&gt;
from z&lt;BR /&gt;
&lt;BR /&gt;
DESCRIPTION                     COUNTX&lt;BR /&gt;
How many widgits                 10&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The issue I have is when the count is zero the SQL produces no values or zero observations.&lt;BR /&gt;
I'd like to know how to keep the column description but have the count set to zero.</description>
      <pubDate>Wed, 15 Oct 2008 08:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53967#M14949</guid>
      <dc:creator>yunnan</dc:creator>
      <dc:date>2008-10-15T08:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL AND BLANK RECORDS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53968#M14950</link>
      <description>Try to do your count as a sub-query in the from clause:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select  'How many widgets' as description, countx&lt;BR /&gt;
from (select count (*) as countx from z);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 15 Oct 2008 10:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53968#M14950</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-10-15T10:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL AND BLANK RECORDS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53969#M14951</link>
      <description>On the other hand, if your only wish is to see how many records there are in certain table, reading the table metadata is more efficient than doing a table scan by using count(*):&lt;BR /&gt;
&lt;BR /&gt;
%let dsid=%sysfunc(open(Z));&lt;BR /&gt;
%put How many widgets: %sysfunc(attrn(&amp;amp;dsid,NOBS));&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 15 Oct 2008 10:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-AND-BLANK-RECORDS/m-p/53969#M14951</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-10-15T10:56:59Z</dc:date>
    </item>
  </channel>
</rss>

