02-14-2014 04:40 AM
I have a stock price data, which has a problem that after the company is delisted, the price is set to last market price for the rest of the sample.
So let's consider a simplified example data:
The company was delisted in 2004 but the value is set stale at the last market price. All the observations after 2003 should be deleted.
I added another column "lastprice" to the data set with a fixed last price observation value.
I currently have something like:
if price=lag(price) then
if price=lastprice then delete;
But this code would delete 1998 and 1999 data from the example above even though they are valuable info.
I should be somehow be able to refer to the rest of the values within a data set, but do not know how it's done.
Do you guys have an idea how i would be able to remove the stale data from the time series as described above?
Thanks in advance!
02-14-2014 08:09 AM
This works for your sample data, but is your sample data representative of you actual data.