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: automatic joining variables after merging datasets
From
Jörg Eulenberger <[email protected]>
To
[email protected]
Subject
st: automatic joining variables after merging datasets
Date
Wed, 01 May 2013 11:17:07 +0200
Dear Statalisters,
i have two datasets, were the most of the variables are equal, but the
varnames are completely different. I merge the two datasets:
****************
use "1.dta", clear
replace id = id+100
merge m:m id using "2.dta"
gen dataset =.
replace dataset=1 if id >100
replace dataset=2 if id <100
**********************
Now i want to join the Variables like:
replace Q_254509 = Q_254737 if _merge==2
Now my question,
is the a automatic way to find variables with the exact same varlabel
and then copy the value from the second variable to the first variable?
Do you have any ideas for this problem?
Jörg
*
* 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/