Hi all, I have data on firm id (e.g., 1,2,3), Year (e.g., 2015, 2016) and SIC membership (Standard Industrial Codes), such that each firm may be a member of multiple SIC codes in a given year. These SIC codes represent a firm’s primary peers - that is, firms with which it competes directly by being present in these SIC codes each year. Also, a firm’s SIC membership may vary from year to year (e.g., firm 1 competes across 6 SICs in 2015 but only 3 in 2016). I want to construct variables for secondary peer SIC codes (SPeer1, SPeer2… SPeern) for each firm in each year – that is, those SIC codes in which a firm does not directly compete (that is, a firm does not belong to these SIC codes in a year), but its primary peers compete with other firms in these SIC codes. For example, secondary peer SIC codes for firm 1 in 2015 are 4517, 4518, 4519, 4521 and 4522 because firm 1 does not directly compete in thee SIC codes in the year 2015, but its primary peers, firm 2 (competing with firm 1 in 4512 and 4516) and firm 3 (competing with firm 1 in 4513) compete with other firms in these SIC codes in 2015. F Year SIC1 SIC2 SIC3 SIC4 SIC5 SIC6 SPeer1 SPeer2 SPeer3 SPeer4 SPeer5 1 2015 4511 4512 4513 4514 4515 4516 4517 4518 4519 4521 4522 2 2015 4512 4516 4517 4518 4519 4511 4513 4514 4515 3 2015 4513 4520 4521 4522 4511 4512 4516 4518 1 2016 4511 4512 4513 4518 4519 2 2016 4512 4519 4511 4513 3 2016 4513 4518 4511 4512 Will appreciate if you may help me with a code to construct the secondary peer SIC Codes. Regards, Adnan
... View more