Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Value Weighted Portfolios Momentum Strategy
From 
 
"Anna Steinforth" <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: Value Weighted Portfolios Momentum Strategy 
Date 
 
Tue, 19 Mar 2013 00:19:35 +0100 
Hi everyone,
I am trying to implement a Momentum Strategy in Stata. I am very happy, that statalist already helped me with a code for the beginning! :-)
Now I am trying to form value weighted portfolios, but all my trials failed! Now I feel like a stupid girl! :-( 
the table at the beginning looks like this:
date    stock    price    mv
1992m1    1    14.17    28.08
1992m2    1    17.5    34.69
1992m3    1    16.88    33.45
i have stocks from 1 to 300 and dates until 2012m12
I am using this code to build equal weighted portfolios:
gen return6 = ln(price/l6.price)
drop if return6==.
egen portfolio6_6 = xtile(return6), nquantiles(4) by(date)
collapse (mean) f6.return6, by(date portfolio6_6)
gen monthly_r6_6 = F6return6/6
tsset date portfolio6_6                                                                   
gen momentum6_6 = S3.monthly_r6_6 
now,when i use: 
collapse (mean) f6.return6, by(date portfolio6_6)
i need that the return of every reit in the portfolio is weighted with its market value.
How can I change the collapse code to value weight? Is that possible at all? Any idea would be highly appreciated!
Thanks a lot!!! :-)
Best, Anna 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/