<?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: Check if the table is empty in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6442#M633</link>
    <description>That's cool, but I don't like to be depended of this "dictionary"... Ofcourse, it's up to you... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Mon, 21 Jan 2008 15:53:05 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-01-21T15:53:05Z</dc:date>
    <item>
      <title>Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6439#M630</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I'm looking for a simple solution to check is table empty or not.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Mon, 21 Jan 2008 12:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6439#M630</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-01-21T12:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6440#M631</link>
      <description>I have a solution! I think this is the best one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;data _null_;&lt;BR /&gt;
	call symput('obscnt',0);&lt;BR /&gt;
	set work.out;&lt;BR /&gt;
	call symput('obscnt',_n_);&lt;BR /&gt;
	stop;&lt;BR /&gt;
run;&lt;BR /&gt;
	&lt;BR /&gt;
%If &amp;amp;obscnt=0 %then %do;&lt;BR /&gt;
    %put 'There are no records in a dataset.';&lt;BR /&gt;
%end;&lt;/B&gt;</description>
      <pubDate>Mon, 21 Jan 2008 14:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6440#M631</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-01-21T14:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6441#M632</link>
      <description>Here's an alternate solution:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	select "# of Obs in WORK.OUT: ", nobs &lt;BR /&gt;
	from dictionary.tables&lt;BR /&gt;
	where libname='WORK'&lt;BR /&gt;
	and memname = 'OUT';&lt;BR /&gt;
quit;</description>
      <pubDate>Mon, 21 Jan 2008 15:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6441#M632</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2008-01-21T15:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6442#M633</link>
      <description>That's cool, but I don't like to be depended of this "dictionary"... Ofcourse, it's up to you... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 21 Jan 2008 15:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6442#M633</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-01-21T15:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6443#M634</link>
      <description>Why don't you like to depend upon the "dictionary" tables?  Unless you are using where clause in a proc or data step, the information provided by the dictionary tables is as good as SAS is.</description>
      <pubDate>Tue, 22 Jan 2008 17:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6443#M634</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2008-01-22T17:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6444#M635</link>
      <description>Some people seem to have the impression that querying the Dictionary views is a slow process.  In all cases I have seen, this is a result of poorly constructed SQL code and a SAS session that includes foreign (Sql server, Oracle, DB2 etc) libraries.&lt;BR /&gt;
&lt;BR /&gt;
A well constructed SQL query such as that shown should have no performance issues.</description>
      <pubDate>Wed, 23 Jan 2008 06:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6444#M635</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-01-23T06:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6445#M636</link>
      <description>If people don't like querying dictionary tables (and I don't understand why not) you can always use the following code:&lt;BR /&gt;
&lt;BR /&gt;
        %LET dsid=%SYSFUNC(OPEN(work.dataset));&lt;BR /&gt;
        %LET nobs=%SYSFUNC(ATTRN(&amp;amp;dsid.,NOBS));&lt;BR /&gt;
        %LET rc=%SYSFUNC(CLOSE(&amp;amp;dsid.));&lt;BR /&gt;
&lt;BR /&gt;
The number of observations is then held in a macro variable [NOBS].&lt;BR /&gt;
&lt;BR /&gt;
%IF &amp;amp;Nobs. EQ 0 %THEN %DO; .... %END; etc. etc.

Message was edited by: LawrenceHW</description>
      <pubDate>Fri, 25 Jan 2008 10:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6445#M636</guid>
      <dc:creator>LawrenceHW</dc:creator>
      <dc:date>2008-01-25T10:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6446#M637</link>
      <description>This is an elegant solution and one that I use a lot.&lt;BR /&gt;
&lt;BR /&gt;
Just one warning that any %IF logic cannot be in open code -- but must be in a SAS Macro program. &lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 25 Jan 2008 17:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/6446#M637</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-01-25T17:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Check if the table is empty</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/373882#M2143</link>
      <description>Am try outed this but it shows as "There are no records in a dataset" also when the data set contain observation</description>
      <pubDate>Fri, 07 Jul 2017 10:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Check-if-the-table-is-empty/m-p/373882#M2143</guid>
      <dc:creator>Akhil_Vijayan</dc:creator>
      <dc:date>2017-07-07T10:54:49Z</dc:date>
    </item>
  </channel>
</rss>

