Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个用户编写的转换,以在某些条件为真时跳过进一步的作业执行。我试过代码
%abort; %abort cancel;
但是这些语句给出了错误,例如由于 %abort 语句而停止处理。我不希望显示错误消息,只需跳过剩余的作业执行即可。例如,如果我的源表的观察值为零,则在不记录错误消息或警告的情况下退出工作。
嗯,不确定这是否适用于 SAS DI(我没有测试它),但我们使用的是以下宏:
%macro stop_sas; %if "&sysenv" eq "FORE" %then %do; %abort cancel; %end; %else %do; endsas; %end; %mend;
它基本上检查 SAS 是否作为批处理作业运行,如果是,则安静地退出 SAS。如果 SAS 在交互模式下运行,那么它只会中止提交的代码,而不关闭 IDE。
这里的关键语句是endsas命令 - 这可能是您正在寻找的部分。
endsas