Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: duplicates in timevar in panels


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: duplicates in timevar in panels
Date   Fri, 27 Jun 2008 13:53:27 +0100

-search duplicate panel- shows that this is an FAQ. 

FAQ     . . . . . .  Dealing with reports of repeated time values within
panel
        . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox and M.
Mulcahy
        12/05   How do I deal with a report of repeated time values
                within panel?
                http://www.stata.com/support/faqs/data/repeatedtime.html

The FAQ shows that the problem here may not be as simple as duplicated
observations that should be -drop-ped. 

Note that -drop-ping on the basis of similar id and one time variable is
naturally dangerous unless there are no other variables or all the other
variables are identical in the observations dropped to those kept. That
may be what Mukesh means by "absolutely similar". 

-duplicates- protects you against such errors. 

Nick
[email protected] 

Dherani, Mukesh

One command that I often use to find duplicates in panel data is:

sort panel_id timevar,stable
br panel_id timevar if (panel_id== panel_id[_n-1]| panel_id==
panel_id[_n+1]) & (timevar==timevar[_n-1]|timevar==timevar [_n+1])

this is for identification of duplicates.  
If both the rows are absolutely similar then you may delete any of the
row 

drop if if panel_id== panel_id[_n-1] & timevar==timevar[_n-1]

Mahesh Ramachandran

I am working on a panel data set : 2000 households over 10 years(120
months)

It has a household identifier as panel id and year/month variable as
timevar.

when I tried to tsset it, I get the following result:

. tsset panel_id timevar
repeated time values within panel
r(451);

My goal is to identify and isolates those panels which has repeated time
values and remove the duplicates.
So I tried :
by panel_id: duplicates re timevar,

and response was that duplicates can not be combined with "by" command.
Can you suggest me a way to remove
the duplicates.

*
*   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