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
crackman建议改写成这样试试:
data WORK.RETAIL;
Cost=\’20.000\';
Discount=.10*Cost;
Put Discount;
run;
但是看完后我还是有几个不明白的地方:
1.cost=那里的\’ \’是字符符号的意思吗?
2.在discount=那里是不是把cost直接从character转变为numerical value了?但是为什么原题答案还是discount会missing呢?
3.如果按照crackman的建议加上put discount这一行答案就是B了吗?可否讲解一下加上这一行的区别是?
谢谢!



雷达卡




京公网安备 11010802022788号







