DATA Step, Macro, Functions and more

Error handling in Macro facility

Reply
Occasional Contributor
Posts: 6

Error handling in Macro facility

Hi All,

This may be a tricky question, however i hope there will be a solution for the same.

I have created one automated macro with error traping, like if there is an error in macro in any of the steps macro will through an error and stops execution. Now i want to execute my macro from the error only after modification.

For example i got the error in 3rd step of macro, i will change it and execute it again, then the macro should execute from 3rd step only not from step1 which reduces the execution time.

In long process executions it will help us a lot.

Any thoughts ?
Super Contributor
Super Contributor
Posts: 3,174

Re: Error handling in Macro facility

You will need to setup some external detection, either with a SAS file or an external file that gets written to as you progress through the macro execution. You would then need to add appropriate SAS code to detect any prior progress and as needed suppress some SAS MACRO code logic execution. The topic would be "restartability".

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 58

Re: Error handling in Macro facility

Do you typically see errors every time you run your program or are you just trying to debug it?
Valued Guide
Posts: 632

Re: Error handling in Macro facility

Take a look at the %ABORT statement. Depending on the level of termination that you want to achieve, it may be helpful. It also allows you to 'pass back' a return code which you may be able to use to determine your restart point.
Ask a Question
Discussion stats
  • 3 replies
  • 143 views
  • 0 likes
  • 4 in conversation