停止 SAS 执行 [英] Stop SAS execution

查看:38
本文介绍了停止 SAS 执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问

是否有一种单行(或相当短的)方法可以在窗口环境中取消进一步 SAS 语句的执行.

Is there a one-liner (or something rather short) method of cancelling the execution of further SAS statements from withing the windowing environement.

这些是我知道的 方法,但它们变得令人厌烦,尤其是在大型程序中很多评论.我尝试了 ABORTSTOP 语句,但它们关闭了窗口环境,但我想要的只是在某个点停止执行并继续我的快乐之路.

These are the methods I know of but they get tiresome, espeacially in huge programs with a lot of comments. I tried the ABORT and STOP statements but they close the windowing enviroment yet all I want is to stop execution at a certain point and go on my merry way.

谢谢

推荐答案

这在 SAS-L 上经常出现.答案是这在很大程度上取决于你在做什么.

This is something that comes up on SAS-L every so often. The answer is that it depends on what you're doing, largely.

如果您希望因错误而停止执行,run cancel 方法可能是最佳选择.在程序的顶部,您可以:

The run cancel method is probably best if you are hoping to stop execution because of an error. At the top of your program you do:

%let cancel =; *or any macro variable name, but cancel is most logical;

然后在每个运行步骤中:

Then in every run step you have:

data whatever;
... do stuff ...;
run &cancel;

每次你有一些潜在的错误时,你检查错误条件,然后如果它命中,%let cancel=cancel;,你很好.

And each time you have some potential error, you check the error condition and then if it hits,%let cancel=cancel; and you're good.

如果您正在使用宏,您可以使用 %abort 顺利退出宏,只要您不使用任何选项或仅使用 cancel.根据您正在执行的操作,您可以将代码设置为在一个(或多个)宏中运行并使用此选项(尽管这样做的缺点是会丢失一些日志清晰度).

If you are using macros, you can exit a macro smoothly with %abort as long as you either use no options or only use cancel. Depending on what you're doing, you might set up your code to run in a macro (or macros) and use this option (although with the disadvantage of losing some log clarity).

最后,如果您只是对能够运行代码的子集感兴趣,我建议您在多个 SAS 程序中为您可能想要单独运行的位编写代码,然后使用 %include 从主程序将它们与您可能想要设置的共享宏变量一起分组.这类似于在 EG 中您如何构建许多较小的程序,然后使用流程图将它们分组.

Finally, if you're just interesting in being able to run a subset of your code, I recommend writing the code in multiple SAS programs for the bits you might want to run separately, then using %include from a master program to group them all together along with any macro variables you might want set that are shared. This is similar to how in EG you would construct many smaller programs and then group them using the process flow diagram.

这篇关于停止 SAS 执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆