题目如下:
The following SAS program is submitted:
data test;
input animal1 $ animal2 $ mlgrams1 mlgrams2;
cards;
hummingbird ostrich 54000.39 90800000.87;
run;
Which one of the following represents the values of each variable in the output data set?
a. animal1 animal2 mlgrams1 mlgrams2
hummingb ostrich 54000.39 90800000
b. animal1 animal2 mlgrams1 mlgrams2
hummingb ostrich 54000.39 90800000.87
c.animal1 animal2 mlgrams1 mlgrams2
hummingbird ostrich 54000.39 90800000
d.animal1 animal2 mlgrams1 mlgrams2
hummingbird ostrich 54000.39 90800000.87
我想知道A选项为啥不对呢?我知道characer variable的default length是8bytes.那么numeric variable的默认length不是8bytes吗?还是说是best12.format形式啥的?此处有点晕。。。
下面是pdf给的解释,我觉得只解释了为啥选hummingb,没说为啥选B不选A:
In the INPUT statement, you must specify a dollar sign ($) after the variable name in order to define a character variable. If you do not specify otherwise, the default storage length for a variable is 8. In the example above, the character value hummingbird is truncated to hummingb.
多谢各位!!!