<?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 Re: error in %include in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77959#M16903</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! Thanks for the reply. syntaxcheck is on upon running the proc options; but we still encountered the same problem even if we added the options nosyntaxcheck; at the start of saspgm2.sas&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Nov 2012 06:56:21 GMT</pubDate>
    <dc:creator>natrreb</dc:creator>
    <dc:date>2012-11-23T06:56:21Z</dc:date>
    <item>
      <title>error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77955#M16899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi! we have a .sas program that calls&amp;nbsp; a series of .sas programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; e.i. %include 'D:\saspgm1.sas';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %include 'D:\saspgm2.sas';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %include 'D:\saspgm3.sas;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when we encounter error in saspgm1.sas the error proliferates to saspgm2.sas and saspgm3.sas. even a simple select statement&amp;nbsp; (select * from table1) will not execute. we cannot use the %abort statement since we want to execute the rest of the .sas programs even if an error was encountered in the first .sas program. How can we stop the error to propagate?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help please. Thanks.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 02:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77955#M16899</guid>
      <dc:creator>natrreb</dc:creator>
      <dc:date>2012-11-23T02:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77956#M16900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now use %return;&amp;nbsp; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 03:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77956#M16900</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-11-23T03:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77957#M16901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The behaviour of your programs suggests the SYNTAXCHECK option is on. Run PROC OPTIONS to check this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is set then once there is an error, all subsequent code runs in syntax check mode only and does not execute. Add the statement OPTIONS NOSYNTAXCHECK; at the start of your program to avoid this behaviour.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 03:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77957#M16901</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2012-11-23T03:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77958#M16902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another alternative: create a macro that you call after each %include.&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro runquit;&lt;/P&gt;&lt;P&gt;; run; quit;&lt;/P&gt;&lt;P&gt;%if &amp;amp;syserr. ne 0 %then %do;&lt;/P&gt;&lt;P&gt;%abort;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend runquit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file "c:\art\saspgm1.sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "data test; set sashelp.class obs=1;run;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file "c:\art\saspgm2.sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "proc print data=sashelp.class (obs=1);run;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file "c:\art\saspgm3.sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "proc print data=sashelp.class (obs=2);run;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%include 'c:\art\saspgm1.sas';&lt;/P&gt;&lt;P&gt;%runquit&lt;/P&gt;&lt;P&gt;%include 'c:\art\saspgm2.sas';&lt;/P&gt;&lt;P&gt;%runquit&lt;/P&gt;&lt;P&gt;%include 'c:\art\saspgm3.sas';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 04:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77958#M16902</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-23T04:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77959#M16903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! Thanks for the reply. syntaxcheck is on upon running the proc options; but we still encountered the same problem even if we added the options nosyntaxcheck; at the start of saspgm2.sas&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 06:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77959#M16903</guid>
      <dc:creator>natrreb</dc:creator>
      <dc:date>2012-11-23T06:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77960#M16904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sir! when we add the macro runquit in our main sas program and added the %runquit; after every %include as instructed, only the saspgm1.sas was executed. our goal is to execute the rest of the sas programs even if we encountered an error in the first %include . Thanks.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 06:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77960#M16904</guid>
      <dc:creator>natrreb</dc:creator>
      <dc:date>2012-11-26T06:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77961#M16905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case, if you want to reset the syserr value each time, change the %runquit macro to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro runquit;&lt;/P&gt;&lt;P&gt;%* Reset the syserr value;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;x=x;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend runquit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 10:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77961#M16905</guid>
      <dc:creator>TimArm</dc:creator>
      <dc:date>2012-11-26T10:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: error in %include</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77962#M16906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did the 2nd to %includes in the example run as intended?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If they did, there might be something in one of your actual %includes that has to be addressed by the macro.&amp;nbsp; The following alternative might be enough.&amp;nbsp; It clears out most unfinished business, with the exception of replacing a missing %mend statement in your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro runquit;&lt;/P&gt;&lt;P&gt;; run; quit;&lt;/P&gt;&lt;P&gt;*))%*))*/;&lt;/P&gt;&lt;P&gt;;;;;&lt;/P&gt;&lt;P&gt;options notes;&lt;/P&gt;&lt;P&gt;run cancel; quit;&lt;/P&gt;&lt;P&gt;proc unk; run;&lt;/P&gt;&lt;P&gt;%if &amp;amp;syserr. ne 0 %then %do;&lt;/P&gt;&lt;P&gt;%abort;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend runquit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file "c:\art\saspgm1.sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "data test; set sashelp.class obs=1;run;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file "c:\art\saspgm2.sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "proc print data=sashelp.class (obs=1);run;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file "c:\art\saspgm3.sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "proc print data=sashelp.class (obs=2);run;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%include 'c:\art\saspgm1.sas';&lt;/P&gt;&lt;P&gt;%runquit&lt;/P&gt;&lt;P&gt;%include 'c:\art\saspgm2.sas';&lt;/P&gt;&lt;P&gt;%runquit&lt;/P&gt;&lt;P&gt;%include 'c:\art\saspgm3.sas';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 14:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-in-include/m-p/77962#M16906</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-26T14:57:51Z</dc:date>
    </item>
  </channel>
</rss>

