Hi all,

I have panel data with an identifier(ID) and a time variable(mofd, monthly). Based on a characteristic of the IDs, I have formed 10 portfolios. That means that each ID is sorted into a portfolio (1 to 10), every month. Now I am trying to find out how many IDs there are on average in the portfolios. Because the portfolios are formed every single month, in month T there might be 20 IDs in portfolio 1, and 22 in portfolio 2 (etc), but in month T+1 we might have 30 IDs in portfolio 1. So I am trying to find out how many there are on average in each portfolio.

I have heard about ssc unique and distinct, but both of these will only show me the number of distinct IDs per portfolio. I however want to repeat this exercise per portfolio per month, and then simply report the average.

Any ideas?


Thanks,

Erik