Announcement

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

  • Randomly Reassign Year in Panel Dataset

    Hello, I have four years of data (2015, 2016, 2017, 2018). Each year, there are multiple observations. How do I randomly reassign year to this dataset? For example, all data in 2015 will be in 2016 and all data in 2017 will be in 2015.

  • #2
    I don't understand what you want to do.

    For example, all data in 2015 will be in 2016 and all data in 2017 will be in 2015.
    Code:
    recode year (2015 = 2016) (2017 = 2015), gen(year_2)
    will do that. But that is not a "random" reassignment. If this code isn't what you have in mind, please post back with a more detailed, clearer explanation of what you are trying to accomplish, not just what numbers you want to change to what, but what the purpose of all this is in the first place.

    Comment


    • #3
      Hello, thanks for the feedback. Yes, the code works!

      Comment

      Working...
      X