Hi,
I have a dataset with a weekly date variable and my explanatory variable X. The treatment in my dataset happens on the week of the 14/01/2010.
I want to create a variable "difference" as shown below, which measures weeks from treatment.
What is the best way to do this? I have tried a few manual ways but they seem to take very long and are extremely inefficient.
Thank you very much in advance!
I have a dataset with a weekly date variable and my explanatory variable X. The treatment in my dataset happens on the week of the 14/01/2010.
I want to create a variable "difference" as shown below, which measures weeks from treatment.
| date | x variable | difference |
| 01/01/2010 | 5.0 | -2 |
| 07/01/2010 | 4.3 | -1 |
| 14/01/2010 | 2.6 | 0 |
| 21/01/2010 | 6.0 | 1 |
| 28/01/2010 | 9..8 | 2 |
Thank you very much in advance!

Comment