[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Data Merge Question

From   "Gabi Huiber" <[email protected]>
To   [email protected]
Subject   Re: st: Data Merge Question
Date   Thu, 31 Jan 2008 19:59:27 -0500

If the Using data consist of unique (var1 var2 var3) combos, the
simplest thing to do is to make it master. Call it Udata, and the one
you said was in memory let's call Mdata. So instead of

use Mdata, clear
merge var1 var2 var3 using Udata


use Udata, clear
merge var1 var2 var3 using Mdata

Stata will note that "var1 var2 var3 not unique in using data" but
it's not an error and you don't mind that.


On Jan 31, 2008 7:41 PM, Lektzian, David <[email protected]> wrote:
> Dear Statalist,
> I am trying to merge together two datasets that look something like
> this:
> Data in memory
> var1  var2  var3 [additional variables]
> Using Data:
> var1 var2 var3 [additional variables that I want to add to the data in
> memory]
> The problem I'm having is that the data in memory is not unique on these
> three variables, but the using data is.  I do not mind that the data in
> memory is not unique on these variables, because there is a fourth
> variable in the data in memory that makes them unique.  But this
> variable is not part of the using data.  I just want to merge in
> additional variables from the using data so that they can be added to
> the data in the memory.  I don't mind that the observations are repeated
> in the data.  After the merge I just want to have the same number of
> observations that I began with in the data in memory.  Here is what I
> tried and the result:
> .merge var1 var2 var3 using "C:\Data.dta", uniqmaster nokeep
> variables var1 var2 var3 do not uniquely identify observations in the
> master data
> I'm sure that I am overlooking something very simple.  Any help would be
> appreciated.
> Thanks,
> David
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

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