SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 702|回复: 2
打印 上一主题 下一主题

新手|有关两个循环语句的困惑

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2009-8-11 19:20:13 | 只看该作者

新手|有关两个循环语句的困惑

GO TO OK;
....
OK:....;
/*这里OK语句后没有RETURN;*/


LINK RECORD;
.....
RECORD:...;
RETURN;
/*这里RECORD语句后面却有return语句,为什么?*/
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2009-8-11 22:24:03 | 只看该作者

Re: 新手|有关两个循环语句的困惑

It really depends on the logic of your SAS program. You don't
have to put a 'return' under the label.
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2009-8-11 22:49:22 | 只看该作者

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.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2026-2-5 21:37 , Processed in 0.087037 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表