Announcement

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

  • How to fill in missing values across variables with last observed 0 value?

    Dear all

    I have several variables (wide format) and would like to fill in missing values going forward based on the last observed zero. Here is what my data looks like. So, for observation 4, I would like to fill in the last two columns with zero. I would appreciate any advice. Many thanks!

    HTML Code:
         +--------------------------------------------------------------------------------------+
         | T1_0_25   T2_30_55   T3_60_85   T4_9~110   T5_1~140   T6_1~175   T7_1~205   T9_2~265 |
         |--------------------------------------------------------------------------------------|
      1. |       .          .          .          .          .          .          .          . |
      2. |       .          .          .          .          .          .          .          . |
      3. |       .          .          .          .          .          .          .          . |
      4. |       6       6.75          .       3.25          .          0          .          . |
      5. |   6.625          .      2.625          .          0          .          .          . |

  • #2
    Seems as if you should reshape long.

    Comment


    • #3
      Thank you Nick. I did think that but was hoping there was a way without reshaping...

      Comment


      • #4
        There is usually a long-winded way to work row-wise. The deeper issue is Schechter's Law.

        Most things are easier with a long layout.

        As usual, Clyde Schechter didn't discover the law that I name after him, but he's unfailingly energetic and persistent in explaining it here.

        So, not only is this problem tricky, odds are the next one will be tricky too, and the next one, and so on.

        Comment


        • #5
          Good advice- reshaping long right now!

          Comment

          Working...
          X