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 |
Is it correct to use the following code to implement:
if not missing(dlret) and last.permno then ret = dlret;