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
NO observations error using ssm with probability weightsHello everyone, I am estimating an endogenous switching regression model by means of ssm. This latt…
generate a variable with if conditionDear community, I am a real newbie to both Stata and this forum so please be patient with me and my…
Staggered dif in difHello Statalists! I am having troubles in dealing with staggered dif in dif I am trying to evaluat…
Taking the most recent non-missing value by idI have the dataset below: unique id of individuals (variable called pf_id), national id of individua…
Multiple independent in time series regressionHi all, I have calculated variables which I would like to regress on macroeconomic variables like i…
Subscribe to:
Post Comments (Atom)
0 Response to Error message: Repeated time values within panel
Post a Comment