<?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/IML error handling in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-error-handling/m-p/397722#M3729</link>
    <description>&lt;P&gt;I am loogin at implementing a generic process of error handling on all the IML scripts we run in our company. Ideally, it would be something like this:&lt;/P&gt;&lt;PRE&gt;%LET IsIMLError = 0; /* flag that is set to 1 in case if an error */

proc iml;

OnError do; &amp;nbsp;/* is this somehow possible?&amp;nbsp;*/
&amp;nbsp; &amp;nbsp;%LET IsIMLError = 1;&amp;nbsp;
&amp;nbsp; &amp;nbsp;write_error_to_text_file; /* pseudo-code */
&amp;nbsp; &amp;nbsp;ABORT;
end;

/* IML code goes here*/

quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to always&amp;nbsp;trigger the error handling section whenever an error appears, no matter the nature of the error. Right now I can't figure out if the 'OnError' event exists in SAS/IML (or something with similar functionality). Any hints?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2017 10:03:55 GMT</pubDate>
    <dc:creator>MDaniel</dc:creator>
    <dc:date>2017-09-21T10:03:55Z</dc:date>
    <item>
      <title>SAS/IML error handling</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-error-handling/m-p/397722#M3729</link>
      <description>&lt;P&gt;I am loogin at implementing a generic process of error handling on all the IML scripts we run in our company. Ideally, it would be something like this:&lt;/P&gt;&lt;PRE&gt;%LET IsIMLError = 0; /* flag that is set to 1 in case if an error */

proc iml;

OnError do; &amp;nbsp;/* is this somehow possible?&amp;nbsp;*/
&amp;nbsp; &amp;nbsp;%LET IsIMLError = 1;&amp;nbsp;
&amp;nbsp; &amp;nbsp;write_error_to_text_file; /* pseudo-code */
&amp;nbsp; &amp;nbsp;ABORT;
end;

/* IML code goes here*/

quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to always&amp;nbsp;trigger the error handling section whenever an error appears, no matter the nature of the error. Right now I can't figure out if the 'OnError' event exists in SAS/IML (or something with similar functionality). Any hints?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 10:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-error-handling/m-p/397722#M3729</guid>
      <dc:creator>MDaniel</dc:creator>
      <dc:date>2017-09-21T10:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/IML error handling</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-error-handling/m-p/397723#M3730</link>
      <description>&lt;P&gt;Read the doc chapter &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/68150/HTML/default/viewer.htm#imlug_genstmts_sect002.htm" target="_self"&gt;"Generating and Executing Statements"&lt;/A&gt;, which has two sections on error handling.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be sure you are also familiar with the ways to &lt;A href="https://blogs.sas.com/content/iml/2014/09/15/errors-in-modules.html" target="_self"&gt;handle run-time errors in modules.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I may offer some advice: Whenever possible, it is better, easier, and cleaner to detect and handle SAS/IML errors BEFORE they occur. This is different than the try/catch paradigm in some other languages. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 10:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-error-handling/m-p/397723#M3730</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-21T10:15:23Z</dc:date>
    </item>
  </channel>
</rss>

