The ERRORS=1 option was previously suggested, but that only stops he ERROR messages from writing to the log. I would suggest another system option ERRORABEND which will stop the program from further processing for most errors. I don’t know of an option to terminate processing due to warnings, but I think that you could add a macro like the following to stop processing.
%macro check_for_errors;
%if &syserr > 0 %then %do;
endsas;
%end;
%mend check_for_errors;
data test1;
<data step code>
run;
%check_for_errors;
You could repeat the macro call after each step of your program, and it should terminate at the point that the error code is anything but 0.