Dear all, I wish match each firm-year (tic-fyear) observation with another from the same two-digit SIC code (sic2) and year (fyear) with the closest return on assets in the current year, ROA1. Then, I wish to obtain a performance-matched AEM (ie Jones_PDA) for all firm-years, by subtracting the AEM of the firm with the closest ROA that is in the same industry as the firm. The closest ROA = min(abs(a.ROA1, -b.ROA1)). The lowest difference between ROA1 would be defined as closest ROA1. I ran a sql using the following program, however, it provides Jones_PDA for all the matched firms. I only wish to have the Jones_PDA for the matched firm with closest ROA instead. It does mean that I wish to have Jones_PDA for only ONE matched firm. proc sql; create table Jones_matchedROA1 as select a.tic,a.fyear,a.sic2, min(abs(a.ROA1, -b.ROA1)) as closest_ROA1, sum(a.aem,-b.aem) as Jones_PDA from geog.data a, geog.data b where a.tic ne b.tic and a.fyear=b.fyear and a.sic2=b.sic2 group by a.tic,a.fyear,a.sic2 order by a.tic,a.fyear; quit; Could anyone guide me on how to modify the program/code to achieve my desired output? Thank you in advance for advices. Regards, mspak
... View more