BookmarkSubscribeRSS Feed
Brandon16
Obsidian | Level 7
Hi,

I have 1500 lines off SAS code which can take up to 2 hours to run, how do I add a stop execution upon finding an error?

Thanks in advance
8 REPLIES 8
ChrisBrooks
Ammonite | Level 13

To be honest 1,500 lines of code isn't really the problem (I've seen much bigger programs) it's the quantity of data and how it's being processed which is causing the long run time.

 

You could set the errorcheck option to STRICT as documented here -> http://documentation.sas.com/?docsetId=lesysoptsref&docsetTarget=n074sx2hkq8dzpn1ptoydcmzfspt.htm&do...

 

or use the errorabend option but that will terminate the whole session leaving you no wiser as to what went wrong....

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Ensure the 1500 lines of code has been: modularised, validated, and stress tested.  Then an unexpected error will not happen.  Modularising the code will allow you to block the whole process up into smaller chunks, allowing for conditionally checking at various points.  

The question really is what does your documentation on the process say - you do have all the documentation e.g. functional design, testing, data structures etc.

Brandon16
Obsidian | Level 7
Each month code is added by a range a different users and therefore that's why i want to include this ch eck.

Still unsure how I do this.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Even more reason for modularistion and documentation.  Each new block should be documented and validated before being moved into the production process.

Ksharp
Super User

Try these two options.

 

options errorabend nosyntaxcheck;

Quentin
Super User
@Ksharp, what is the benefit of adding nosyntaxcheck? I think errorabend would be enough. As I understand it, nosyntaxcheck is used to tell SAS to keep executing code after an error, rather than entering syntax check mode.
Brandon16
Obsidian | Level 7
Do I add this at the start of my code and execute the whole program?
Ksharp
Super User
Yes. Or add into autoexec.sas

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2024 views
  • 0 likes
  • 5 in conversation