<?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 Aborting a Job on certain errors in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/349722#M10396</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to run to abort a DI job on certain errors. I'm reading files stored in a location, and if the file doesn't exist, I'd like to abort the job and not run further steps. . I've got the aborting working for any errors encountered, but is there anyway to restrict it to just abort if it sees,&amp;nbsp;ERROR: Physical file does not exist. I'm using the Return Code Check transformation to status handle the file reader, so if there's anyways to do it throug that, it'd be preferable than through BASE SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2017 11:56:27 GMT</pubDate>
    <dc:creator>titan31</dc:creator>
    <dc:date>2017-04-13T11:56:27Z</dc:date>
    <item>
      <title>Aborting a Job on certain errors</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/349722#M10396</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to run to abort a DI job on certain errors. I'm reading files stored in a location, and if the file doesn't exist, I'd like to abort the job and not run further steps. . I've got the aborting working for any errors encountered, but is there anyway to restrict it to just abort if it sees,&amp;nbsp;ERROR: Physical file does not exist. I'm using the Return Code Check transformation to status handle the file reader, so if there's anyways to do it throug that, it'd be preferable than through BASE SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 11:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/349722#M10396</guid>
      <dc:creator>titan31</dc:creator>
      <dc:date>2017-04-13T11:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Aborting a Job on certain errors</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/350026#M10412</link>
      <description>&lt;P&gt;I'm not sure about the mechanism to abort, but you could use code to check for the existence of a file (which is the error you're getting) and then conditionally execute other code inside a macro only if the file is found. Some code I've used is shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro check_for_file(dir); 

   %local rc fileref;
   %global file_found_flag;
   %let rc = %sysfunc(filename(fileref, &amp;amp;dir));
   %put Checking for existence of &amp;amp;dir;
   %if %sysfunc(fexist(&amp;amp;fileref))  %then %let file_found_flag=1;    
   %else %let file_found_flag=0;

%mend check_for_file;

%macro x(file);

%check_for_file(&amp;amp;file)

%if &amp;amp;file_found_flag = 1 %then %do;

%put The file exists. Run code...;

%end;
%else %do;

    %put The file was not found.;

%end;
%mend x;
%x(yourPath\yourFile)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2017 12:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/350026#M10412</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-14T12:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Aborting a Job on certain errors</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/350315#M10423</link>
      <description>The functionality you're asking for is standard in most scheduling software. Use that, and shouldn't need to handle this in SAS at all.</description>
      <pubDate>Sat, 15 Apr 2017 21:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/350315#M10423</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-04-15T21:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Aborting a Job on certain errors</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/350330#M10424</link>
      <description>&lt;P&gt;I prefer using general SAS options for SAS error checking and / or scheduler options as they are a lot easier and cope with most problems. The one I find most useful is the SAS option SYNTAXCHECK:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lesysoptsref/69799/HTML/default/viewer.htm#n014qbvh3po8w5n1qlqbzr22vtg0.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lesysoptsref/69799/HTML/default/viewer.htm#n014qbvh3po8w5n1qlqbzr22vtg0.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this option whenever SAS hits a significant error it goes into syntax check mode and doesn't process any data.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2017 00:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Aborting-a-Job-on-certain-errors/m-p/350330#M10424</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-04-16T00:17:00Z</dc:date>
    </item>
  </channel>
</rss>

