I have two datasets. One is a panel dataset with year as time and id as unit dimension.
The second one contains the same id but a time period
I want to merge these datasets so that I have the average value of x over that period in the second dataset. How can I do that?
Code:
input year id x 1 1 2 2 1 3 3 1 4 4 1 5 1 2 3 2 2 4 3 2 2 4 2 5 end
Code:
input str10 period int id "1-2" 1 "2-4" 1 "1-3" 1 "2" 1 "1" 2 "2-4" 2 "1-3" 2 "4" 2 end
Comment