Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: merging data sets


From   [email protected]
To   [email protected]
Subject   st: merging data sets
Date   Tue, 19 Jan 2010 20:34:20 -0700 (MST)

Hello
I want to merge two different data sets from different data sources. In
one data set I have 120 countries and other is about 140. Basically in the
bigger one there are more countries. I tried to merge them according to
country name and year but it did not work due to sorting problem.
Another problem is also my country variable; it was string and therefore I
used encode commend to change its format and to obtain ID numbers.

Data set 1
Country    	id 	year   		ppi
USA     	1	1999		2
USA		1	2000		5
USA		1	2001		0
UK		2	1999		1
UK		2	2000		8
CAN		3	2002		6

Data set 2
Country	id    	year   		corr
USA     	1	1999		2
USA		1	2000		1
USA		1	2001		0
CAN		2	2000		1
CAN		2	2002		2

Merged data set
Country    	id 	year   		ppi 		corr
USA     	1	1999		2		2
USA		1	2000		5		1
USA		1	2001		0		0
UK		2	1999		1		missing
UK		2	2000		8		missing
CAN		3	2000		missing	1
CAN		3	2002		6		2

I will run a panel- regression so trying to organize the data as a panel.
I would appreciate any help.

Thanks
Fatih
University of Calgary
Canada




*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index