Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Multiple Sequential Merges


From   Lisa Wang <lhwang0925@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Multiple Sequential Merges
Date   Wed, 3 Apr 2013 16:36:05 +1100

Hi all,

I am unsure as to whether I am applying the merge function correctly
or not. I would like to merge values from multiple spreadsheets/.dta
files into one master sheet "master". Here is the code I have at the
moment:

merge 1:1 ID using "C:\Users\Admin\Documents\Data1.dta", force

All good as it will merge all the data into my "master" and then put .
(missing values) for all the observations where it is not matched.
However, if I then run:

merge 1:1 ID using "C:\Users\Admin\Documents\Data2.dta", force

then the values from Data2 do not appear in my "master" file even
though the results say it has been merged (i.e. still appears as . )

What I want to achieve is similar to a VLOOKUP in Excel over multiple
sheets but I thought I would just do a merge in STATA instead.

Data1, Data2, Data3...files all have the same columns as each other if
that is any assistance.

Thank you,
Lisa
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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