Dear all,

We are trying to match a set of 1519 firms (ncusip_ipo) which IPO'd in 1975-1984, to a set of 5435 firms (ncusip_listed) which indicate all firms which were listed on the AMEX and NYSE in 1975-84, by matching according to 3 digit SIC codes (siccd) and market capitalization (marketcap). The matching firm selection procedure should be done as follows:

1. Within each 3-digit SIC code (siccd), the set of 5435 listed firms are ranked by (marketcap). For the 1519 IPO firms in a given 3-digit SIC code industry (siccd), the listed firm with the closest (marketcap) was chosen as the matching firm.
2. Furthermore, the matching firm can be used only once until 3 years have passed.

Can someone please help on both steps 1 and 2? Thanks in advance!

Regards,

Bas