04-28-2018 10:23 AM
I have 2 data sets, One is containing terminated employees of the organisation and other contains full employee list(working and terminated both) now I want a data set which contain only working employee. I want to use proc sql merge. Please suggest which merge will get the correct data set.
Thanks in advance !!
04-28-2018 10:47 AM
04-28-2018 10:59 AM
all you need is a simple look up with a subquery like:
proc sql; create table want as select * from full_employee where employee_id not in (select employee_id from terminated); quit;
04-28-2018 11:27 AM
You mentioned "I want a data set which contain only working employee."
Challenge your interviewer why you need a join. The need for join arises only when you need to extract a variable/variables from the look up dataset. Your interview question doesn't seem to mandate a pull of any external information. All the best!
04-28-2018 04:58 PM
If all you had were IDs you could do:
proc sql; create table want as select employee_id from full_employee except select employee_id from terminated; quit;
again, not a join.
04-29-2018 11:03 AM
proc sql; create table want as select a.employee_id from full_employee a full join terminated b on a.employee_id = b.employee_id where b.employee_id is missing
with join need to do a full join followed by employee_id is missing for terminated table