Given the SAS data set WORK.EMP_NAME:
Name | EmpID |
Jill | 1864 |
Jack | 2121 |
Joan | 4698 |
John | 5463 |
Given the SAS data set WORK.EMP_DEPT:
EmpID | Department |
2121 | Accounti |
3567 | Finance |
4698 | Marketin |
5463 | Accounti |
The following program is submitted:
data WORK.ALL;
merge WORK.EMP_NAME(in=Emp_N)
WORK.EMP_DEPT(in=Emp_D);
by Empid;
if (Emp_N and not Emp_D) or (Emp_D and not Emp_N);
run;
How many observations are in data set WORK.ALL after submitting the program?
A. 1
B. 2
C. 3
D. 5
Answer: B
注解:The new data set WORK.ALL only contains observation which exits in EMP_Name but not in EMP_DEPT, or the other way around. WORK.ALL is:
Obs | Name | EmpID | Department |
1 | Jill | 1864 | |
2 | 3567 | Finance |
For the details of MERGE statement and IN option, please check SAS Base (28).