<?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: What' the point of setting_EFIERR_ macro variable if it isn't used in the code? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397586#M96099</link>
    <description>&lt;P&gt;That looks like the code that PROC IMPORT generates. The macro variable is created to indicate there was an error in the execution of the data step, which I assume that PROC IMPORT uses to report back the failure. &amp;nbsp;Normally you do not need it. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do not need to use the code as generated by PROC IMPORT as it usually both over complicated and miss uses INFORMAT as if it was intended to define a variable. Normally you would want to use TRUNCOVER instead of MISSOVER to avoid risk of eliminating values that are shorter than expected. &amp;nbsp;Also there is no need to attach $xx INFORMAT or a FORMAT to character variables, SAS already knows how to read and write character variables. &amp;nbsp;You should instead use the LENGTH (or ATTRIB) statement to define your variables. &amp;nbsp;You can add INFORMAT or FORMAT if they are needed, for example for DATE or TIME variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data people;
  infile 'C:\Users\Me\Desktop\People.txt' dsd dlm='|' truncover firstobs=2;
  length name $20 ;
  input name ;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Sep 2017 19:32:37 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-09-20T19:32:37Z</dc:date>
    <item>
      <title>What' the point of setting_EFIERR_ macro variable if it isn't used in the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397545#M96086</link>
      <description>&lt;P&gt;I'm working on SAS 9.4 for Windows, looking at code similar to that below (though this has obviously been truncated):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    data People;
        %let _EFIERR_ = 0;
        infile 'C:\Users\Me\Desktop\People.txt' delimiter='|' MISSOVER DSD lrecl=32767 firstobs=2;
                informat
                name $20.

                format
                name $20.

                Input 
                name $

    if _Error_ then call symputx('EFIERR_',1);
    run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now to me, this basically says we are going to read in a text file and if there is an error then we'll set the macro variable&lt;SPAN&gt;&amp;nbsp;_&lt;/SPAN&gt;&lt;EM&gt;EFIERR_&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to 1. But why? This appears to be the end of the code so what's the point? Does it attach itself to the resulting table some how?&lt;/P&gt;&lt;P&gt;I've read some stuff and it seems as though _EFIERR_ is an actual global SAS variable so by doing this we are indicating an error has occurred. But I don't see why we need to set this to 1 in this code without doing anything with the variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, does this variable get set to 1 if an error occurred at any point? Or is this variable "attached" or associated with each observation, and thus shows which observations had an error because their _EFIERR_ value will be 1?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397545#M96086</guid>
      <dc:creator>Lavender_Gooms</dc:creator>
      <dc:date>2017-09-20T17:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: What' the point of setting_EFIERR_ macro variable if it isn't used in the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397581#M96098</link>
      <description>&lt;P&gt;This looks like code that's generated by default when you use PROC IMPORT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Someone has taken the code and modified it, but has not removed those sections.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC IMPORT creates those variables by default so a user can automatically drive the process, but if you're not using it, then you don't need it and can remove it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397581#M96098</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-20T19:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: What' the point of setting_EFIERR_ macro variable if it isn't used in the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397586#M96099</link>
      <description>&lt;P&gt;That looks like the code that PROC IMPORT generates. The macro variable is created to indicate there was an error in the execution of the data step, which I assume that PROC IMPORT uses to report back the failure. &amp;nbsp;Normally you do not need it. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do not need to use the code as generated by PROC IMPORT as it usually both over complicated and miss uses INFORMAT as if it was intended to define a variable. Normally you would want to use TRUNCOVER instead of MISSOVER to avoid risk of eliminating values that are shorter than expected. &amp;nbsp;Also there is no need to attach $xx INFORMAT or a FORMAT to character variables, SAS already knows how to read and write character variables. &amp;nbsp;You should instead use the LENGTH (or ATTRIB) statement to define your variables. &amp;nbsp;You can add INFORMAT or FORMAT if they are needed, for example for DATE or TIME variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data people;
  infile 'C:\Users\Me\Desktop\People.txt' dsd dlm='|' truncover firstobs=2;
  length name $20 ;
  input name ;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397586#M96099</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-20T19:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: What' the point of setting_EFIERR_ macro variable if it isn't used in the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397589#M96101</link>
      <description>&lt;P&gt;The variable _error_ when created by some error in a data step is a temporary variable and not available after the end of the data step.&lt;/P&gt;
&lt;P&gt;The code sets the macro variable so that if you desire you can test the value of &amp;amp;EFIERR and do something with the information such as run different code or write a specific (additional likely) message to the log.&lt;/P&gt;
&lt;P&gt;A value of 1 would tell you that some unspecied error occured though most of the ones in a data step that only reads data would typically generate a warning or error in the log about invalid data.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-the-point-of-setting-EFIERR-macro-variable-if-it-isn-t-used/m-p/397589#M96101</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-20T19:51:29Z</dc:date>
    </item>
  </channel>
</rss>

