BookmarkSubscribeRSS Feed
makset7
Obsidian | Level 7

Hello.
I have the following problem with sas batch mode:

 

During program execution in batch mode if there is any error the rest of the program is not executed.

There is an option or trick to make the rest of the program executed.

 

 

 

Thank you very much for all your help

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

Look at these options

 

NOERRORABEND Does not end SAS for most errors, issues an error message, sets OBS=0, and goes into syntax check mode.
NOERRORBYABEND Does not end a SAS program when an error occurs in BY-group processing, issues an error, and continues
processing.

 

I question why you would want this behaviour though.

dandar
Obsidian | Level 7

I had this problem and will try the solutions stated here. However I often use by group processing fitting models on each level (bootstrapping). These often fail in low sample sizes/events and I do wish to simply "run on". Interactive SAS does this but batch does not by default it seems. So I am comfortable with these errors (I capture convergence diagnostics from the sas procedure and filter out non-converging models later). It is best to do a try/catch I suppose but I do not know how, and anyway seems pointless since the base procedure is very happy to just "run on".

SASKiwi
PROC Star

@dandar  - Most likely it is the SAS system option SYNTAXCHECK you are encountering as it is switched on by default in batch mode. You can put this in a SAS OPTIONS statements to test if it gives you the behaviour you want. In your case you would use: OPTIONS NOSYNTAXCECK;  

dandar
Obsidian | Level 7
Thank you so much, I will give this a try. I thought I was going mad: interactive mode runs fine (with multiple by-processing errors) but batch mode fails. I'll report back.
Patrick
Opal | Level 21

@makset7

I'd say that execution stops once an error has been encountered is a good thing. You'll enter into an undefined state after an error and if processing would continue then unexpected things could happen (i.e. overwriting a table with wrong data).

 

If you want some process to execute after program failure (i.e. sending out an email alert) then consider using a scheduler where you then check the return code of the process and in case of failure have the scheduler trigger another program which sends out the email (or whatever else you want to do).

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 1662 views
  • 3 likes
  • 5 in conversation