SAS:案例然后执行查询

时间:2017-11-27 10:24:08

标签: sql sas

我想只在条件满足时才执行查询。 我想要执行的代码是:

proc sql NOPRINT OUTOBS=1;
%CASE WHEN (&_count_ > 0) THEN
DELETE FROM TABLE T
WHERE T.Period = xxxxxx
END;
quit;

3 个答案:

答案 0 :(得分:1)

使用IF代替CASE

proc sql NOPRINT OUTOBS=1;
%IF(&_count_ > 0) %THEN %DO
DELETE FROM TABLE T
WHERE T.Period = xxxxxx
%END;
quit;

答案 1 :(得分:1)

我找到了解决方案:

subgraph cluster_s1 { 1 2 }

答案 2 :(得分:1)

proc sql;
DELETE FROM T
WHERE &_count_ > 0 and Period = xxxxxx
;quit;