<?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 Skip to next macro if macro error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Skip-to-next-macro-if-macro-error/m-p/729373#M226948</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a code with some macros where each of them extract a different data, and be like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%extract_basex();&lt;/P&gt;&lt;P&gt;%extract_basey();&lt;/P&gt;&lt;P&gt;%extract_basez();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, sometimes one of my macros get an error and the code stops. What could I do to for if one macro get an error the code goes to the next one?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I want this:&lt;/P&gt;&lt;P&gt;%extract_basex(); --&amp;gt; Execute&lt;/P&gt;&lt;P&gt;%extract_basey(); --&amp;gt; Abend, the code stop this macro and goes to next&lt;/P&gt;&lt;P&gt;%extract_basez(); --&amp;gt; Execute&lt;/P&gt;</description>
    <pubDate>Fri, 26 Mar 2021 13:16:04 GMT</pubDate>
    <dc:creator>PedroBoareto</dc:creator>
    <dc:date>2021-03-26T13:16:04Z</dc:date>
    <item>
      <title>Skip to next macro if macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-to-next-macro-if-macro-error/m-p/729373#M226948</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a code with some macros where each of them extract a different data, and be like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%extract_basex();&lt;/P&gt;&lt;P&gt;%extract_basey();&lt;/P&gt;&lt;P&gt;%extract_basez();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, sometimes one of my macros get an error and the code stops. What could I do to for if one macro get an error the code goes to the next one?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I want this:&lt;/P&gt;&lt;P&gt;%extract_basex(); --&amp;gt; Execute&lt;/P&gt;&lt;P&gt;%extract_basey(); --&amp;gt; Abend, the code stop this macro and goes to next&lt;/P&gt;&lt;P&gt;%extract_basez(); --&amp;gt; Execute&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 13:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-to-next-macro-if-macro-error/m-p/729373#M226948</guid>
      <dc:creator>PedroBoareto</dc:creator>
      <dc:date>2021-03-26T13:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Skip to next macro if macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-to-next-macro-if-macro-error/m-p/729375#M226949</link>
      <description>&lt;P&gt;You can get more control by making your macro smart enough to detect the issues before they generate SAS errors and then skipping to the end of the macro.&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro extract_basex();
%let anyerr=0;
%if not exist(&amp;amp;input_ds) %then %do;
  %put ERROR: &amp;amp;=sysmacroname error. &amp;amp;=input_ds does not exist.;
  %let anyerr=1;
%end;
%if anyerr %then %goto quit;
/* code that uses &amp;amp;input_ds */
...
%quit:
/* Code that cleans up whether or not any errors */
%mend extract_basex;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 13:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-to-next-macro-if-macro-error/m-p/729375#M226949</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-26T13:32:46Z</dc:date>
    </item>
  </channel>
</rss>

