SAS Base Programming for SAS 9 — Question 27
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;
infile 'employee';
input employee_name $ 1-4;
if employee_name = 'Sue' then input age 7-8;
else input idnum 10-11;
run;
Which one of the following values does the variable AGE contain when the name of the employee is "Sue"?
Answer options
- A. 30
- B. 33
- C. 40
- D. . (missing numeric value)
Correct answer: C
Explanation
In the SAS program, when the employee name is 'Sue', the program specifically inputs the age from the designated position. The age for Sue is found at positions 7-8 in the data file, which is 33. Therefore, the correct answer is B. The other options do not correspond to the correct input position for Sue's age.