Hello Statlist, hope everyone is in good condition

I've yearly dataset about supplier sale from major customers.

I want to measure frequency of supplier sales transactions from major customer

major customer is identified by a CID code which is repeating for each supplier during a fiscal year, representing frequency of transactions.

Specifically, I wanna generate a dummy variable that equals one if frequency of transaction of a supplier (among all other suppliers) lies in the top 50th percentile, and zero otherwise.

Let me know if you need more explanation to understand my query

Thanks