Hi everyone!

I was wondering if it is possible in Stata to turn Table1 into Table2. I simply want to keep track of the matches and link together firms that are matched and have different names. The data I have is in for of Table 1 and I want to convert it into something similar to table2.

Thanks in Advance!
Table1
name1 name2 matched
Apple Apple Inc. Yes
Apple Inc. Apple Inc Yes
Microsoft Microsoft Co. Yes
Tesla Tesla Inc Yes
Apple Inc Apple Incorporated Yes
Tesla Inc Tesla Co Yes
Table2
name1 name2 name3 name4 matched
Apple Apple Inc. Apple Inc Apple Incorporated Yes
Microsoft Microfost Co. Yes
Tesla Tesla Inc Tesla Co Yes