Dear Statalist,

My panel dataset is as follows


year firm size sales

2000 firm1 size1 sales1
2000 firm2 size2 sales2
...
2001
2001
...

2020
There are about 200/300 firs in each year.
I want to calculate the mean sales for each year for each percentile (top 25%, 25%-50%,50%-75%,75%-100%) under four
variables based on the size of the firms. For example in the year 2000, top 25% largest firms what were the sales, same year next 25%-50% what were the sales etc.
I use them to time series plots and for tables.
Appreciate your help.