我希望有类似的东西,但我不希望在退出时将错误消息发送到SAS日志。
data test_table;
input numbers;
datalines;
1
2
3
4
5
;
run ;
proc sql;
select count(*) into :recordsCount
from test_table;
quit;
%macro abortIfRemaining;
%if (&recordsCount > 0) %then %do;
%abort return 0;
%end;
%put No records found;
%mend abortIfRemaining;
* More code blocks would go here if no records found ;
%abortIfRemaining;
答案 0 :(得分:2)
找到我正在寻找的命令。这是" endsas"。
data test_table;
input numbers;
datalines;
1
2
3
4
5
;
proc sql;
select count(*) into :recordsCount
from test_table;
quit;
%macro abortIfRemaining;
%if (&recordsCount > 0) %then %do;
endsas;
%end;
%put No records found;
%mend abortIfRemaining;
* More code blocks would go here if no records found ;
%abortIfRemaining;