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]

st: combine two data sets whose variable names are all different


From   Amanda Fu <[email protected]>
To   [email protected]
Subject   st: combine two data sets whose variable names are all different
Date   Tue, 9 Nov 2010 18:37:15 -0500

Dear Stata listers,

I am writing to see if anyone could give me some help with merging two
data sets. The master data set is bigger. The second data set just
contains 1 observation. My goal is to add the one extra observation
into the mater data set. Unfortunately, all the variables (about 300)
in the 1-observation data set are named totally different from those
in the big data set, although the meaning of the variables can be
matched. The variable labels in the two data sets are only close for
matched variables. The sequence of the variables are kind of close but
not exactly the same.

Put it in another way, the following is what I wanted to merge:
--------------------------------------------------------------------------------------
1 big data set         500 obs  350 variables    variables named like
1 small data set       1 obs    300 variables    all variables are
named differently

big data set                                 |           small data set

var name           var label              |         var name     var label
a1                   disease type1       |         distype1       n.a.
a2                   disease type2       |         distype2       n.a.
a3                   disease type3       |        cannot find similar variable
b1                   hospital name       |         hospital       n.a.
b2                   tx duration            |         txlength       n.a.
c1                   date of birth          |         birthdate      n.a.
--------------------------------------------------------------------------------------

In my opinion, what I could do is just to go through all the
variables,  check the variables one by one, and match all the
variables in order to add the 1 observation to the master data set.
This will be time consuming and kind of tedious. I was wondering if
there is any way to merge these two data sets easier.

Thank you for your help.

Best wishes,
Amanda Fu
*
*   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