楼主: liushui
3102 6

[SAS EM] SAS advance 63 item 第26题 2017年4月14 [推广有奖]

  • 1关注
  • 3粉丝

博士生

14%

还不是VIP/贵宾

-

威望
0
论坛币
3916 个
通用积分
134.7056
学术水平
1 点
热心指数
5 点
信用等级
2 点
经验
4480 点
帖子
157
精华
0
在线时间
291 小时
注册时间
2005-9-19
最后登录
2023-10-25

楼主
liushui 在职认证  发表于 2017-4-14 09:49:30 |只看作者 |坛友微信交流群|倒序 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
Item 26 of 63 Mark item for review
Given the following SAS data sets:
WORK.VISIT1 WORK.VISIT2
Id Expense Id Cost
--- ------- --- ----
001 500 001 300
001 400 002 600
003 350
The following result set was summarized and
consolidated using the SQL procedure:
Id Cost
--- ----
001 300
001 900
002 600
003 350
Which of the following SQL statements was
most likely used to generate this result?
A.
select
Id,
sum(Expense) label='COST'
from WORK.VISIT1
group by 1
union all
select
Id,
sum(Cost)
from WORK.VISIT2
group by 1
order by 1,2
;
B.
select
id,
sum(expense) as COST
from
WORK.VISIT1(rename=(Expense=Cost)),
WORK.VISIT2
where VISIT1.Id=VISIT2.Id
group by Id
order by
Id,
Cost
;
C.
select
VISIT1.Id,
sum(Cost) as Cost
from
WORK.VISIT1(rename=(Expense=Cost)),
WORK.VISIT2
where VISIT1.Id=VISIT2.Id
group by Id
order by
Id,
Cost
;
D.
select
Id,
sum(Expense) as Cost
from WORK.VISIT1
group by Id
outer union corr
select
Id,
sum(Cost)
from WORK.VISIT2
group by Id
order by 1,2

亲测,此题选A; B,C两项错在 Order by 没有指定 ID COST是来自哪个table的;
                        D 错在加了 corr 选择项表明会displays all column that in comman plus 那些并非两个数据集都存在的column;
                              outer union corr 等价于 data set 步的 merge by 语句;词句若无 corr 选择项则 是争取选项。




二维码

扫码加我 拉你入群

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

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

关键词:ADVANCE advan VANCE ance item statements following procedure generate likely

已有 1 人评分热心指数 收起 理由
eijuhz + 1 精彩帖子

总评分: 热心指数 + 1   查看全部评分

沙发
liushui 在职认证  发表于 2017-4-14 09:56:39 |只看作者 |坛友微信交流群
更正,若 语句无corr,同时 将第二个query改为  select id, sum(cost) as cost from data2 group by id 则会有正确结果

使用道具

藤椅
liushui 在职认证  发表于 2017-4-14 09:59:39 |只看作者 |坛友微信交流群
liushui 发表于 2017-4-14 09:56
更正,若 语句无corr,同时 将第二个query改为  select id, sum(cost) as cost from data2 group by id 则会 ...
当select 后面跟着两个 table确就要明确指定每个变量来自哪个table;

使用道具

板凳
liushui 在职认证  发表于 2017-4-14 10:11:21 |只看作者 |坛友微信交流群
第54题;
%let name1=shoes;
%let name2=clothes;
%let root=name;
%let suffix=2;
%put &&&root&suffix;
解析:第一轮:macro processor scan && 后,解析为&,然后scan &root 解析为name,再scan &suffix 解析为2,结果为&name2
         第二轮:解析 &name2为 clothes;
补充,若 多加一个& 即 %put &&&&root&suffix时
         第一轮:macro processor scan && 解析为&, 再scan &&解析为&,接着root不变, 再scan &suffix 解析为2,结果为&&root2;
         第二轮:&&变为&,root2不变了,结果为&root2;
         第三轮:SAS提示WARNING: 没有解析符号引用 ROOT2。   %put &&&&root&suffix;               &root2

使用道具

报纸
liushui 在职认证  发表于 2017-4-14 10:16:14 |只看作者 |坛友微信交流群
Item 56 of 63 Mark item for review
The SAS data set WORK.ADDRESSES contains
the email addresses of The XYZ Corporation's
customers in a variable named Email_Address.
The following DATA step is submitted:
data _null_;
set WORK.ADDRESSES;
[_insert_statement_]
put "filename mail email '" Email_Address "'; ";
put "data _null_;";
put " file mail;";
put " put 'Thank you for your continued';";
put " put 'support of The XYZ Corporation.';";
put " put 'We appreciate your patronage.';";
put " put 'Sincerely,';" ;
put " put 'The XYZ Corporation';";
put "run;" ;
run;
Which statement completes the program
and creates a SAS program file?
A.
infile "c:\email.sas";
B.
output "c:\email.sas";
C.
file "c:\email.sas";
D.
None of the above.

记住规则:inflie input是读入,其中inflie指定路径,input指定内容;
                 file  put 是读出,file指定路径,put指定内容。

使用道具

地板
夏小正正正 发表于 2018-5-23 22:59:41 |只看作者 |坛友微信交流群
感谢讲解!清楚易懂 哈哈哈

使用道具

7
liushui 在职认证  发表于 2018-5-26 09:47:16 |只看作者 |坛友微信交流群
夏小正正正 发表于 2018-5-23 22:59
感谢讲解!清楚易懂 哈哈哈
加油,祝你好运!

使用道具

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

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

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

GMT+8, 2024-4-26 19:30