求老师们一个data步的leave问题:
代码:%macro search(w0by,delby,sigby,sig1,sig2,need);
data _null_;
do w0 =0 to 80 by &w0by;
do delta10 =15 to 30 by &delby;
re: do sigma10 =&sig1 to &sig2 by &sigby;
*循环体;
/*output;*/
if nc<&need then do;
proc sql;
insert into result
value(wo,delta10,sigma10,nc);
select wo,delta10,sigma10,nc from result;
quit;
end;
if nc<&need then leave;
if nc<0 then do;
call symputx("sig1",symget("sigma10")-&sigby);
call symputx("sig2",symget("sigma10"));
call symputx("sigby",symget("sigby")/10);
end;
if nc<0 then go to re;
end;
end;
end;
run;
%mend;
%search(10,5,10,50,150,0.001);
log提示如下错误:
NOTE: Table WORK.RESULT created, with 0 rows and 4 columns.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.21 seconds
cpu time 0.09 seconds
NOTE: Line generated by the invoked macro "SEARCH".
3 data _null_; do w0 =0 to 80 by &w0by; do delta10 =15 to 30 by &delby; do sigma10 =&sig1 to &sig2 by
3 ! &sigby; *body; if nc<&need then do; proc sql; insert into
-
117
3 ! result value(
ERROR 117-185: There were 4 unclosed DO blocks.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.09 seconds
cpu time 0.01 seconds
1: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN where the error has
occurred.
WARNING 1-322: Assuming the symbol VALUES was misspelled as value.
NOTE: Line generated by the invoked macro "SEARCH".
4 wo,delta10,sigma10,nc);
--
22
76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,
a missing value, +, -, MISSING, NULL, USER.
ERROR 76-322: Syntax error, statement will be ignored.
ERROR: The following columns were not found in the contributing tables: wo.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.12 seconds
cpu time 0.03 seconds
我的想法:
我想做的是在这三层循环中的最里面那层做一个迭代,当最里面那层循环满足某种条件后:1,修改约束条件;2,跳出最里面的循环体重新循环。
我现在先不管迭代正确与否的事,我只想知道,为什么leave失效了,为什么会提示我丢了四个end;我想用leave实现的功能是:伴随leave得到的结果,跳出最内层循环,继续第二层循环。
求助请各位朋友,谢谢。