Announcement

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

  • Simpler way to write A[_n] + ... + A[_n-10]

    Hi,

    As I am dealing with my data, I have the following issue.
    An simple example of my data looks like this:

    A B
    -more-
    1 0
    1 0
    1 0
    . 1
    . 1
    3 0
    4 0
    -more-

    B is created by B = 0 if A ==.
    And now I want to make the data that are surrounding missing data all become missing data.
    By surrounding, I mean for example the 10 rounds before and after the missing data.
    I've success by replace A =. if B[_n-10] + B[_n-9] + ... + B[_n+10] > 0
    However, the command line is really long, and what I really want to do is 100 rounds instead of 10 rounds, and it will be a problem to write such a long command.

    Is there a simple way to write such summation? Or is there any way to do what I want to do here?

    Thank you!

    James

  • #2
    You don't say that your data are time series, but I guess that they are. In this kind of problem the easiest way to proceed is usually via tssmooth or tsegen (SSC).

    Comment

    Working...
    X