楼主: lqiantobe
4877 11

[讨论]请教高手SAS EXAM 2题 [推广有奖]

11
qt600 发表于 2007-3-12 13:25:00

1.A raw data file is listed below:
----|----10---|----20---|----30
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
The following SAS program is submitted using the raw data file as input:
data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;
How many observations will the WORK.HOMEWORK data set contain?

A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.

根据偶对二楼解释的理解:

根据IF语句,要满足age less equal 10;如果不符合条件的话,就被认为是missing value.在name,age, height三个值中,除了age,其他两个仍然存在.

1.John McCloskey   missing   71
2.June Rosesette    10    43
3.TinekeJones      9    37

最后的结果还是3个obs.

PS:不肯定一定对,还望高手指正.

12
Vulpecula 发表于 2007-3-12 14:24:00

Obs name age height

1 John . 35
2 June . 10
3 TinekeJo 9 37

我觉得是由于第1、2个观测的姓和名分开,其实只有John和June被作为name读入,所以其age都应该是缺失。

而如果将这两条观测姓与名之间的空格删去,结果就会是楼主所说的,有2个符合age<=10的观测。

Obs name age height

1 JuneRose 10 43
2 TinekeJo 9 37

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-26 08:28