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
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.
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".
@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;
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).
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.