Dear all,
I have a time series (say 12 observations, one for each month). I would like to create 12 different dummies that will be 1 (for all 12 observations) when the value is above the value in a given month.
So for example, the dummy-january will be one for all the 12 months in which the value is above the value in january. Then the dummy-february repeats this, but comparing to the value in february. And so on, until I have 12 dummies in the end.
My question is: Can I do this without looping over the observations?
The problem is that I have a lot more than 12 observations, and they dont start always at the same point (for example not all start at _n=1)...
Thanks in advance if you can help!
Thiago
I have a time series (say 12 observations, one for each month). I would like to create 12 different dummies that will be 1 (for all 12 observations) when the value is above the value in a given month.
So for example, the dummy-january will be one for all the 12 months in which the value is above the value in january. Then the dummy-february repeats this, but comparing to the value in february. And so on, until I have 12 dummies in the end.
My question is: Can I do this without looping over the observations?
The problem is that I have a lot more than 12 observations, and they dont start always at the same point (for example not all start at _n=1)...
Thanks in advance if you can help!
Thiago
Comment