Bookmark and Share

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]

Re: st: Calculating returns if a stock is delisted


From   "C. Evans" <[email protected]>
To   [email protected]
Subject   Re: st: Calculating returns if a stock is delisted
Date   04 Jul 2013 17:53:39 +0100

Dear Satalist

Problem Solved!

The solution was to create new variables for each situation and then use -egen- and rowtotal( ) to finally add them up. I created 3 variables. One for delisted returns with codes. 2nd for normal returns if we were not at the delist date, ensuring I didn't count the final date of the sample as a delist date. 3rd variable was for the stocks which were delisted but they didn't have a delist return or code.

I hope this may help someone else out there. Sorry for the spam.

Best Regards,
Chris Evans
On Jul 4 2013, C. Evans wrote:

Dear Satalist

Sorry if you have already replied (I was on the stata digest) so please forward the replies if you have. I have been working on this and will give you an update - see my original email below for previous work:

For the delisting stocks that have delist codes I have now worked out their discounts and have them stored as delistreturn

gen discountreturn500 = (-0.3)*delistret if delistcode>499 & delistcode<601
gen discountreturnrest = (-1)*delistret if delistcode<500
egen delistreturn = rowtotal( discountreturn500 discountreturnrest )
egen maxdate = max(date) if return<5000, by(id)
gen date2 = (date)
gen nodelist =1 if maxdate==13879

The maximum date is 13879 which corresponds to 31Dec1997. I now need to create a returns variable that uses the normal return if the nodelist =1 (so the stock doesn't delist before the end of my sample)or if we are not at the delist date. At the delist date the variable must use the delist return value if it is available. If the delist return is not availible it must calcualte a delist return by using normal return*(-1). Thinking about it now I should probably create a delist date variable where -gen- delistdate = 1 if date2<13879 & date2==maxdate

I know this is quite confusing,

Best Regards,
Chris Evans


-----------------------------------------------
Dear Statalist

My dataset goes from 1964 to 31 December 1997. I am looking at stock
returns and trying to create a new variable that will be related to
returns. This new variable will use DelistRet (delisted return) if avilable
and then use the delist code to determine what to multiply it by. As such,
a delist code of between 500 and 600 would be multiplied by -0.3. However,
sometimes the stock finishes at a date before 31 December 1997 and has no
delistcode or delistret, for this I need to multiply the Return by -1. For
all the other days when the stock is trading and not delisted I would just
use Return.

Below is an example of my data (not going all the way to 31Dec1997)

Id  Date   DelistCode DelistRet Return Day Month   Year
1  2Jan1964    .        .        1.1    2    1     1964
1  3Jan1964   520       -0.7     1.2    3    1     1964
2  2Jan1964    .        .        1.2    2    1     1964
2  3Jan1964    .        .        1.4    3    1     1964
2  4Jan1964    .        .        1.3    4    1     1964

I was trying to do this in stages as my stata skills are not great. I had
an idea to use:

egen delisted = 1 if max(date)  != day==31 & month==12 & year ==1997

Which I thought would give a value of 1 for the stocks that didn't reach
the max date. I'd be much happier to use a different line of code and I am
open to any suggestions.

Best Regards,
Chris Evans

*
*   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/

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index