Date: Thu, 8 Feb 2001 13:46:55 -0500
Reply-To: Doug Dame <dameda@SHANDS.UFL.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Doug Dame <dameda@SHANDS.UFL.EDU>
Subject: Re: Behaviour of many-many match merging in SAS
Content-Type: text/plain; charset=US-ASCII
Howard Schreier <Howard_Schreier@ITA.DOC.GOV> is bothered that
>> the behavior of a many-to-many MERGE within a BY group
>> is not the same as the behavior of a many-to-many MERGE
>> in the absence of a BY statement.
I'm snipping his example entirely (mostly because I would have had to include the whole thing), but the end result is
MERGE w/ no by-var
>> Obs left right
>> 1 A 1
>> 2 2
And MERGE with a (subsequently dropped) by-var
>> Obs left right
>> 1 A 1
>> 2 A 2
And concludes:
>> It seems to me that the two outputs should be the same,
>> one way or the other. But they are not. If this is consistent
>> behavior, it is consistent in some rather subtle way.
I think it all makes sense if you assume a "no by-var" merge is in fact merely short-hand for:
data COMBINE;
merge LEFT RIGHT;
by implicit_by-var [valued as _N_]
In that case, each record would be processed as a FIRSTdot. Hence the variable LEFT is re-initialized as 'blank' at the top of the PDV when Mr. SAS recognizes that there is no incoming record in the LEFT dataset that has a by-value of '2'.
HTH
Douglas Dame
Shands HealthCare
Gainesville FL USA