Hi everyone,

I have the following unbalanced panel data which stands from year 2000 to 2019:
ID Year X1 aweight
1001 2000 0 0.6
1002 2000 1 1.05
1003 2000 0 0.114
1004 2000 0 1.03
1001 2001 1 1.156
1002 2001 0 0.59
1003 2001 1 0.89
1001 2002 1 0.123
1002 2002 0 1.17
... ... ... ...
1001 2019 0 0.93
1002 2019 1 1.24
1003 2019 0 1.25
1004 2019 1 1.3
I would like to compute for each year, the difference P0,t-P1,t ; where P0,t is the proportion of "X1=0" in the year t; P1,t is the proportion of "X1=1" in the year t and the column "aweight" denotes the analytical weight. Specifically, I would like to have something like that:
Year P0,t - P1,t
2000 ..................
2001 ..................
2002 ..................
....
2019 ..................
Thank you in advance for your comments and suggestions.