Hi Joost,

I was wondering whether there is some SAS macro or some suggested efficient way to find matches for treatment firms.

I need the control firms to be in the same size decile, market to book decile, momentum decile as the treatment firms, also same industry and year

After the above constraint, I require the treatment firms and control firms to have the smallest distance of analyst coverage (three matches are required).

The dumb way of finding matching in my mind is the following steps:

1. Assign the whole sample size decile, market to book decile and momentum decile numbers.

2. Construct two tables: treatment table and the Potential control table;

3. Merge the tables by requiring the obs in the treatment table and the potential control table have the same size decile number, market to book decile number, momentum decile number, the same sic2 and the same fiscal year;

4. Keep the observations with the smallest difference of analyst coverage in the merged table (I only know how to keep the smallest one, but do not know how to keep the three smallest one！Could you help me with that?)

Is my way of doing it appropriate? And is there any smarter way of finding the matches by sorting basing on different firm characteristics?

Thank you very much,

Anna