Hi
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:
DATE PRICE
1995 3
1996 4
1997 2
1998 2
1999 2
2000 3
2001 4
2002 5
2003 2
2004 2
2005 2
2006 2
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!
This works for your sample data, but is your sample data representative of you actual data.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.