Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: help merge


From   Oscar Alberto Budar Mejía <obudar@banxico.org.mx>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: help merge
Date   Mon, 8 Sep 2003 16:38:01 -0500

I would do this:

open master.dta
	.use master.dta, clear

keep variables you want to paste to analytic.dta
	.keep var1 var2 var3...varN

sort the variables you are using to do the merge
	.sort varA varB varC
save master with another name
	.save master2.dta 

open analytic.dta, sort the variables you are using for the merge and
merge it with master2.dta
	.use analytic.dta, clear
	.sort varA varB varC
	.merge varA varB varC using master2.dta

Hope this will help you


Oscar Budar-Mejía
Dirección de Estudios Económicos
Banco de México
Av. Cinco de Mayo No. 18, 3º  Piso
Col. Centro
México D.F. 06059
Tel. 5237 2000, ext. 3583
obudar@banxico.org.mx


-----Mensaje original-----
De: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] En nombre de Ritesh Mistry
Enviado el: Lunes, 08 de Septiembre de 2003 04:24 PM
Para: statalist@hsphsun2.harvard.edu
Asunto: st: help merge

i have a simple problem about merging datasets.

i would like to add variables to analytic.dta from master.dta.

analytic.dta contains a subset of variables from master.dta. both
datasets
have the same observations.  how do i add a specific set of variables
from
master.dta to analytic.dta? i don't want to merge all the data, only
certain
variables.

i'd appreciate any help. thanks!

ritesh

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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