I need your help with a code. I have three samples (Sample A, B, and C). All three samples have information on SIZE, CAPEX, LEVERAGE, INDUSTRY, and YEAR. I want to create two new samples D and E. In sample D, I want to match sample A with sample C based on INDUSTRY, YEAR, SIZE, and LEVERAGE. That is, the matched firm from sample C should belong to the same industry and year as the firm in sample A. Also, the difference in SIZE + difference in LEVERAGE in the matched firms should be minimum. In sample E, I want to match sample B with sample C based on INDUSTRY, YEAR, CAPEX, and LEVERAGE. That is, the matched firm from sample C should belong to the same industry and year as the firm in sample B. Also, the difference in CAPEX + difference in LEVERAGE between the firm in samples B and C should be minimum. Another condition is that the firms from sample C that are matched with sample A should not be used in the matching procedure of sample B. In the attached file I have used an example to show the sample that I have and the sample that I want. I would greatly appreciate it if someone provided me with the code so that I could get the desired output. Best regards, Gokul
... View more