Dear Statalist,

Let's suppose I have the following database, an event study panel with time window [-2,2]. How would you go on to generate missing values for `Var' for each group if the correspondent `t' is missing?

For example, let's check row #12 or the first observation of the group == ABCDE with Timeref == 2. I would need that the next observation would be a missing in `Var' with t = -1. Moreover, that if a group only has `t' == 0, it would generate missing values from -2 to 2 excluding what has data.
Group Timeref t Var
ABCDE 1 -2 12
ABCDE 1 -1 32
ABCDE 1 0 1
ABCDE 1 1 3
ABCDE 1 2 5
FGHIJ 1 -2 63
FGHIJ 1 -1 123
FGHIJ 1 0 53
FGHIJ 1 1 0
FGHIJ 1 2 98
ABCDE 2 -2 12
ABCDE 2 0 3352
ABCDE 2 1 4
ABCDE 2 2 124
FGHIJ 2 0 23
FGHIJ 2 2 23
ABCDE 3 0 56
FGHIJ 3 -1 32
FGHIJ 3 0 76
Do not pay attention to timeref as it can be any sort of date. It's just for an eventual bysort ...

Thank you!