标题: 新手|有关两个循环语句的困惑 [打印本页] 作者: shiyiming 时间: 2009-8-11 19:20 标题: 新手|有关两个循环语句的困惑 GO TO OK;
....
OK:....;
/*这里OK语句后没有RETURN;*/
但
LINK RECORD;
.....
RECORD:...;
RETURN;
/*这里RECORD语句后面却有return语句,为什么?*/作者: shiyiming 时间: 2009-8-11 22:24 标题: Re: 新手|有关两个循环语句的困惑 It really depends on the logic of your SAS program. You don't
have to put a 'return' under the label.作者: shiyiming 时间: 2009-8-11 22:49 标题: Re: 新手|有关两个循环语句的困惑 从sas help里面查的
Comparisons
The difference between the LINK statement and the GO TO statement is in the action of a subsequent RETURN statement. A RETURN statement after a LINK statement returns execution to the statement that follows LINK. A RETURN statement after a GO TO statement returns execution to the beginning of the DATA step, unless a LINK statement precedes GO TO, in which case execution continues with the first statement after LINK. In addition, a LINK statement is usually used with an explicit RETURN statement, whereas a GO TO statement is often used without a RETURN statement.
When your program executes a group of statements at several points in the program, using the LINK statement simplifies coding and makes program logic easier to follow. If your program executes a group of statements at only one point in the program, using DO-group logic rather than LINK-RETURN logic is simpler.