SAS Base Programming for SAS 9 — Question 29
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are shown below:
WORK.EMPLOYEE WORK.SALARY -
fname age name salary
Bruce 30 Bruce 25000 -
Dan 40 Bruce 35000 -
Dan 25000 -
The following SAS program is submitted:
data work.empdata;
by fname;
totsal + salary;
run;
Which one of the following statements completes the merge of the two data sets by the FNAME variable?
Answer options
- A. merge work.employee work.salary (fname = name);
- B. merge work.employee work.salary (name = fname);
- C. merge work.employee work.salary (rename = (fname = name));
- D. merge work.employee
Correct answer: D
Explanation
The correct answer is D because it merges the WORK.EMPLOYEE dataset without altering any variable names. Options A, B, and C incorrectly attempt to rename or match variables that do not align with the merging criteria, which would lead to errors or incorrect merges.