I am trying to run a matched pair regression across companies using data in two different table. I have about 9700 firms in one data set (help1) and in another data set (help) which contains a list of firms connected to each of the 9700 firms. Sample of data is attached.
From the 2 tables below, company with lpermno 10001 in table Help1 is connected to company 8433 and 1723398 as shown in table Help.
In the end, I want run a pair regression where I regress volume of company with lpermno 10001 on volume and stk_returns of firm 8433 and do same for other companies connected to firm wth ID 10001. Thus I want to do same for company 10001 and 1723398...etc
In brief, I run regression for 10001 and 8433; and 10001 and 1723398 by regressing volume of firm 10001 on volume and stk_returns of firm 8433. Each company is connected to several other companies hence seeking for your help to run the regressions at a go.