Dear Experts,

I have an unbalanced panel data of all NYSE, AMEX and NASDAQ firms from 1998 to 2018. The panel setting is
Code:
xtset Firm_id Year
.

May I please have your help with below question?

I want to group firms into small, medium and large (based on size. for example the top 1/3 will be grouped as large) each year and run the models for each size category.

1. how can I only run the regression for firms that ranked the top 33.333th percentile (1/3 of firms in each category) on their size figures each year? Do we have a code for this?

2. or do I need to first group them and then run it? Does anyone have a short cut?

Thanks in advance

Neng