楼主: 肝贝
1522 2

[问答] put小问~ [推广有奖]

  • 12关注
  • 1粉丝

幸儿

博士生

48%

还不是VIP/贵宾

-

威望
0
论坛币
675 个
通用积分
1.0042
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
294 点
帖子
192
精华
0
在线时间
264 小时
注册时间
2013-11-9
最后登录
2019-11-19

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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的原因?求大神指点~~

二维码

扫码加我 拉你入群

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

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

关键词:put SASHELP modify rename output modify

I'll never let go.
沙发
Aharach 发表于 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]
I'll never let go.

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 08:47