<?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: Handling exit status  of sas Programs in UNIX shell wrapper in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919965#M362335</link>
    <description>&lt;P&gt;Works for me with the actual ABORT statement.&lt;/P&gt;
&lt;PRE&gt;&amp;gt;echo 'data _null_; abort 100; run;' &amp;gt; abort.sas
&amp;gt;sas -noautoexec abort.sas; echo rc=$?
rc=100
&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Mar 2024 16:07:06 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-03-12T16:07:06Z</dc:date>
    <item>
      <title>Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919445#M362151</link>
      <description>&lt;P&gt;sas_program= "test_sas.sas"&lt;/P&gt;&lt;P&gt;log_file ="test_sas.log"&lt;/P&gt;&lt;P&gt;sas $sas_program -log $log_file&lt;/P&gt;&lt;P&gt;if [$? -eq 0]; then&lt;/P&gt;&lt;P&gt;STATUS="success"&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;STATUS="failed"&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;# I would like to handle&amp;nbsp; the exit status of program completed execution as per&amp;nbsp; "%abort cancel" statements in sas program&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;# What will be the exit status if the program execution&amp;nbsp; ended due to "%abort cancel" or "%abort return"? The program is running on Linux.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 13:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919445#M362151</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-08T13:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919446#M362152</link>
      <description>&lt;P&gt;The documentation will tell you what it exit status should be, but since you've got a test program, probably easier to just test it out and see what you get.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 13:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919446#M362152</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-03-08T13:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919530#M362184</link>
      <description>&lt;P&gt;In the above code Exit status 2 is always a system reported sas error ?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 19:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919530#M362184</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-08T19:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919557#M362190</link>
      <description>&lt;P&gt;I believe so.&amp;nbsp; See this doc page:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p0h28whoxxvtztn15wqqvv9o41py.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p0h28whoxxvtztn15wqqvv9o41py.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 20:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919557#M362190</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-03-08T20:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919925#M362325</link>
      <description>&lt;P&gt;Not Solved yet&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 12:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919925#M362325</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-12T12:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919928#M362326</link>
      <description>&lt;P&gt;Save the status code into your own environment variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sas $sas_program -log $log_file
rc=$?
echo rc=$rc&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then try running different programs to see what return code you get.&lt;/P&gt;
&lt;P&gt;Try one with no warnings or errors. One with just warnings. One with errors.&amp;nbsp; One that used ABORT ABEND to force a return code.&lt;/P&gt;
&lt;LI-SPOILER&gt;If memory serves me you should find that 0 is returned when there are no warnings. 1 when there are warnings only and 2 when there are errors. And that you can use ABORT ABEND to return any other code you want.&lt;/LI-SPOILER&gt;</description>
      <pubDate>Tue, 12 Mar 2024 12:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919928#M362326</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T12:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919959#M362332</link>
      <description>&lt;P&gt;I have test th eprogram with %abort, %abort cancel , %abort return&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the program stopped execution after %abort cancel -- the exit status =2&lt;/P&gt;&lt;P&gt;For erros int he program, for example, I&amp;nbsp; made the the path to a dataset toa different location where the dataset does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thee&amp;nbsp; &amp;nbsp;exit stats was 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%abort return -- exit status =4&lt;/P&gt;&lt;P&gt;%abort exit status =3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So there is no was of distingushing errors and %abort cancel, as both of return exit stat =2 in LINUX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas to distingush between %abort cancel statement and errors in sas program ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 15:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919959#M362332</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-12T15:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919965#M362335</link>
      <description>&lt;P&gt;Works for me with the actual ABORT statement.&lt;/P&gt;
&lt;PRE&gt;&amp;gt;echo 'data _null_; abort 100; run;' &amp;gt; abort.sas
&amp;gt;sas -noautoexec abort.sas; echo rc=$?
rc=100
&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2024 16:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919965#M362335</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T16:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919967#M362336</link>
      <description>&lt;P&gt;Currently the program is using %abort&amp;nbsp; cancel in the existng programs. To implement the below solution around 300 programs are to be modified. So this solution is not applicable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 16:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919967#M362336</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-12T16:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919969#M362338</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432465"&gt;@wellsfargo123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Currently the program is using %abort&amp;nbsp; cancel in the existng programs. To implement the below solution around 300 programs are to be modified. So this solution is not applicable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If the programs aren't doing what you want then you will have to change them (or live with them).&lt;/P&gt;
&lt;P&gt;Specifying the return code works with %ABORT CANCEL also.&lt;/P&gt;
&lt;PRE&gt;&amp;gt;echo '%macro x; %abort cancel 100; %mend x; %x;' &amp;gt; abort.sas
&amp;gt;sas -noautoexec abort.sas; echo rc=$?
rc=100
&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2024 16:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919969#M362338</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T16:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919976#M362339</link>
      <description>&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p0h28whoxxvtztn15wqqvv9o41py.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p0h28whoxxvtztn15wqqvv9o41py.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per this link the exits status 2 is specifically for&amp;nbsp; sas errors . Appreciate your work around. Hope this will be fixed in the next versions as per the documentation.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 17:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919976#M362339</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-12T17:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919981#M362343</link>
      <description>That solution is not feasibile.&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Mar 2024 17:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919981#M362343</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-12T17:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919990#M362350</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432465"&gt;@wellsfargo123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;That solution is not feasibile.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No idea what that means.&lt;/P&gt;
&lt;P&gt;You want to distinguish between errors caused by normal SAS errors (bad code, missing files, etc) and those caused by programmed ABORT statements.&amp;nbsp; The way to do that is to set your own exit code in the ABORT statement.&amp;nbsp; If you do not make that change there is no way to tell the difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess you could try to read the LOG and guess what happened.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 18:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919990#M362350</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T18:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919992#M362352</link>
      <description>Thanks</description>
      <pubDate>Tue, 12 Mar 2024 19:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919992#M362352</guid>
      <dc:creator>wellsfargo123</dc:creator>
      <dc:date>2024-03-12T19:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919993#M362353</link>
      <description>&lt;P&gt;When you issue the %ABORT CANCEL statement, an error message is written to the log, so it's only logical that the program also terminates with the error exit code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want all your programs to terminate with the same code when %ABORT CANCEL is used, change the statements. On UNIX, &lt;FONT face="courier new,courier"&gt;awk&lt;/FONT&gt; is the perfect tool for this. But you can also write a SAS program to do that.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 19:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919993#M362353</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-12T19:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exit status  of sas Programs in UNIX shell wrapper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919999#M362356</link>
      <description>&lt;P&gt;If the goal is to treat the %ABORT CANCEL as NOT being an error you&amp;nbsp;can set the exit code to 1 (warning).&amp;nbsp; Note you cannot set it to 0 (no error).&amp;nbsp; If you try to set it to 0 it just ends up being set to 2 (not sure why).&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 19:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-exit-status-of-sas-Programs-in-UNIX-shell-wrapper/m-p/919999#M362356</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T19:22:22Z</dc:date>
    </item>
  </channel>
</rss>

