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

RE: st: Merging data


From   [email protected]
To   [email protected]
Subject   RE: st: Merging data
Date   Mon, 31 Mar 2003 15:43:26 -0800

merge  merge [varlist] using filename [, nolabel update replace nokeep
              _merge(varname) ]

merging - before merging make sure the variables have the same names with 
one having an extension so variable can be compared
open the original file then do 

 merge using otherfile

Let me know if this helps. 

Joyce E. Balls, MPE
Project Coordinator
University of California, San Francisco
74 New Montgomery, Suite 600
San Francisco, CA 94105
Telephone: (415) 597-4991
Fax: (415) 597-9194
Email: [email protected]
"Kind words can be short and easy to speak, but their echoes are truly
endless." ~ Author Unknown


	-----Original Message-----
	From:	Ezell, Mike [SMTP:[email protected]]
	Sent:	Monday, March 31, 2003 3:39 PM
	To:	[email protected]
	Subject:	Re: st: Merging data

	Unless I am misunderstanding something, -append- is what you want.

	--On Monday, March 31, 2003 5:32 PM -0600 Reka Sundaram-Stukel 
	<[email protected]> wrote:

	> Dear statalist,
	>
	> I am trying to create a panel dataset and I need to merge several
	> datasets in a particular way but don't know how to. See example
	> below.
	>
	> I have 2 data sets
	>
	> 1999.dta contains
	>
	> id 	income	year
	> 1       $		1999
	> 2 	$		1999
	> 3	$		1999
	>
	> 2000.dta has the same info.
	>
	> I want to merge these two datasets to look like
	>
	> id 	year 		income
	> 1	1999	$
	> 1	2000	$
	> 2	1999	$
	> 2	2000	$
	> 3	1999	$
	> 3	2000	$
	>
	> I would really appreciate any help on this.
	>
	> Reka
	>
	> *
	> *   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/



	---------------------------------------
	Michael E. Ezell, Ph.D.
	Assistant Professor
	Department of Sociology
	Vanderbilt University
	Email: [email protected]
	---------------------------------------
	*
	*   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