Hello,
For my master thesis I have to calculate multiple value weighted portfolios.
Now as I am not that proficient with Stata, I have come to this forum for help.
I currently have the Market Value and the current Portfolio allocation file both with the same form:
The market value file looks as follows:
Date MVFirm A MVFirm B MVFirm C etc.
5/10/2002 MVA MVB MVC etc.
6/10/2002 MVA MVB MVC etc.
etc.
All market values are numbers.
The Portfolio file looks as follows:
Date PortFirm A PortFirm B PortFirm C etc.
5/10/2002 1 1 1 etc.
6/10/2002 2 1 3 etc.
etc.
All portfolio values are within a scale of 1 to 5, which can differ on daily basis.
Now I need to make a new variable for every firm which has to be calculated by dividing the market value of a single firm by the market value of all firms that have the same portfolio number (e.g. 1).
Which should be something in the neighbourhood of
Foreach var of varlist {
g VWport`var' = MV`var' / (sum(MV`var') if Port`var' == 1)
}
However, I cannot find anything close to this when I googled this topic, therefore, I have come here.
If you could help me out, that would be amazing.
Thanks in advance.
For my master thesis I have to calculate multiple value weighted portfolios.
Now as I am not that proficient with Stata, I have come to this forum for help.
I currently have the Market Value and the current Portfolio allocation file both with the same form:
The market value file looks as follows:
Date MVFirm A MVFirm B MVFirm C etc.
5/10/2002 MVA MVB MVC etc.
6/10/2002 MVA MVB MVC etc.
etc.
All market values are numbers.
The Portfolio file looks as follows:
Date PortFirm A PortFirm B PortFirm C etc.
5/10/2002 1 1 1 etc.
6/10/2002 2 1 3 etc.
etc.
All portfolio values are within a scale of 1 to 5, which can differ on daily basis.
Now I need to make a new variable for every firm which has to be calculated by dividing the market value of a single firm by the market value of all firms that have the same portfolio number (e.g. 1).
Which should be something in the neighbourhood of
Foreach var of varlist {
g VWport`var' = MV`var' / (sum(MV`var') if Port`var' == 1)
}
However, I cannot find anything close to this when I googled this topic, therefore, I have come here.
If you could help me out, that would be amazing.
Thanks in advance.