<?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: recognising empty datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33687#M6608</link>
    <description>Do you need to know if a table currently has 0 obs?  0 variables? or do you need to know that a given logical expression will produce no observations for a given data set?</description>
    <pubDate>Mon, 15 Nov 2010 01:48:26 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2010-11-15T01:48:26Z</dc:date>
    <item>
      <title>recognising empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33686#M6607</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
The way I've setup my program I extract subsets of data (as tables) from a large dataset. Sometimes these tables are completely empty. Its become a problem since I output these tables onto a pdf and I can sometimes have a number of empty tables.&lt;BR /&gt;
&lt;BR /&gt;
My question is, is there a way to recognise that the entire table is empty so I could skip outputing this table and go to the next?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Sachin</description>
      <pubDate>Mon, 15 Nov 2010 01:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33686#M6607</guid>
      <dc:creator>SachinRuk</dc:creator>
      <dc:date>2010-11-15T01:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: recognising empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33687#M6608</link>
      <description>Do you need to know if a table currently has 0 obs?  0 variables? or do you need to know that a given logical expression will produce no observations for a given data set?</description>
      <pubDate>Mon, 15 Nov 2010 01:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33687#M6608</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-11-15T01:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: recognising empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33688#M6609</link>
      <description>well its more that all the values are 'missing'. So to me its zero observations but thats not how SAS perceives it. &lt;BR /&gt;
&lt;BR /&gt;
Mind you that proc gplot doesnt attempt to give me an empty graph, simply doesnt plot altogether (which is what I want).&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Sachin

Message was edited by: SachinRuk</description>
      <pubDate>Mon, 15 Nov 2010 02:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33688#M6609</guid>
      <dc:creator>SachinRuk</dc:creator>
      <dc:date>2010-11-15T02:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: recognising empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33689#M6610</link>
      <description>there is a macro in the SAS Autocall library called obsnvars which returns the number of observations and number of variables as values of macro variables that you can then test and take action based on the values.  snippet from some code where it is in use here&lt;BR /&gt;
&lt;BR /&gt;
%obsnvars(CST.&amp;amp;&amp;amp;tablename&amp;amp;i);&lt;BR /&gt;
%if &amp;amp;nobs GT 0&lt;BR /&gt;
    %then %do;&lt;BR /&gt;
				proc sql noprint;&lt;BR /&gt;
				create table max_date as&lt;BR /&gt;
				select&lt;BR /&gt;
				"&amp;amp;&amp;amp;tablename&amp;amp;i" length=50 as table_name&lt;BR /&gt;
				,max(extracteddate) as max_extracteddate&lt;BR /&gt;
				from CST.&amp;amp;&amp;amp;tablename&amp;amp;i&lt;BR /&gt;
				;&lt;BR /&gt;
				quit;&lt;BR /&gt;
				data all_table_dates;&lt;BR /&gt;
				  set all_table_dates&lt;BR /&gt;
				      max_date &lt;BR /&gt;
				  ;&lt;BR /&gt;
				run;&lt;BR /&gt;
	          %end;&lt;BR /&gt;
%end;</description>
      <pubDate>Mon, 15 Nov 2010 02:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33689#M6610</guid>
      <dc:creator>monei011</dc:creator>
      <dc:date>2010-11-15T02:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: recognising empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33690#M6611</link>
      <description>SachinRuk&lt;BR /&gt;
 &lt;BR /&gt;
While creating your subsets you might be able to collect what you seek more easily than after. &lt;BR /&gt;
Are you using SQL or a data step or just a where clause?&lt;BR /&gt;
Optimal solution depends on context. &lt;BR /&gt;
 &lt;BR /&gt;
HTH&lt;BR /&gt;
peterC</description>
      <pubDate>Mon, 15 Nov 2010 08:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recognising-empty-datasets/m-p/33690#M6611</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-11-15T08:19:00Z</dc:date>
    </item>
  </channel>
</rss>

