Given the SAS data set WORK.EMP_NAME:
Given the SAS data set WORK.EMP_DEPT:
The following program is submitted:
How many observations are in data set WORK.ALL after submitting the program?
Given the SAS data set WORK.EMP_NAME:
Given the SAS data set WORK.EMP_DEPT:
The following program is submitted:
How many observations are in data set WORK.ALL after submitting the program?
The program performs a merge of two datasets WORK.EMP_NAME and WORK.EMP_DEPT by the key variable EmpID. The condition in the if statement '(Emp_N and not Emp_D) or (Emp_D and not Emp_N)' is used to select observations that are present in one dataset but not the other. WORK.EMP_NAME has EmpIDs 1864, 2121, 4698, and 5463, while WORK.EMP_DEPT has EmpIDs 2121, 3567, 4698, and 5463. The EmpIDs 1864 and 3567 appear in only one of the datasets. Therefore, the resulting dataset WORK.ALL will contain 2 observations.
yes, B, .. the if statement selects the two observations, which do not contribute fully to the merge (s. code below). data emp_name; infile datalines; input name $ empid; datalines; Jill 1864 Jack 2121 Joan 4698 John 5463 ; data emp_dept; infile datalines; input empid department $; datalines; 2121 Acc 3567 Fin 4698 Mar 5463 Acc ; data all; merge emp_name (in=emp_n) emp_dept (in=emp_d); by empid; if (emp_n and not emp_d) or (emp_d and not emp_n); run;
Yes. B is correct since there is 'or' between two conditions.
if not A and not B the answer is 2, otherwise, the answer should be 1.