Date: Wed, 4 Feb 2009 12:12:33 -0500
Reply-To: Steven Raimi <sraimi@MARKETINGASSOCIATES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Steven Raimi <sraimi@MARKETINGASSOCIATES.COM>
Subject: Re: Merging two datasets one one field but named differently.
Use dataset option (rename=(oldname=newname)) on one of the incoming
datasets to use SAS merging:
data merged_ds;
merge file1 (in=f1)
file2 (in=f2 rename=(id=mbr_id);
by id;
if f1 and f2; * this is the equivalent of inner join shown below;
run;
As someone else has pointed out, PROC SQL does not require the matching
vars to be the same (or to be presorted, BTW):
proc sql;
select desired columns
from file1
inner join file2
where file1.id = file2.mbr_id;
quit;
Steve
|