Hi,

I have a (panel) dataset that contains observations with the following variables: company (about 100) - buyer (7) - year (2012-2017) - procedure (about 4200)- procedure_type (65) - price (can be anything).
Companies differ with respect to which of the 4200 procedures they offer. Each buyer buys at least some of the offered procedures at each company.

1. I would like to select the procedures that are being offered in each of the 6 years, by every company and bought by each buyer.
2. In a later subsample I would like to restrict the sample above (under 1) even further by keeping the 10 different procedures with the highest median price.
3. In another subsample
I would like to restrict the sample above (under 1) by keeping the 10 procedures that appear most often.

Any ideas on how to do this? Thanks in advance!