I have an unbalanced panel data, which include the following variables:
panel id: wficn - mutual fund identifier
time: year
(wficn, year) uniquely identifies each observation
each fund's return: mret
each fund's total net asset under management: TNA
mgmt_cd, mutual fund management company (or so-called fund family) identifier ; each mutual fund management company have multiple funds at each year
I want to generate a new variable, call it x, which is the TNA-weighted average of returns of all the other funds in the same fund family to which fund i belongs.
say for a fund family at year t, it has three funds: fund 1, fund 2 and fund 3;
family_id fund_id TNA return x
fam1 1 50 0.1 = (150/(150+100))*0.2+(100/(150+100))*0.4
fam1 2 150 0.2 = (50/(50+100))*0.1+(100/(50+100))*0.4
fam1 3 100 0.4 = (50/(50+150))*0.1+(150/(50+150))*0.2
How to accomplish this task by coding in stata? Thank you so much for your help.
panel id: wficn - mutual fund identifier
time: year
(wficn, year) uniquely identifies each observation
each fund's return: mret
each fund's total net asset under management: TNA
mgmt_cd, mutual fund management company (or so-called fund family) identifier ; each mutual fund management company have multiple funds at each year
I want to generate a new variable, call it x, which is the TNA-weighted average of returns of all the other funds in the same fund family to which fund i belongs.
say for a fund family at year t, it has three funds: fund 1, fund 2 and fund 3;
family_id fund_id TNA return x
fam1 1 50 0.1 = (150/(150+100))*0.2+(100/(150+100))*0.4
fam1 2 150 0.2 = (50/(50+100))*0.1+(100/(50+100))*0.4
fam1 3 100 0.4 = (50/(50+150))*0.1+(150/(50+150))*0.2
How to accomplish this task by coding in stata? Thank you so much for your help.