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 (June 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Jun 2004 16:47:53 -0400
Reply-To:     sashole@bellsouth.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Paul M. Dorfman" <sashole@BELLSOUTH.NET>
Organization: Sashole of Florida
Subject:      Re: Why would you ever merge without a by variable
Comments: To: "Wainwright, Andrea" <andrea.wainwright@CAPITALONE.COM>
In-Reply-To:  <D5170EA5CC08D5119F160002A52CBD1F25AD3FF6@kdcnt4mbx06.kdc.capitalone.com>
Content-Type: text/plain; charset="us-ascii"

Andrea,

1. First (or rather last, but take it first), check your system option MERGENOBY= supplied by SAS (in response to compaints similar to yours). It is apparently currently set to NOWARN. Otherwise you can set it to WARN or ERROR, which ought to be self-explanatory.

2. Second, Ian Whitlock has five golden rules (and presented them at the most recent SESUG) which, if they are abided by, make MERGE virtually bulletproof. "Never MERGE without BY" is one of the rules. I objected to this point when Ian was first giving the talk a trial shot at Westat and reminded him that one of the most useful ways to create a "lead" variable looking N records ahead - introduced by Ian himself! - is

merge dataset dataset (firstobs = <N> rename = (var = _compvar)) ;

Well, Ian replied, create a unique key (for example, enumerate revords) and merge by the key. Which is of course correct, but perhaps not very efficient, so this is the single Ian's merge rule, to which I take exception. However, since I do remember that there is a potential caveat, I set MERGENOBY=WARN.

Kind regards, ---------------- Paul M. Dorfman Jacksonville, FL ----------------

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of Wainwright, Andrea > Sent: Wednesday, June 30, 2004 4:17 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Why would you ever merge without a by variable > > OK, I have spent the last couple of days chasing my tail > trying to figure out my weird results, and of course it ended > up being something stupid. > > I was merging, and I forgot to tell it BY my sorted variable. > > Would there ever be a reason to merge by not use a BY > variable? Why isn't there at least a WARNING: that says "Hey > idiot. You didn't use a BY variable." > > That would have saved me some time. (I am anal and do check the log.) > > Anyway, I am really just ranting, but I really would love a > real world example where you merge without a BY variable. > > Thanks > > ************************************************************** > ************ > The information transmitted herewith is sensitive information > intended only for use by the individual or entity to which it > is addressed. If the reader of this message is not the > intended recipient, you are hereby notified that any review, > retransmission, dissemination, distribution, copying or other > use of, or taking of any action in reliance upon this > information is strictly prohibited. If you have received this > communication in error, please contact the sender and delete > the material from your computer. >


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