Hi,
My dataset is as following:
Change5 are portfolios which are formed each month. I would like to count how many portfolios consist of less than 30 stocks (count).In my head I have something like the following formula: count if time, change5 and count is the same. So for example:
All these observations from the sample above are in the same portfolio, so this would count as 1 portfolio.
Is there an easy formula for this?
Thanks
My dataset is as following:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long gvkey float(time change5 count) 101340 422 2 20 101538 422 1 21 208224 422 1 21 100131 422 1 21 100499 422 4 14 101317 422 4 14 102283 422 1 21 221020 422 2 20 102902 422 5 16 19591 422 2 20 12384 422 4 14 19565 422 5 16 100760 422 4 14 100862 422 1 21 100095 422 1 21 101048 422 1 21 11749 422 2 20 100149 422 3 19 100980 422 1 21 18636 422 3 19 100619 422 3 19 100913 422 4 14 100045 422 2 20 102569 423 2 20 100816 423 4 14 101310 423 1 21 19904 423 5 16 101207 423 4 14 100728 423 5 16 101343 423 3 19 222305 423 5 16 100774 423 4 14 200189 423 3 19 14620 423 3 19 220392 423 2 20 19565 423 5 16 100951 423 3 19 19579 423 5 16 4439 423 1 21 12368 423 5 16 100060 423 1 21 end format %tm time
Code:
input long gvkey float(time change5 count) 101538 422 1 21 208224 422 1 21 100131 422 1 21 102283 422 1 21 100862 422 1 21 100095 422 1 21 101048 422 1 21 100980 422 1 21
Is there an easy formula for this?
Thanks

Comment