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

st: Re: cleaning panel data

From   Christopher F Baum <>
Subject   st: Re: cleaning panel data
Date   Thu, 26 Sep 2002 08:35:24 -0400

--On Thursday, September 26, 2002 2:33 -0400 Nick wrote:

. bysort firm (year) : gen prob1 = year[1] != year[_N]
. bysort id (region) : gen prob2 = region[1] != region [_N]
. list firm id year region if prob1 | prob2

Logic: for example, sort by -firm- and within each -firm- by -year-.
If the last
value of -year- for each -firm- differs from the first, you have
a problem.
This is a more comprehensive solution than that I proposed. I do think there is still one kind of error that it will not catch, though: literally duplicate obs. with same firmid|year|region, since they will not violate either of the above conditions. It is quite possible that this kind of error can appear in these data. Judicious addition of 'dups' to the above will catch those as well.

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index