SAS error handling is a bit of a mash-up, but you can typically get it to do something reasonable.
Can you describe more of your situation? It sounds like you are running a script interactively? Are you using PC SAS, Enterprise Guide, or Studio? While it would be nice to have one solution, error handling in interactive sessions vs batch sessions is different. And some IDEs set different error handling options.
Can you post an example with three or four little steps that generates an error and does not exit in a way that you would like?
Depending on your settings, when SAS detects an error, it will enter "syntax check mode". This does continue to fill the log, but it doesn't actually execute the code because it sets obs=0. So it's not exactly what you want, but close.
There is also the issue of what problems SAS considers to be an error vs warning etc.
So if you can share an example, we can provide more suggestions. For an example like:
data a ;
set sashelp.class ;
run ;
data foo ;
make an error;
run ;
data b ;
set a ;
run ;
If I run it in PC SAS interactively, the third step will run, despite the errors in the second step. But if I set the system option DMSSYNCHK, SAS will enter syntax check mode when the error occurs. The third step will be compiled but it won't actually replace WORK.B. The log is:
14 options dmssynchk ;
15
16 data a ;
17 set sashelp.class ;
18 run ;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.A has 19 observations and 5 variables.
19
20 data foo ;
21 make an error;
----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
22 run ;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.FOO may be incomplete. When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set WORK.FOO was not replaced because this step was stopped.
23
24 data b ;
25 set a ;
26 run ;
NOTE: The data set WORK.B has 0 observations and 5 variables.
WARNING: Data set WORK.B was not replaced because this step was stopped.
... View more