33.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
答案:B
解释是:The CARDS statement is an alias for the DATALINES statement. In the INPUTstatement, you must specify a dollar sign ($) after the variable name in order to define acharacter variable. If you do not specify otherwise, the default storage length for avariable is 8. In the example above, the character value hummingbird is truncated tohummingb.
有两个问题不明白:1, list input 不是读到空格才会读下一个值吗? 为什么这里会 truncated ?2, 解释里说没有定义dollar sign ($)的时候才会truncate,但是题目程序里已经定义了呀
恳请各位高人解惑,谢谢!!