title: Stop SAS Program on Error
body: <p>I am using a macro to stop my SAS program on an error, but it always disconnects from the server and then I cannot get back my temporary data sets anymore.</p>
  
  <p>I have tried:</p>
  
  <pre><code>OPTIONS ERRORABEND;
  </code></pre>
  
  <p>Here is the macro I have tried:</p>
  
  <pre><code>%macro errchk;
  %if &amp;syserr &gt;0 and &amp;syserr ne 4 %then %abort;
  %mend errchk;
  </code></pre>
  
  <p>This one keeps processing the following data steps after reaching an error.</p>
  
  <p>I cannot figure out how to stop the rest of the program from running, but NOT disconnect from the SAS server. Any ideas?</p>