Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: _merge


From   "Dr. Frederick Wolfe" <fwolfe@arthritis-research.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: _merge
Date   Tue, 26 Aug 2003 07:45:26 -0500

Nick's point is well-taken. To change the default behavior of -merge- would be a bad idea and break too many things (with a program called -merge-).

In the other hand, when users -merge-, they take responsibility for a number of things, including that the data are properly sorted. I think it is reasonable to tell users that if they call merge, then _merge will be deleted. And it doesn't seem to me that use,clear and merge,drop are conceptually different. But Nick is probably right, this should be done with a wrapper. But it should be remembered how popular -mmerge- was, because it solved this and a few other older problems that bothered so many that merged repeatedly.

A little more on this. xi: variables are automatically dropped. If you want to keep them, then they need other names. r() are discarded. More and more I find myself automatically dropping variables that may be in memory when certain programs are called. This happens in cases when certain program share the creation of new variables. For example, programs that describe costs and programs that address poverty may both create some of the same variables. It is better, I think, for [my] programs like this to capture drop all variables that will be created. In many respects, I think that _merge is like that. It is there, you have looked at it (or not, sometimes at your peril), and you are willing to drop it.

Why would one want an automatic drop? Sometimes in a program I have the following type code.

merge a b using c
merge a b using d
merge a b using e
merge a b using f

I would not write code like this unless I were sure that the merges were safe. Of course, there are other reasons.

Be that as it may, I think Nick is correct and changes need to be done with wrappers. Perhaps such a program should include the type of messages that -mmerge- had, warning you when somethine was amiss, even when _merge was dropped.

Fred


The default behaviour of -merge- is nevertheless there for your 
benefit. For every highly experienced Stata user like Fred, who 
despite vast experience nevertheless forgets this occasionally, 
there will be many more less experienced users who will forget this
more frequently --- and some of those times they may be 
protected against some serious mistake to do with their
dataset. 

Now as for Fred's suggestion: I can't see Stata Corp 
implementing this, but even if they are tempted 
I am going to beg them not to. In addition, this 
just will not keep "everyone happy" -- especially, 
I am astonished at the suggestion of changing 
the default behaviour of -merge-. How many ado
files or do files is that going to break? (Even under 
version control.) What if you missed the announcement???



<<winmail.dat>>




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index