全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1773 2
2014-04-14
data a1(index=(x));
input x y @@;
cards;
101 1 1 10 2 20 3 30
;
run;
data b3;
input pnt y;
cards;
2 200 3 300 4 400
;
run;
data a1;
set b3(rename=(y=y1));
modify a1 point=pnt;
y=y1;
run;
为什么这里的put不用stop就可以跳出循环?
data a;
do i=1 to tot;
set sashelp.class nobs=tot point=i;
output;
end;
stop;
run;

而这里却必须有stop才可以呢?
是因为前一个put之后还有操作,而后一个是直接输出观测的原因吗?还是modify的原因?求大神指点~~

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-4-14 01:30:16
SAS 官网上的一段关于Set的point选项的解释:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173782.htm

POINT=variable

    specifies a temporary variable whose numeric value determines which observation is read. POINT= causes the SET statement to use random (direct) access to read a SAS data set.
    Requirement:         a STOP statement
    Restriction:         You cannot use POINT= with a BY statement, a WHERE statement, or a WHERE= data set option. In addition, you cannot use it with transport format data sets, data sets in sequential format on tape or disk, and SAS/ACCESS views or the SQL procedure views that read data from external files.
    Restriction:         You cannot use POINT= with KEY=.
    Tip:         You must supply the values of the POINT= variable. For example, you can use the POINT= variable as the index variable in some form of the DO statement.
    Tip:         The POINT= variable is available anywhere in the DATA step, but it is not added to any new SAS data set.
    Featured in:         Combining One Observation with Many and Reading a Subset by Using Direct Access

    CAUTION:
        Continuous loops can occur when you use the POINT= option.

        When you use the POINT= option, you must include a STOP statement to stop DATA step processing, programming logic that checks for an invalid value of the POINT= variable, or both. Because POINT= reads only those observations that are specified in the DO statement, SAS cannot read an end-of-file indicator as it would if the file were being read sequentially. Because reading an end-of-file indicator ends a DATA step automatically, failure to substitute another means of ending the DATA step when you use POINT= can cause the DATA step to go into a continuous loop. If SAS reads an invalid value of the POINT= variable, it sets the automatic variable _ERROR_ to 1. Use this information to check for conditions that cause continuous DO-loop processing, or include a STOP statement at the end of the DATA step, or both.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-4-14 16:21:45
Aharach 发表于 2014-4-14 01:30
SAS 官网上的一段关于Set的point选项的解释:

http://support.sas.com/documentation/cdl/en/lrdict/643 ...
谢谢您[em23]
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群