Hi,
I am struggling to understand why I am unable to xtset my panel data.
I have used the Understanding Society Study and appended years 1991 to 2012. I am only interested in those who were part of the BHPS study (1991-2008) which can be identified via the variable pid.
For some reason I am getting the error message 'repeated time values within the panel'.
To try and solve this I have used the following commands:
sort pid year
duplicates report pid year
duplicates list pid year
duplicates tag pid year, gen(isdup)
edit if isdup
*I can see there are duplicates of people as their pid appear twice in the same year
drop isdup
**This has not solved the issue
labelbook pid
sum pid if pid==-8
*If pid=-8 this means that the person was not in the BHPS survey
*We can drop these observations as we are interested in the effect of a policy that took place before the Understanding Society Survey and the sample is large enough
drop if pid==-8
*This drops 155,484 obs
xtset pid year, yearly
What other potential solutions are there to this issue?
Thank you in advance.
Related Posts with Error message: Repeated time values within panel
chi2 not allowed with mrtab and weightHi, I try to do a chi2 test of significance. When I do not add weight, stata allows it, but when I t…
Panel RegressionHello At the moment I'm trying to do regressions with panel data. If I make a OLS regression with t…
Panel data and within individual effectsHi everyone, I have a panel dataset where I follow individuals for 12 waves (new_waves). What I am …
Insufficient data when trying looped regressions and storing betasHi, I am trying to run a loop of regressions by an index called funddateid and then storing the bet…
How to add reference lines (yline) for different ID?Hi all in Statalist, I need help with having two reference lines in the same plot. In our study, w…
Subscribe to:
Post Comments (Atom)
0 Response to Error message: Repeated time values within panel
Post a Comment