SAS Certified Base Programmer 123 Questions (110)
The contents of the raw data file EMPLOYEE are listed below:
----|----10---|----20---|----30 Ruth 39 11 Jose 32 22 Sue 30 33 John 40 44
The following SAS program is submitted:
data test; in file' 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)
Topics:
SAS Base Questions |
8 Comments »
B
please add a semicolon after run 😉
cheers
Thanks. I added it just now.
pls explain….
The correct way to read program as
Input employee_name $ 1-4 @;
If employee_name = ‘Ruth’ then
input idnum 10-11;
else input age 7-8;
This way you will have 4 observation.
In the Original program there are two input statement which read two lines instead of one line. Here you will have only two observation.
Please explain the answer.
The answer is correct.
But I don´t understand why.
Please help meee!!!
I think we need an @ behind the statement:
Input employee_name $ 1-4
to hold the name while read the age and idnum in the same line, or SAS will read ‘Ruth’, then input idnum 10-11 of next line, which is 22, the idnum of Jose by default.
I don’t know if I am correct.
I think we need an @ behind the statement:
Input employee_name $ 1-4
to hold the name while read the age and idnum in the same line, or SAS will read ‘Ruth’, then input idnum 10-11 of next line, which is 22, the idnum of Jose by default.
I don’t know if I am correct. Hope it helps.