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

Re: st: merging the panel data


From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   Re: st: merging the panel data
Date   Thu, 10 Oct 2002 13:56:35 +0100

> How do I merge two files containing panel data on the basis of case ID as
> well as the year.
> Thanks
> anurag

Make sure both data sets are in Stata format and sorted by ID 
year.  Commands should be similar to...

use file1, clear
sort ID year
save, replace
use file2, clear
sort ID year
merge ID year using file1
tab _merge

The -tab _merge- tells you how many of the observations match up 
from each of the datasets.

See  -help merge-

Neil

Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
[email protected]
[email protected]

"Contrariwise, if it was so, it might be; and if it
were so it would be; but as it isn't, it ain't. That's
logic" - Tweedledee (Alice Through the Looking Glass)
*
*   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