Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: merge on diff id vars


From   Phil Clayton <[email protected]>
To   [email protected]
Subject   Re: st: merge on diff id vars
Date   Fri, 6 May 2011 10:57:15 +1000

Another option would be to use Jeroen Weesie's command -mmerge-, available from SSC. It's like -merge- but with more features including an option -umatch()- which allows you to match on variables with different names. I highly recommend -mmerge- in general as a more convenient and safer tool for merging than -merge-

Phil

On 06/05/2011, at 4:05 AM, Argyn Kuketayev wrote:

> thank you,
> will gen or rename the variable.
> 
> I thought it would be possible to simply provide the keys from each dataset.
> 
> On Thu, May 5, 2011 at 10:06 AM, Daniel Feenberg <[email protected]> wrote:
>> 
>> On Thu, 5 May 2011, Argyn Kuketayev wrote:
>> 
>>> Hello
>>> 
>>> I have two data sets with keys PK and FK correspondingly. i want to
>>> merge them 1:1, except the key names are different in the dataset. i
>>> cant figure out if it's possible by reading the manual. any tips?
>> 
>> . generate pk=fk
>> 
>> and then do the merge? I know SAS has a way to avoid the assignment, but
>> that is because the assignment would cost an expensive pass through the
>> data. Since the single generate statement isn't costly, Stata doesn't need a
>> special "rename as you load" option. (But even in Stata you could just
>> rename the variable in the primary dataset, avoiding even the small cost of
>> the gen statement).
>> 
>> Daniel Feenberg
>> 
>>> 
>>> --
>>> Argyn Kuketayev
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>>> 
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>> 
> 
> 
> 
> -- 
> Argyn Kuketayev
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index