Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • tsset Command throws the error : repeated time values in the panel

    Hello everyone, I would like to do a VAR analysis. To do this, I first need to declare my panel data as a time series using the tsset command. Unfortunately, I keep getting the following error: repeated time values within panel.
    Code:
    tsset ID year, yearly
    Attached Files

  • #2
    This is an FAQ -- the main points of which are that Stata is always right on this and so you should hunt the duplicates --

    Code:
    https://www.stata.com/support/faqs/data-management/repeated-time-values/
    and indeed there are duplicates

    Code:
    . duplicates list ID year
    
    Duplicates in terms of ID year
    
      +-----------------+
      | Obs   ID   year |
      |-----------------|
      | 159    9   2017 |
      | 160    9   2017 |
      +-----------------+
    although the other variables for those observation are not identical. A little sleuthing indicates that the identifiers are confused around

    .
    Code:
     groups ID country if inlist(ID, 8, 9)
    
      +-----------------------------------+
      | ID      country   Freq.   Percent |
      |-----------------------------------|
      |  8   Arab World      17     47.22 |
      |  9   Arab World       1      2.78 |
      |  9    Argentina      18     50.00 |
      +-----------------------------------+
    i.e. one observation that should have ID 8 has ID 9. (The percents here are not informative. groups is from the Stata Journal.)

    Comment


    • #3
      Thank you so much Nick! That solved my Problem :-)

      Comment

      Working...
      X