|
|
|
|
|
|
w********y 发帖数: 371 | 1 Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
The following SAS program is submitted:
data test;
infile 'employee';
input employee_name $1-4;
if employee_name='Ruth' then input idnum 10-11;
else input age 7-8;
run;
Which one of the following values does the variable IDNUM contain when the
name of the employee is "Ruth"?
A.11
B.22
C.32
D. .(missing numeric value)
The answer is B.
I run this code:
data test;
input employee_name $ 1-4;
if employee_name = 'Ruth' then input idnum 10-11;
else input age 7-8;
put employee_name= idnum= age=;
cards;
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
;
run;
And I get the log message:
employee_name=Ruth idnum=22 age=.
employee_name=Sue idnum=. age=40
Can someone help me figure out the procedure? Thank you! | v********9 发帖数: 35 | 2 read Ruth in first record as employ_name and then jump to the second record
and read 22 to idnum. Put the defult value . to age. It uses two records to
to input one observation.
If add the sign @ followed by "input employee_name $ 1-4;", you will get
four observations. |
|
|
|
|
|