DATA Step, Macro, Functions and more

set the ERROR detection macro variable, why do we need this

Reply
Super Contributor
Posts: 345

set the ERROR detection macro variable, why do we need this

 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */

 

would anybody explain why do we need this? If we do not have this, what will happen? Thanks

Super User
Posts: 7,762

Re: set the ERROR detection macro variable, why do we need this

To answer this question, we need to know the context. (Re)Setting such automatic macro variables can and does make sense in certain situations.

 

So where have you encountered this statement?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,942

Re: set the ERROR detection macro variable, why do we need this

Think of it this way.  

 

Datastep 1 runs and fails, error code set to 1.

Datastep 2 runs and passes, but error code still 1.

 

Hence why you reset the error macro at the point you want.

Super User
Super User
Posts: 7,039

Re: set the ERROR detection macro variable, why do we need this

Normally you see that line in code generated by PROC IMPORT.  When reading from a text file PROC IMPORT is essentially an SCL program that analyzes the text file and generates a data step to read it. The generated data step will update that macro variable if there are any errors. So then the PROC can detect the updated macro variable and report the error.

PROC Star
Posts: 7,468

Re: set the ERROR detection macro variable, why do we need this

If you're asking the question "Does one need to include a line of code like that when we manually rerun code that was produced by proc import or export?" the answer is absolutely not.

 

Art, CEO, AnalystFinder.com

 

Ask a Question
Discussion stats
  • 4 replies
  • 336 views
  • 2 likes
  • 5 in conversation