<?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 handling - Is there a variable set if any error occurs? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36956#M7280</link>
    <description>As far as i remember , there are two auto macro variables ( &amp;amp;syserrortext &amp;amp;syswarningtxt )&lt;BR /&gt;
which include the last error text and the last warning txt.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Fri, 18 Jun 2010 05:41:12 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2010-06-18T05:41:12Z</dc:date>
    <item>
      <title>Error handling - Is there a variable set if any error occurs?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36955#M7279</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to generate a variable in SAS which shows whether the code has run without any errors.&lt;BR /&gt;
&lt;BR /&gt;
The main body of the code is run on the server using an rsubmit command. The error variable needs to be available locally on my pc.&lt;BR /&gt;
&lt;BR /&gt;
The code is very simple as it just backs up some SAS datasets e.g.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
rsubmit;&lt;BR /&gt;
&lt;BR /&gt;
data dataset_backup ;&lt;BR /&gt;
set  dataset ;&lt;BR /&gt;
run ;&lt;BR /&gt;
&lt;BR /&gt;
data dataset2_backup ;&lt;BR /&gt;
set  dataset2 ;&lt;BR /&gt;
run ;&lt;BR /&gt;
&lt;BR /&gt;
endrsubmit;&lt;BR /&gt;
&lt;/PRE&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Do I need to include a error check in each and every data step or is there a single variable which gets set if any error anywhere is found?&lt;BR /&gt;
&lt;BR /&gt;
I've tried playing around with &amp;amp;syserr and &amp;amp;_efierr_ to obtain an error flag and %sysrput to return it to the local pc from the server but can't get anything to work.&lt;BR /&gt;
&lt;BR /&gt;
Any help with this would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Fat Captain.</description>
      <pubDate>Thu, 17 Jun 2010 15:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36955#M7279</guid>
      <dc:creator>FatCaptain</dc:creator>
      <dc:date>2010-06-17T15:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling - Is there a variable set if any error occurs?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36956#M7280</link>
      <description>As far as i remember , there are two auto macro variables ( &amp;amp;syserrortext &amp;amp;syswarningtxt )&lt;BR /&gt;
which include the last error text and the last warning txt.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 18 Jun 2010 05:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36956#M7280</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-18T05:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling - Is there a variable set if any error occurs?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36957#M7281</link>
      <description>have you tried &amp;amp;SYSCC</description>
      <pubDate>Fri, 18 Jun 2010 07:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36957#M7281</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-06-18T07:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling - Is there a variable set if any error occurs?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36958#M7282</link>
      <description>Using Mr. C's suggestion to use CC you might do something like this.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
286  proc transpose data=sashelp.class;&lt;BR /&gt;
287     var sex;&lt;BR /&gt;
288     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: The data set WORK.DATA14 has 1 observations and 20 variables.&lt;BR /&gt;
NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;
      real time           0.48 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
289  %sysfunc(ifC(&amp;amp;syscc,%nrstr(%put NOTE: BAD CC ENDSAS?;),%nrstr(%put NOTE: All good keep going)));&lt;BR /&gt;
NOTE: All good keep going&lt;BR /&gt;
290&lt;BR /&gt;
291  proc transpose data=sashelp.class;&lt;BR /&gt;
292     var sexx;&lt;BR /&gt;
ERROR: Variable SEXX not found.&lt;BR /&gt;
293     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
WARNING: The data set WORK.DATA15 may be incomplete.  When this step was stopped there were 0 observations and 0 variables.&lt;BR /&gt;
NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;
      real time           0.54 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
294  %sysfunc(ifC(&amp;amp;syscc,%nrstr(%put NOTE: BAD CC ENDSAS?;),%nrstr(%put NOTE: All good keep going)));&lt;BR /&gt;
NOTE: BAD CC ENDSAS?&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
For batch jobs a simple ENDSAS statement should be good.  For a DMS session you want to keep alive you will need something else, but I'm not sure what.&lt;BR /&gt;
&lt;BR /&gt;
A little searching at support.sas.com I find DM command WATTENTION.  &lt;A href="http://support.sas.com/kb/38/749.html" target="_blank"&gt;http://support.sas.com/kb/38/749.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%sysfunc(ifC(&amp;amp;syscc,%nrstr(dm 'WATTENTION';),%nrstr(%put NOTE: All good keep going)));&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
WATTENTION&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: data _null_;&lt;BR /&gt;
&lt;BR /&gt;
Well WATTENTION does bring up the dialogue but when you select Cancel Submitted Statements it does not cancel them.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0709C&amp;amp;L=sas-l&amp;amp;P=R17140" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0709C&amp;amp;L=sas-l&amp;amp;P=R17140&lt;/A&gt;

Message was edited by: data _null_;</description>
      <pubDate>Fri, 18 Jun 2010 13:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-Is-there-a-variable-set-if-any-error-occurs/m-p/36958#M7282</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-06-18T13:17:28Z</dc:date>
    </item>
  </channel>
</rss>

