SAS base 认证123题的第79题 The following SAS program is submitted:data work.products;Product_Number=5461;Item = '1001';Item_Reference=Item||'/'||Product_Number;run;Which one of the following is the value of the variable ITEM_REFERENCE in theoutput data set?A.1001/5461B.1001/ 5461C..(missing numeric value)D.The value can not be determined as the program fails to execute due to errors.answer:B (A和B的区别应该在于/后有空格)没看懂~(⊙o⊙)…for Product_Number Character expected b

问题描述:

SAS base 认证123题的第79题
The following SAS program is submitted:
data work.products;
Product_Number=5461;
Item = '1001';
Item_Reference=Item||'/'||Product_Number;
run;
Which one of the following is the value of the variable ITEM_REFERENCE in the
output data set?
A.1001/5461
B.1001/ 5461
C..(missing numeric value)
D.The value can not be determined as the program fails to execute due to errors.
answer:B (A和B的区别应该在于/后有空格)
没看懂~(⊙o⊙)…
for Product_Number Character expected but numerical got,so it automatically change it into
Character by using best 12.begining from right.So there are 12-4=8 spaces before 5461
if you put a number which has 12 bytes then there is no space before that number.
不懂数值型自动转换成字符型后数据长度到底怎么变?

不是说得很清楚嘛,数字转成字符串后长度变成12位,不足12位前面补足空格.