BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I run a sas program and there is an error.

However,the program is still running long time and didnt stop.

What is the way to run a program and tell sas that in case of any error then stop the program immediately.( and show the error in Log window)

 

 

2 REPLIES 2
Tom
Super User Tom
Super User

How are you running the program?

If you submitted the SAS program to run from the command line (what some call "background" execution) then just use the ERRORABEND option.

 

But if you are running SAS interactively using SAS Display Manager, or pseudo interactively using a front end tool like Enterprise Guide or SAS/Studio, then that might cause you trouble as it will actually end the SAS session.  So any log messages in the LOG window will be gone before you can read them. 

SASKiwi
PROC Star

If you are running this program interactively via SAS EG or similar then adding - OPTIONS SYNTAXCHECK; - to the start of your program may help. It will switch SAS into syntax check mode as soon as there is an error. This means SAS doesn't process any data while completing the rest of the program so that should speed things up a lot. This option is the default when running SAS in batch mode (run SAS from a command line as described by @Tom ) so you could just run your program this way without any code changes.  

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 556 views
  • 1 like
  • 3 in conversation