Announcement

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

  • #16
    Thank you, Nick for sharing this code and many others. A huge help.

    https://www.statalist.org/forums/for...2#post1369812:

    I experienced the same by running the suggested code:

    bysort company : replace turnover = turnover[_n-1] if missing(turnover)

    It works if the var turnover is sorted so the replacing value is at the top.
    The code only replaces the values below if the var contains missing values above.

    /Anne

    Comment


    • #17
      Thanks for the thanks in #16 but if you're asking a new question I am not clear what it is.

      There may be point to copying previous values downwards (meaning usually, forwards in time) if those previous values are not missing.

      On a different level, a variable like turnover is precisely the kind of variable that can't reliably be interpolated or imputed if missing. The context implies data for companies in time. but as people in economics or finance know better than I do turnover is typically highly volatile. If it is very smoothly changing, the task may call for interpolation. More commonly a missing value is just a big question mark.

      I expect that this doesn't give you what you want from #16 and if not please try again with a specific data example explaining your precise problem.

      Comment

      Working...
      X