As an alternative to PROC SQL for speed, I want to use hash tables to left join multiple tables. I have 4 tables - A, B, C, D. Tables B, C, and D each have their own 'key' fields that table A possesses as well. I am trying to left join B, C and D onto A on the basis of this. The below is my code, it is based on this article: https://www.lexjansen.com/nesug/nesug06/dm/da07.pdf DATA COMBINED; IF 0 THEN SET A B C D; IF _N_ = 1 THEN DO; DECLARE HASH B_(dataset: 'B'); B_.defineKey('B_key'); B_.defineData('B_data'); B_.defineDone(); DECLARE HASH C_(dataset: 'C'); C_.defineKey('C_key'); C_.defineData('C_data'); C_.defineDone(); DECLARE HASH C_(dataset: 'D'); D_.defineKey('D_key'); D_.defineData('D_data'); D_.defineDone(); END; DO UNTIL (EOF); SET A END = EOF IF B_.FIND(KEY:'A_KEY')=0 THEN OUTPUT; ELSE IF C_.FIND(KEY:'A_KEY')=0 THEN OUTPUT; ELSE IF D_.FIND(KEY:'A_KEY')=0 THEN OUTPUT; ELSE DO; CALL MISSING(OF 'B_data', 'C_data', 'D_data'); OUTPUT; END; END; STOP; RUN; The trouble is at the end; the iteration through the table 'A' doesn't go the way I'd like, and it produces some strange results (like values being filled even though I wouldn't expect there to be a hash key match). Does anyone know of the correct way to iterate through a table and match multiple hash keys to simulate a SQL left join? Much appreciated.
... View more