I have a panel of i groups and t periods for a variable y.
I want to expand it so that it has two t dimension tbeg and tend. Then y should be the cumulative sum within the range tbeg and tend. See the example below.
How to accomplish this?
I want to expand it so that it has two t dimension tbeg and tend. Then y should be the cumulative sum within the range tbeg and tend. See the example below.
How to accomplish this?
Code:
// Starting dataset (i are groups, t are time periods, y is the variable to be summed) clear input i t y 1 1 1 1 2 1 1 3 1 2 1 0 2 2 0 2 3 1 end // Ending dataset clear input i tbeg tend y 1 1 1 1 1 1 2 2 1 1 3 3 1 2 2 1 1 2 3 2 1 3 3 1 2 1 1 0 2 1 2 0 2 1 3 1 2 2 2 0 2 2 3 1 2 3 3 1 end

Comment