Date: Tue, 18 Aug 2009 08:12:43 -0700
Reply-To: ash007 <ramsamyashley@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: ash007 <ramsamyashley@GMAIL.COM>
Organization: http://groups.google.com
Subject: Left Join with Hash
Content-Type: text/plain; charset=ISO-8859-1
hello sas-users,
i would like to obtain the same datasets (output) for the 2 methods
below, i want please to have the same dataset of the slq method.
data table_bidon1;
input x1 x2 x3 x4 x5 $; cards;
1 5 5 1161 abéen
2 5 5 1161 abéen
3 6 3 1336 alméc
4 1 5 1499 aniel
;
run;
data table_bidon2;
input w1 w2 w3 w4 w5 $; cards;
3 6 3 1336 alméc
4 1 5 1499 aniel
5 6 3 1336 alméc
6 1 5 1499 aniel
5 6 3 1336 alméc
6 1 5 1499 aniel
3 6 3 1336 alméc
4 1 5 1499 aniel
3 6 3 1336 alméc
4 1 5 1499 aniel
3 6 3 1336 alméc
4 1 5 1499 aniel
3 6 3 1336 alméc
4 1 5 1499 aniel
;
run;
proc sql;
create table jointure_bidon_sql as
select a.x1,b.w2
from table_bidon1 as a
left join table_bidon2 as b
on a.x1 = b.w1
;
quit;
data jointure_bidon_hash (keep = x1 w2);
if _n_ = 1 then do ;
if 0 then set table_bidon1 table_bidon2;
dcl hash h (dataset: "table_bidon2");
h.definekey ("w1");
h.definedata ("w2");
h.definedone ();
end;
set table_bidon1;
if h.find (key: x1) ne 0 then call missing (w2);
run;