Bookmark and Share

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: Merge Panel Datasets


From   "Diana Beketova" <[email protected]>
To   <[email protected]>
Subject   st: Merge Panel Datasets
Date   Sun, 19 Jun 2011 00:13:27 +0200

Dear Statalisters,

I have a problem merging two panel datasets. In one file I have data about
companies' balance sheet and P&L sorted by company's ID-number. It looks
like this: 

Obs	ID-number	year		Total Assets	Operat. Revenue
1	123		2002		500			100
2	123		2005		505			110
3	123		2006		600			120
4	789		2001		550			340
5	789		2005		670			560

So there are missing values within the years, and ID-number repeats itself
for a group of observations. So, I think in this case it can't work as an
unique identifier. 

The next file contains ownership information, also a panel dataset. 

Obs	ID-number	year		Ownership %		Country of
origin
1	123		2002		20%			DE
2	123		2002		50%			FR
3	123		2002		30%			UK
4	123		2005		30%			DE
5	123		2005		40%			FR
6	123		2005		30%			UK
7	789		2001		50%			CN
8	789		2001		50%			US
9	789		2003		70%			CN
10	789		2003		30%			US

Here, ownership information changes over years, but it can also happen that
panel data contains missing values in years. 

Is there any possibility to merge these two files together? 

That it looks like this: 

Obs	ID-number	year		Total Assets	Operat. Revenue
Ownership%			Country of origin		
1	123		2002		500			100
20%				DE
2	123		2002		500			100
50%				FR
3	123		2002		500			100
30%				UK
4	123		2005		505			110
30%				DE
5	123		2005		505			110
40%				FR
6	123		2005		505			110
30%				UK
7	123		2006		600			120
8	789		2001		550			340
50%				CN
9	789		2001		550			340
50%				US
10	789		2003
70%				CN
11	789		2003
30%				US
5	789		2005		670			560

Is it enough to sort the datasets by ID-number and year and then merge them
using these two as unique identifier? In my case I get so little
observations that match after the merge that I think that I am doing
something wrong. 

Thank you in advance!!!

Diana 


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index