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.
BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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