LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page