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 <[email protected]>
To   <[email protected]>
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
[email protected]


-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Ritesh Mistry
Enviado el: Lunes, 08 de Septiembre de 2003 04:24 PM
Para: [email protected]
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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index