<?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: Exit a SAS script based on a condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230936#M41957</link>
    <description>Thanks for both options. I will take a look at both.</description>
    <pubDate>Wed, 21 Oct 2015 13:30:19 GMT</pubDate>
    <dc:creator>tstjean</dc:creator>
    <dc:date>2015-10-21T13:30:19Z</dc:date>
    <item>
      <title>Exit a SAS script based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230900#M41950</link>
      <description>&lt;P&gt;I want to be able to check if a SAS dataset has any observations.&lt;/P&gt;&lt;P&gt;It is has 0 observations, I want to exit the SAS script.&lt;/P&gt;&lt;P&gt;Any suggestions on what I would do?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 12:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230900#M41950</guid>
      <dc:creator>tstjean</dc:creator>
      <dc:date>2015-10-21T12:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Exit a SAS script based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230906#M41951</link>
      <description>&lt;P&gt;You can write a macro that only executes more code if the number of observations is &amp;gt; 0, and it stops executing if the number of observations is = 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro example;
    proc sql noprint;
        select count(variablename) into :nobs from datasetname;
    quit;
    %if &amp;amp;nobs&amp;gt;0 %then %do;
             .... whatever SAS code you want ....
    %end;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2015 12:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230906#M41951</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-21T12:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Exit a SAS script based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230930#M41955</link>
      <description>&lt;P&gt;There are various ways to check the obs, the previous comment contains one. &amp;nbsp;To exit a sas script the abort statement is probably an option for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000230210.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000230210.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 13:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230930#M41955</guid>
      <dc:creator>ChrisWard</dc:creator>
      <dc:date>2015-10-21T13:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Exit a SAS script based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230936#M41957</link>
      <description>Thanks for both options. I will take a look at both.</description>
      <pubDate>Wed, 21 Oct 2015 13:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230936#M41957</guid>
      <dc:creator>tstjean</dc:creator>
      <dc:date>2015-10-21T13:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Exit a SAS script based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230962#M41962</link>
      <description>&lt;P&gt;To me, that sounds like a bad idea. &amp;nbsp;Personally, if your code doesn't create anything then there should be some defensive coding which creates and outpu stating there is no results. &amp;nbsp;Any abort/abend in code I use is pulled out as a problem, code should flow through without any errors, warnings, abnormal exits, and the final output should be qc'able even if only to confirm zero observations.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 14:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exit-a-SAS-script-based-on-a-condition/m-p/230962#M41962</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-21T14:21:29Z</dc:date>
    </item>
  </channel>
</rss>

