<?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 SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134720#M27352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am wondering why the above referenced macro variable does not set to 1 when it encounters an error and stops processing as in the sample code below. I have deliberately set the filename statement to a non-existent URL. How do I use the _EFIERR_ macro variable in subsequent code when it will not return a value of 1 when SAS processing is stopped? Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename _000002 url "%str(xyxp://www.bxb.cats/us/Find-Business-Reviews/name/ALEX+FIGLIOLIA+WATER+SEWER/11215)" debug;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data f nf;&lt;BR /&gt;format webpage $32767.;&lt;BR /&gt;infile _000002 lrecl=32767 delimiter="&amp;gt;&amp;lt;";&lt;BR /&gt;input webpage $ @@;&lt;BR /&gt;if (prxmatch("/Search Result here!|a href=/i",webpage)) then output f;&lt;BR /&gt;if (prxmatch("/did not match any Business Names/i",webpage)) then output nf;&lt;BR /&gt;if _ERROR_ then call symput('_EFIERR_',1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;e1=&amp;amp;_EFIERR_;&lt;BR /&gt;put e1;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Nov 2013 16:20:10 GMT</pubDate>
    <dc:creator>BPrater_cancapital_com</dc:creator>
    <dc:date>2013-11-07T16:20:10Z</dc:date>
    <item>
      <title>SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134720#M27352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am wondering why the above referenced macro variable does not set to 1 when it encounters an error and stops processing as in the sample code below. I have deliberately set the filename statement to a non-existent URL. How do I use the _EFIERR_ macro variable in subsequent code when it will not return a value of 1 when SAS processing is stopped? Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename _000002 url "%str(xyxp://www.bxb.cats/us/Find-Business-Reviews/name/ALEX+FIGLIOLIA+WATER+SEWER/11215)" debug;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data f nf;&lt;BR /&gt;format webpage $32767.;&lt;BR /&gt;infile _000002 lrecl=32767 delimiter="&amp;gt;&amp;lt;";&lt;BR /&gt;input webpage $ @@;&lt;BR /&gt;if (prxmatch("/Search Result here!|a href=/i",webpage)) then output f;&lt;BR /&gt;if (prxmatch("/did not match any Business Names/i",webpage)) then output nf;&lt;BR /&gt;if _ERROR_ then call symput('_EFIERR_',1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;e1=&amp;amp;_EFIERR_;&lt;BR /&gt;put e1;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 16:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134720#M27352</guid>
      <dc:creator>BPrater_cancapital_com</dc:creator>
      <dc:date>2013-11-07T16:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134721#M27353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try displaying the value of &lt;SPAN style="font-family: 'courier new', courier;"&gt;_ERROR_&lt;/SPAN&gt; in the first data step to make sure it is non zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, maybe try adding an &lt;SPAN style="font-family: 'courier new', courier;"&gt;else&lt;/SPAN&gt; to your &lt;SPAN style="font-family: 'courier new', courier;"&gt;if&lt;/SPAN&gt; statement to assign 0 (zero) to macro variable &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;_EFIERR_&lt;/SPAN&gt; so that it always has a value assigned to it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise post the log if it is still not making sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 17:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134721#M27353</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2013-11-07T17:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134722#M27354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried making the following alteration, but the value of _ERROR_ is never output since the original data step never iterates. Both logs are attached. I guess the basic question is how to understand that a data step has failed and pass that information to subsequent code? The only other thing I can think of is to proc printto the log for that one data step and then scan the log with a prxmatch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename _000002 url "%str(xyxp://www.bxb.cats/us/Find-Business-Reviews/name/ALEX+FIGLIOLIA+WATER+SEWER/11215)" debug;&lt;/P&gt;&lt;P&gt;%let _EFIERR_=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data f nf;&lt;/P&gt;&lt;P&gt;format webpage $32767.;&lt;/P&gt;&lt;P&gt;infile _000002 lrecl=32767 delimiter="&amp;gt;&amp;lt;";&lt;/P&gt;&lt;P&gt;input webpage $ @@;&lt;/P&gt;&lt;P&gt;if (prxmatch("/Search Result here!|a href=/i",webpage)) then output f;&lt;/P&gt;&lt;P&gt;if (prxmatch("/did not match any Business Names/i",webpage)) then output nf;&lt;/P&gt;&lt;P&gt;err=_ERROR_; call symput("err",err);&lt;/P&gt;&lt;P&gt;if _ERROR_ then call symput("_EFIERR_",1);&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;err='&amp;amp;err';&lt;/P&gt;&lt;P&gt;e1=&amp;amp;_EFIERR_;&lt;/P&gt;&lt;P&gt;put e1;&lt;/P&gt;&lt;P&gt;put err;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 18:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134722#M27354</guid>
      <dc:creator>BPrater_cancapital_com</dc:creator>
      <dc:date>2013-11-07T18:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134723#M27355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To display the macro variables properly, get rid of the final DATA step.&amp;nbsp; Just write them to the log using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put _user_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better yet, write values within the first DATA step just before the final RUN statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put _all_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get a DATA step to keep on running after an error occurs, it sometimes works to reset _ERROR_ yourself.&amp;nbsp; For example, just before the RUN statement in the first DATA step, add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_error_=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No guarantees as to what results you'll see on that, but it might become a part of the solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 18:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134723#M27355</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-11-07T18:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134724#M27356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your advice, I did find the SYSERRORTEXT to be of some assistance. The value is blank when the data step runs without error; contains text when the data step fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only problem I found is that it is a read-only attribute so is resistant to manual reset. Any thoughts on that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 19:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134724#M27356</guid>
      <dc:creator>BPrater_cancapital_com</dc:creator>
      <dc:date>2013-11-07T19:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134725#M27357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I have seen cases where _EFIERR_ is a reserved name in a DATA step.&amp;nbsp; Just to be safe, change the last line from this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _ERROR_ then call symput('_EFIERR_', 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To these two lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _ERROR_ then call symputx('URL_NotFound', 1);&lt;/P&gt;&lt;P&gt;_error_=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that CALL SYMPUTX will perform the numeric to character conversion without using leading blanks, and without generating a conversion message on the log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should be a little more to work with at that point ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 19:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134725#M27357</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-11-07T19:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134726#M27358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Think in the other way. As the datastep kan fail and never run it is bad idea trying to set as fail indicator.&lt;/P&gt;&lt;P&gt;It is more reliable and sure code to put a value in when everything has processed well as good code will run to the expected end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So:&lt;/P&gt;&lt;P&gt;%let errstp_stat=1 ;&amp;nbsp; /* to begin with */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;Whatever you run&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput("errstp_stat",0) ; /* on the location when you processing is done ok */&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;%macro err_chk ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* do your proceeding tests, abort or whatever you like. */&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%err_chk;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This construction Di programmers will recognize when seen the generated code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 20:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134726#M27358</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-11-07T20:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134727#M27359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Mr Karman. Reversing my thinking was the exact solution. A failed data step can never be relied upon as an indicator of success.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 20:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134727#M27359</guid>
      <dc:creator>BPrater_cancapital_com</dc:creator>
      <dc:date>2013-11-07T20:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: SYMBOLGEN:  Macro variable _EFIERR_ resolves to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134728#M27360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;_ERROR_ is not quite what you think it is.&amp;nbsp; _ERROR_ does not indicate an error that causes the data step to terminate; that wouldn't be checkable except by exclusion (like Jaap suggests).&amp;nbsp; IE, the moment a SAS data step finds an error that causes it to terminate, it terminates - it doesn't go to the bottom and see if it should do something about it.&amp;nbsp; There's no TRY/CATCH in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_ERROR_ indicates data errors, such as division by zero, invalid data provided to a PUT or INPUT, etc.&amp;nbsp; See &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695104.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695104.htm"&gt;SAS(R) 9.2 Language Reference: Concepts, Second Edition&lt;/A&gt; for more details.&amp;nbsp; PROC IMPORT for CSV, where you probably first saw this variable, uses this to identify issues with data formatting (such as if a numeric column contains character values).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to check for actual termination errors, then check &amp;amp;SYSERR, which will be 0 if the last data step worked or nonzero if it failed.&amp;nbsp; See &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000208995.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000208995.htm"&gt;SAS(R) 9.2 Macro Language: Reference&lt;/A&gt; for more details and be aware it's not supported by all procs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 21:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYMBOLGEN-Macro-variable-EFIERR-resolves-to-0/m-p/134728#M27360</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-11-07T21:42:57Z</dc:date>
    </item>
  </channel>
</rss>

