Hi SAS experts,
How to implement the following requirement for adjusting delisting return ?
if a stock disappears from CRSP,its delisting return (dlret) is used in the month after its last month of reported returns (ret)
For example:
data.have is as follows:
permno | date | prc | ret | dlprc | dlret |
10000 | 1-Jun-87 | -0.21875 | 0 | ||
10000 | 2-Jun-87 | -0.21875 | 0 | ||
10000 | 3-Jun-87 | -0.21875 | 0 | ||
10000 | 4-Jun-87 | -0.21875 | 0 | ||
10000 | 5-Jun-87 | -0.21875 | 0 | ||
10000 | 8-Jun-87 | -0.21875 | 0 | ||
10000 | 9-Jun-87 | -0.21875 | 0 | ||
10000 | 10-Jun-87 | -0.21875 | 0 | ||
10000 | 11-Jun-87 | -0.21875 | 0 | -0.21875 | 0 |
data want:
permno | date | prc | ret | dlprc | dlret |
10000 | 1-Jun-87 | -0.21875 | 0 | ||
10000 | 2-Jun-87 | -0.21875 | 0 | ||
10000 | 3-Jun-87 | -0.21875 | 0 | ||
10000 | 4-Jun-87 | -0.21875 | 0 | ||
10000 | 5-Jun-87 | -0.21875 | 0 | ||
10000 | 8-Jun-87 | -0.21875 | 0 | ||
10000 | 9-Jun-87 | -0.21875 | 0 | ||
10000 | 10-Jun-87 | -0.21875 | 0 | ||
10000 | 11-Jun-87 | -0.21875 | 0 | -0.21875 | 0 |
10000 | 12-Jun-87 | -0.21875 | 0 |
Is it correct to use the following code to implement:
if not missing(dlret) and last.permno then ret = dlret;
Please add some sample data your to question, and show the output data you want to create from that sample data. That would help people who are unfamiliar with financial analysis. Also please show what code you have tried, and describe how it is failing.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.