Bivariate sorting

I wish to sort the companies on a variable, say A, in ascending year. Then, I wish to divide them into three categories of equal number such that category 1 has the lowest values and category 3 has the highest values. Now, I would again repeat the task with another variable, say B and accordingly three categories will be made, say 4, 5 and 6. Now, I want to extract common companies from category 1 and 4; 1 and 5; 1 and 6; 2 and 4; 2 and 5; 2 and 6; 3 and 4; 3 and 5; 3 and 6. This entire process will be followed every year. If anyone can help me please. I am in dire need of help.


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.