LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 1998, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 31 Jul 1998 13:22:52 -0400
Reply-To:   HERMANS1 <HERMANS1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   HERMANS1 <HERMANS1@WESTAT.COM>
Subject:   Re: FW: Many-to-Many Merge
Comments:   To: "Tang; Dennis" <dtang@AMGEN.COM>
Content-Type:   text/plain; charset=US-ASCII

You are right about the SAS MERGE. I should have restricted my reply to the SAS SQL JOIN. This program shows the difference.

data t1; input @1 v1 $char1. ; cards; a a b b c c ; data t2; input @1 v1 $char1. ; cards; a a a b b b c c c ;

data t3; merge t1 (in=int1) t2 (in=int2); by v1; if int1 or int2; run; proc print data=t3; run;

proc sql; select t1.v1,t2.v1 from t1 as t1 full join t2 as t2 on t1.v1=t2.v1 ; quit;

Shows how long it has been since I have used the SAS MERGE for this kind of task! Thanks. Sig

______________________________ Reply Separator _________________________________ Subject: FW: Many-to-Many Merge Author: "Tang; Dennis" <dtang@AMGEN.COM> at Internet-E-Mail Date: 7/31/98 10:01 AM

Does it really? I thought SAS will only give you a simple merge that returns with number of rows of either the first data set or the second data set, depending on which has more rows.

(Addition to last post) Unless you use proc sql which will give a Cartesian match.

Correct me if I am wrong.

Dennis Tang

---------- From: HERMANS1[SMTP:HERMANS1@WESTAT.COM] Sent: Friday, July 31, 1998 8:52 AM To: SAS-L@UGA.CC.UGA.EDU Subject: Re: Many-to-Many Merge

SAS does. An unrestricted R<<->>R merge (or join) produces a Cartesian product. The dataset it produces contains a number of rows or obs equal to the number of rows in the first dataset times the number of rows in the second dataset. A merge restricted to groups produces a dataset with a number of rows equal to the sum of all group1 rows times group2 rows. In either case, these merges often produce either great volumes of data or misleading results, or both. Sig ______________________________ Reply Separator _________________________________ Subject: Many-to-Many Merge Author: Lau Anna <ylau1@UMBC.EDU> at Internet-E-Mail Date: 7/31/98 12:10 AM

Hi, I need to merge two tables together and it's a many-to-many merge. Does anyone know if SAS support this kind of merge? Thanks for any information. -- ANNA


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