<?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 Sas stopping on first error and print an external log in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841208#M332606</link>
    <description>&lt;P&gt;So I would like a macro that upon finding the first error when running a project to stop all processes downstream and immediately print an external log. So far I have used the macro that looks like this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%macro check_for_errors;
   %if &amp;amp;syserr &amp;gt; 0 %then %do;
      endsas;
   %end;
%mend check_for_errors;

data test1;
    &amp;lt;data step code&amp;gt;
run;
%check_for_errors;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Currently it will continue with further process the downstream items and include that in the external log. I would like it to after it encounters that first error to stop it and have that error be the last thing it prints to the&amp;nbsp;external log to make debugging easier.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I also have in the project property settings to stop all items on errors during execution.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Oct 2022 18:44:54 GMT</pubDate>
    <dc:creator>colinbarker2</dc:creator>
    <dc:date>2022-10-27T18:44:54Z</dc:date>
    <item>
      <title>Sas stopping on first error and print an external log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841208#M332606</link>
      <description>&lt;P&gt;So I would like a macro that upon finding the first error when running a project to stop all processes downstream and immediately print an external log. So far I have used the macro that looks like this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%macro check_for_errors;
   %if &amp;amp;syserr &amp;gt; 0 %then %do;
      endsas;
   %end;
%mend check_for_errors;

data test1;
    &amp;lt;data step code&amp;gt;
run;
%check_for_errors;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Currently it will continue with further process the downstream items and include that in the external log. I would like it to after it encounters that first error to stop it and have that error be the last thing it prints to the&amp;nbsp;external log to make debugging easier.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I also have in the project property settings to stop all items on errors during execution.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 18:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841208#M332606</guid>
      <dc:creator>colinbarker2</dc:creator>
      <dc:date>2022-10-27T18:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sas stopping on first error and print a log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841211#M332607</link>
      <description>&lt;P&gt;I'm confused, I would think ENDSAS would end the session immediately and get what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share the log you get when there is an error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also want to look into the ABORT statement as an alternative to ENDSAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 18:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841211#M332607</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-10-27T18:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sas stopping on first error and print an external log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841213#M332608</link>
      <description>&lt;P&gt;If you are only running SAS code, then it would be a whole lot easier to run the program in batch mode with the ERRORABEND option set (Add options errorabend; as the first statement in the rpiogram). No checking for errors is required and a SAS log is produced and the program will stop running when the first error is encountered.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 19:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-stopping-on-first-error-and-print-an-external-log/m-p/841213#M332608</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-10-27T19:08:59Z</dc:date>
    </item>
  </channel>
</rss>

