楼主: wkn1986
1538 3

[原创博文] 向高手请教 [推广有奖]

  • 0关注
  • 4粉丝

已卖:127份资源

教授

63%

还不是VIP/贵宾

-

威望
0
论坛币
1656 个
通用积分
12.9139
学术水平
8 点
热心指数
14 点
信用等级
5 点
经验
10268 点
帖子
549
精华
0
在线时间
2400 小时
注册时间
2008-9-15
最后登录
2025-11-18

楼主
wkn1986 发表于 2010-5-12 23:20:15 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
请问当使用set dataset point=i;时在什么情况下需使用stop语句,不明白其运行过程。如以下就是死循环:
data gh;
do i=1 to 19;
set sashelp.class point=i;
output;
end;
run;
而以下的程序就并没使用stop却不是死循环:
data one;                  
  input id $ fruit $;      
datalines;                 
a apple                    
a apple                    
b banana                  
c coconut                  
c coconut                  
c coconut                  
;                          
                           
data two;                  
  input id $ color $;      
datalines;                 
a amber                    
b brown                    
b black                    
c cocoa                    
c cream                    
;               
data every_combination;
  /* Set one of your data sets, usually the larger data set */
  set one;
  do i=1 to n;
    /* For every observation in the first data set,    */
    /* read in each observation in the second data set */
    set two point=i nobs=n;
    output;
  end;
run;注(此程序为论坛中的)
谢谢了。
二维码

扫码加我 拉你入群

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

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

关键词:observation combination observat SASHELP usually apple color 程序

回帖推荐

sopching 发表于3楼  查看完整内容

In default, the DATA step continues to read observations until it reaches the end-of-file marker in the input data. However, because the POINT= option accesses observations directly, SAS cannot read an end-of-file indicator as it would if the file were being read sequentially. 在第一个程序里,只执行了一次data iteration,data步找不到这个end-of-file marker ,而陷入死循环中。因此你必须用stop强制d ...

本帖被以下文库推荐

沙发
tulipsliu 在职认证  发表于 2010-5-12 23:25:46
没用SAS,是个好软件。
最近一直都在用MATLAB
劳动经济学

藤椅
sopching 发表于 2010-5-13 01:31:54
In default, the DATA step continues to read observations until it reaches the end-of-file marker in the input data. However, because the POINT= option  accesses observations directly, SAS cannot read
an end-of-file indicator as it would if the file were being read sequentially.
在第一个程序里,只执行了一次data iteration,data步找不到这个end-of-file marker ,而陷入死循环中。因此你必须用stop强制data步的停止,仅输出你Point的那些观测。
而在第二个程序里,你要注意在do循环之前 有个set one的语句。在第5次 data iteration的时候找到了这个Marker了。因此这是不需要stop也可以运行。其中one中的每个观测和 two的所有观测Merge,two中的Id覆盖了one的Id值。
个人理解,希望有所帮助。
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

板凳
wkn1986 发表于 2010-5-13 12:21:50
非常感谢三楼的解释

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 08:25