<?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: How to exit if a dataset did not have any records in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641794#M191354</link>
    <description>&lt;P&gt;Tom, thanks for your reply. I was able to resolve it by doing below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;proc sql noprint;
select count(*) into :nobs 
from test 
where custrun  =  "&amp;amp;custrun.";
quit;

%if &amp;amp;nobs = 0 %then %do;

%goto exitgoto;
%end;&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 22 Apr 2020 01:53:09 GMT</pubDate>
    <dc:creator>SASMom2</dc:creator>
    <dc:date>2020-04-22T01:53:09Z</dc:date>
    <item>
      <title>How to exit if a dataset did not have any records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641777#M191346</link>
      <description>&lt;P&gt;I have a code that creates 3,000 individual excel reports through ODS Tagsets in SAS.&amp;nbsp;Some of them&amp;nbsp;are created even if there is not data in the source dataset. So, when you open the&amp;nbsp;excel report there is no data in it.&lt;/P&gt;&lt;P&gt;I do not want to create the excel report if there is no data in the dataset.&lt;/P&gt;&lt;P&gt;How do I program that?&lt;/P&gt;&lt;P&gt;I tired to copy my table but for some reason I could not do it so I do not have any table to show you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 23:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641777#M191346</guid>
      <dc:creator>SASMom2</dc:creator>
      <dc:date>2020-04-21T23:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to exit if a dataset did not have any records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641791#M191353</link>
      <description>&lt;P&gt;Most report steps don't make any output when the input data is empty so seeing HOW you are making the report is important.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think the table (if by table you mean the report you are producing) matters that much.&amp;nbsp; The code is more important.&amp;nbsp; And to understand the code it might help to show some sample of the DATASET(s).&amp;nbsp; To show data just post a simple data step that recreates the data. That way the type/length and any formats attached to the variables are clear.&amp;nbsp; Make sure to use the Insert SAS Code button to get a pop-up window to paste/type/edit your code so that formatting is preserved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 01:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641791#M191353</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-22T01:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to exit if a dataset did not have any records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641794#M191354</link>
      <description>&lt;P&gt;Tom, thanks for your reply. I was able to resolve it by doing below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;proc sql noprint;
select count(*) into :nobs 
from test 
where custrun  =  "&amp;amp;custrun.";
quit;

%if &amp;amp;nobs = 0 %then %do;

%goto exitgoto;
%end;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Apr 2020 01:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-exit-if-a-dataset-did-not-have-any-records/m-p/641794#M191354</guid>
      <dc:creator>SASMom2</dc:creator>
      <dc:date>2020-04-22T01:53:09Z</dc:date>
    </item>
  </channel>
</rss>

