<?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 Error Handling in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669263#M36410</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm working on a project that involves multiple SQL tables. We are running the program in scheduler using macros that run each table in the loop (i.e. 1 to n ). Sometimes, some of the SQL tables being drop by other user causing SAS to stop proceed further. Is there any way to bypass,&amp;nbsp; if the table does not exist then move on to pick the next one&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 18:36:49 GMT</pubDate>
    <dc:creator>meckarthik</dc:creator>
    <dc:date>2020-07-14T18:36:49Z</dc:date>
    <item>
      <title>Error Handling</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669263#M36410</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm working on a project that involves multiple SQL tables. We are running the program in scheduler using macros that run each table in the loop (i.e. 1 to n ). Sometimes, some of the SQL tables being drop by other user causing SAS to stop proceed further. Is there any way to bypass,&amp;nbsp; if the table does not exist then move on to pick the next one&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 18:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669263#M36410</guid>
      <dc:creator>meckarthik</dc:creator>
      <dc:date>2020-07-14T18:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error Handling</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669289#M36411</link>
      <description>&lt;P&gt;From the documentation for the function Exists:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV id="n0pdot9byxjzcyn1kvzldjmebpow" class="xis-exampleBlock"&gt;
&lt;DIV id="p0d1qrvhcn38zln1o8g9dx60vt6z" class="xis-example"&gt;
&lt;H3 class="xis-title"&gt;Example 1: Verifying the Existence of a Data Set&lt;/H3&gt;
&lt;DIV id="p15ozfcy7kicotn1y0ehtiw3fkz3" class="xis-paragraph"&gt;This example verifies the existence of a data set. If the data set does not &lt;FONT style="background-color: #fcdec0;"&gt;exist&lt;/FONT&gt;, then the example displays a message in the log:&lt;/DIV&gt;
&lt;DIV id="n1pkyfqmidihevn1slx4jbob0e94" class="xis-codeBlock"&gt;
&lt;PRE class="xis-code"&gt;%let dsname=sasuser.houses;

&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;%if %sysfunc(&lt;FONT style="background-color: #fcdec0;"&gt;exist&lt;/FONT&gt;(&amp;amp;name)) %then %do;&lt;/FONT&gt;&lt;/STRONG&gt;
   &amp;lt;your remaining macro code goes here&amp;gt;&lt;BR /&gt;%end;
%else %put Data set &amp;amp;name does not &lt;FONT style="background-color: #fcdec0;"&gt;exist&lt;/FONT&gt;.;
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The bit you want is the highlighted in magenta above. The line tests the existence of the data set. What would follow the %then is your current macro generated code. A simple %else; does nothing if the data set isn't present though a note similar to the above might be helpful in the Log for job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 19:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669289#M36411</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-14T19:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error Handling</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669296#M36412</link>
      <description>&lt;P&gt;If you are running a Production SAS process from an SQL Server database where tables are being dropped, then I suggest you have a data management problem rather than a coding problem. Production database tables should be truncated, that is all rows removed, not dropped entirely - that is simply poor practice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think the EXIST function as suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;will work for external databases like SQL Server. You will probably have to query the database's dictionary tables to check for the existence of a required table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 20:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669296#M36412</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-07-14T20:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error Handling</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669303#M36413</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If you are running a Production SAS process from an SQL Server database where tables are being dropped, then I suggest you have a data management problem rather than a coding problem. Production database tables should be truncated, that is all rows removed, not dropped entirely - that is simply poor practice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think the EXIST function as suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;will work for external databases like SQL Server. You will probably have to query the database's dictionary tables to check for the existence of a required table.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Good point. I didn't catch that the SQL might be in an external system as I do not read "SQL table" to be specific SQL Server or other data base, just lazy reference to a SAS data set referenced with Proc SQL when an external source is not explicitly stated.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 20:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-Handling/m-p/669303#M36413</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-14T20:47:43Z</dc:date>
    </item>
  </channel>
</rss>

