SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

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

关于声明变量属于哪个数据集的问题

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2006-6-12 17:10:35 | 只看该作者

关于声明变量属于哪个数据集的问题

<!-- m --><a class="postlink" href="http://www.mysas.net/tF7k3Uc0/59267/m70/m70_61.htm">http://www.mysas.net/tF7k3Uc0/59267/m70/m70_61.htm</a><!-- m -->

第五题:
You are writing a PROC SQL query that will display the names of all library cardholders who work as volunteers for the library, and the number of books that each volunteer currently has checked out. You will use one or both of the following tables:


Library.Circulation lists the name and contact information for all library cardholders, and the number of books that each cardholder currently has checked out.


Library.Volunteers lists the name and contact information for all library volunteers.
Assume that the values of Name are unique in both tables.

Which of the following PROC SQL queries will produce your report?

The correct answer is below:
proc sql;
   select name, checkedout
      from library.circulation
      where name in
         (select name
            from library.volunteers);
为什么在where语句中的name没有声明是属于哪个数据集的?这样不会混淆么?
/*where circulation.name in
               (select volunteers.name
                     from library.volunteers);   */
是不是因为name的使用在各自的select语句中是明确属于哪个数据集的时候就不用声明了。
谢谢大家。
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2006-6-12 18:17:39 | 只看该作者

恢复

where中的name 就是前面定语数据集里的哪个呀,为什么还要定义?可以吧where看成是select的一个子句呀
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2006-6-20 09:44:38 | 只看该作者

当时也是这么理解的

当时也是这么理解的。呵呵
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-10 06:12 , Processed in 0.066711 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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