Announcement

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

  • egen fill and blocks of varying size

    Is there an alternative to egen, fill that can be used with if/in ?

    I need to generate a pattern of repeating 1's and 0's with blocks of different size. I can do this by using egen, fill and providing an example of the pattern:

    Code:
    egen is_e1, fill(0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1)
    However, I need the sequence to start when a certain condition is met -if qualifier- which egen fill does not support.

  • #2
    Could you partition the data where the condition is met, apply egen, fill and then append data sets back together

    Comment


    • #3
      Yes, that's what I did. It's far from elegant, but does work

      Comment

      Working...
      X