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: Generating an index variable with addition and deletion of companies every month
From
David Ashcraft <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Generating an index variable with addition and deletion of companies every month
Date
Fri, 24 Jan 2014 02:01:34 -0800 (PST)
On Friday, January 24, 2014 10:36:29 AM, David Ashcraft <[email protected]> wrote:
Hi Statalist, I am trying to construct a market weighted index wherein every month there is a deletion or subtraction of some securities. I am following S&P Dow Jones mathematics as per Equation 8 on the page 8 of the following document:
http://www.spindices.com/documents/index-policies/methodology-index-math.pdf
My problem is every month, I have some companies added to the index and other are deleted implying that I must adjust my divisor. I am confused with how can I code this.
I am coding this as below but this capture only for one period but I have companies that
tabulate snp
snp | Freq. Percent Cum.
------------+-----------------------------------
0 | 18,642 37.28 37.28
1 | 31,366 62.72 100.00
------------+-----------------------------------
Total | 50,008 100.00
tsset id date1
bys id: egen mtcap=sum(mv)
gen lag_snp=L.snp
//identify companies deleted from index//
gen dum=0
replace dum=1 if lag_snp==snp
The last line is my attempt to identify those companies whether added or deleted in a given month but this does not work for calculation of divisor since companies can be out for quite some time and in that case both coule be equal to zero and dum==1.
Can someone please guide me through,
Regards
David Ashcraft
*
* 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/