Hi @PeterClemmensen, Here are the details:- Dataset A:- EmployeeID Transactiontype 123456 Transact1 345678 Transact2 678903 Transact3 Dataset B:- EmployeeID TransactionType Service 123456 Transact1 A1 345678 Transact2 A2 678903 Transact3 A1 I have to compare A and B datasets to determine the Service for each transactions for the employeeIDs. Once we determined the service ,I have to output the data to different fles:- If service is A1 then output to File1 If service is A2 then output to File2 The Logic I have tried it:- data FILE1 FILE2; if _N_ = 1 then do; declare hash h(dataset: "B") h.defineKey('EmployeeID'); h.defineData('TransactionType','Service '); h.defineDone(); end; set A; rc = h.find(); if (rc = 0) then do; if Service ='A1' then output FILE1; else if Service ='A2' then output FILE2; end; run; Please have a look , provide your suggestion
... View more