全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1795 4
2018-12-12
在准备SAS BASE 认证的学习中必做的一项crackman70里面其中第10题,原题如下:


10.The following SAS program is submitted:

data WORK.RETAIL;
Cost=’$20.000′;
Discount=.10*Cost;
run;

What is the result?
A. The value of the variable Discount in the output data set is 2000.No messages are written to the SAS log.
B. The value of the variable Discount in the output data set is 2000.A note that conversion has taken place is written to the SAS log.
C. The value of the variable Discount in the output data set is missing.A note in the SAS log refers to invalid numeric data.
D. The variable Discount in the output data set is set to zero.No messages are written to the SAS log.
Answer: C
本文属于博客:http://crackman.net 版权归作者所有,如有转载,请注明出处!未经本作者同意不得用于商业应用。
其他本博客文章均作此声明!
本题考察是数据格式以及在表达式中的转换机制
DISCOUNT最终为缺失值.,也就是PDV初始值缺失值。
如果程序改成:
data WORK.RETAIL;
Cost=’20.000′;
Discount=.10*Cost;
Put Discount;
run;
结果由是如何呢?
读者自己运行一下!
结合前几个例子里面的MDY函数。


于是我确实自己去跑了一遍程序,发现并没有出现所谓的discount为缺失值,而是2,这是怎么回事呢?
二维码

扫码加我 拉你入群

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

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

全部回复
2018-12-13 09:35:56
Discount=.10*Cost;
公式里有个点。。。
二维码

扫码加我 拉你入群

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

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

2018-12-14 11:14:09
Momocashew 发表于 2018-12-13 09:35
Discount=.10*Cost;
公式里有个点。。。
这个点不是小数点的意思吗
二维码

扫码加我 拉你入群

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

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

2018-12-14 12:18:44
qguo551 发表于 2018-12-14 11:14
这个点不是小数点的意思吗
是小数点,所以答案不就是2嘛。之前那个程序missing是因为Cost=’$20.000′;有特殊符号,不能加减乘除

二维码

扫码加我 拉你入群

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

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

2018-12-25 00:47:58
Momocashew 发表于 2018-12-14 12:18
是小数点,所以答案不就是2嘛。之前那个程序missing是因为Cost=’$20.000′;有特殊符号,不能加减乘除

...
原来如此,$
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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