h****9 发帖数: 26 | 1 Item 59 of 70 Mark item for review
Given the contents of the raw data file TYPECOLOR.DAT:
----+----10---+----20---+----30
daisyyellow
The following SAS program is submitted:
data FLOWERS;
infile 'TYPECOLOR.DAT' truncover;
length
Type $ 5
Color $ 11;
input
Type $
Color $;
run;
What are the values of the variables Type and Color?
A.
Type=daisy, Color=yellow
B.
Type=daisy, Color=w
C.
Type=daisy, Color=daisyyellow
D.
Type= |
j******o 发帖数: 127 | 2 TRUNCOVER
Forces the INPUT statement to stop reading when it gets to the end of a
short line. This option will not skip information.
PAD
Pads short lines with blanks to the length of the LRECL= option.
MISSOVER
Sets all empty vars to missing when reading a short line. However, it can
also skip values. |
f********m 发帖数: 197 | 3 这里用的是list input,daisyyellow之间没有delimeter,所以只读进去前5字母作为
Type.后面的字母当成是第一个variable的一部分,被忽略了。跟truncover的用法无关。
而如果用Column input或者format input并且最后一个variable的长度取到了行末,例如
input Type $ 1-5 Color $ 6-17;
这时候不用truncover的话得到的是
Type color
daisy
用的话则得到
Type color
daisy yellow
:)
【在 h****9 的大作中提到】 : Item 59 of 70 Mark item for review : Given the contents of the raw data file TYPECOLOR.DAT: : ----+----10---+----20---+----30 : daisyyellow : The following SAS program is submitted: : data FLOWERS; : infile 'TYPECOLOR.DAT' truncover; : length : Type $ 5 : Color $ 11;
|
j******o 发帖数: 127 | |