<?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 with LIBNAME XML in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44866#M9203</link>
    <description>maybe look at changing the autoexec.sas for the batch server to no syntax mode? or add the nosyntaxcheck as a global option?</description>
    <pubDate>Wed, 17 Jun 2009 15:27:45 GMT</pubDate>
    <dc:creator>CameronLawson</dc:creator>
    <dc:date>2009-06-17T15:27:45Z</dc:date>
    <item>
      <title>Error handling with LIBNAME XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44862#M9199</link>
      <description>Occasionally data providers to an application I'm working on send data that has not gone through an EBCIDIC to ASCII conversion.   The rest of the XML file will be valid.   The error message is:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Character is unclassifiable.&lt;BR /&gt;
       encountered during XMLInput parsing&lt;BR /&gt;
       occurred at or near line 11, column 133&lt;BR /&gt;
&lt;BR /&gt;
The application is batch and handles thousands of input files a run.   Very few are ever wrong so I really need to be able to trap information about a problem file and keep on processing.&lt;BR /&gt;
&lt;BR /&gt;
So far I have not found something equivalent to the DATA Step's _ERROR_ that indicates when a error has been encountered.&lt;BR /&gt;
&lt;BR /&gt;
Does anybody know of any way to know that a LIBNAME XML translation has failed besides reading the sas.log after the fact?</description>
      <pubDate>Mon, 15 Jun 2009 16:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44862#M9199</guid>
      <dc:creator>JMarkW</dc:creator>
      <dc:date>2009-06-15T16:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling with LIBNAME XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44863#M9200</link>
      <description>You might want to look at whether syserr, sysrc and sysmsg variables contain anything useful.&lt;BR /&gt;
&lt;BR /&gt;
If not, you might have to scan the files before hand in a data step and seek the culpable characters.</description>
      <pubDate>Mon, 15 Jun 2009 23:43:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44863#M9200</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-06-15T23:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling with LIBNAME XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44864#M9201</link>
      <description>You may need to write a program using the macro variables that Chris suggested.  Batch sas will go into syntax check mode when it finds an error.  Various return codes issued by sas can be found at;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a000208995.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a000208995.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
You would need to add a condition to your code like (not tested by myself though);&lt;BR /&gt;
&lt;BR /&gt;
If &amp;amp;syserr eq 3 then do;&lt;BR /&gt;
options NOSYNTAXCHECK;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
or the following may work also&lt;BR /&gt;
&lt;BR /&gt;
%macro resetSysErr();&lt;BR /&gt;
%let syserr = 0;&lt;BR /&gt;
%mend resetSysErr;&lt;BR /&gt;
&lt;BR /&gt;
and in your code-&lt;BR /&gt;
if &amp;amp;syserr eq 3 then do;&lt;BR /&gt;
put 'WARNING: xml file &amp;amp;filename returned errors.';&lt;BR /&gt;
call execute('%resetSysErr();');&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
I might try the above tomorrow at work to see if that works.  Let me know if you have success.

Message was edited by: Cameron Lawson</description>
      <pubDate>Wed, 17 Jun 2009 14:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44864#M9201</guid>
      <dc:creator>CameronLawson</dc:creator>
      <dc:date>2009-06-17T14:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling with LIBNAME XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44865#M9202</link>
      <description>I tried your suggestion to suppress the code and it did not work.    SAS appears to bail as soon as the file read is attempted bypassing all data step statements after the SET.&lt;BR /&gt;
&lt;BR /&gt;
I coded around this creating a macro flag.   If the file can be read the flag is flipped past the SET.  If the flag is not flipped, I know the file could not be read.&lt;BR /&gt;
&lt;BR /&gt;
Of course the annoying ERROR: still shows in the log.&lt;BR /&gt;
&lt;BR /&gt;
Scanning the files prior to processing is not an option due to data volume and a limited batch window.

Message was edited by: JMarkW</description>
      <pubDate>Wed, 17 Jun 2009 15:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44865#M9202</guid>
      <dc:creator>JMarkW</dc:creator>
      <dc:date>2009-06-17T15:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling with LIBNAME XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44866#M9203</link>
      <description>maybe look at changing the autoexec.sas for the batch server to no syntax mode? or add the nosyntaxcheck as a global option?</description>
      <pubDate>Wed, 17 Jun 2009 15:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-handling-with-LIBNAME-XML/m-p/44866#M9203</guid>
      <dc:creator>CameronLawson</dc:creator>
      <dc:date>2009-06-17T15:27:45Z</dc:date>
    </item>
  </channel>
</rss>

