我尝试将其放在所有程序之前(使用该选项在预处理中包含代码):
选项错误结束;
它确实会触发警告 pop 窗口,但接下来的文件确实会执行。例如:
A-> B-> C-> D
如果A出现错误,我将 pop 一个对话框,说明发生了错误并且服务器已断开连接,但是B,C和D也将运行。我希望项目执行在A处停止。
我有几个带有数十个甚至数百个程序的老项目,因此我不考虑使用宏(Is there a way to make SAS stop upon the first warning or error?),同时也选择检查错误。
该怎么办?
谢谢!
编辑:这是为SAS企业指南7.1
最佳答案
我认为最好的方法是用Macro编写,例如:
%Macro error_check;
'your process for A';
%if &syserr > 0 %then %do;
%goto exit;
%end; /* if your systemerror value is greater than zero, then go to exit directly */
'your process for B';
'your process for C';
'your process for D';
%exit: /* be careful, it is not semicolon*/
%Mend;
只需尝试不要将%if&syserr循环放在“数据运行语句”中。我试图这样做,事情变得很复杂。
关于error-handling - 如果遇到错误,请停止SAS EG项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31302297/