I am fairly new to Stata and for my PhD would like to try and reproduce previous research done.

I have two datasets ; dataset1 contains 500 IPOs between 1988 until 1997. Dataset 2 contains firm data of over 4000 firms on three specific dates(31/12/1988, 31/12/1993 and 31/12/1997).




All IPO firms from Dataset 1 need to be matched to firms from dataset 2, according to the following criteria:

-IPO firms of the time period 1988-92 need to be matched to the firm with the same SIC code and closest market value on 31-dec-1988

-IPO firms of the time period 1993-95 need to be matched to the firm with the same SIC code and closest market value on 31-dec-1993

-IPO firms of the time period 1996-97 need to be matched to the firm with the same SIC code and closest market value on 31-dec-1997

-Firm from dataset 2 can only be matched once every 3 years

-If a matching firm in the same industry (based on SIC-code) is not available, then a small firm from another industry has to be chosen




Any help regarding the matching code would be really appreciated, as I’ve spent tens of hours on this already and still can not find the solution.




Kind regards,