BookmarkSubscribeRSS Feed
Nieves
Quartz | Level 8

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:

permnodateprcretdlprcdlret
      
100001-Jun-87-0.218750  
100002-Jun-87-0.218750  
100003-Jun-87-0.218750  
100004-Jun-87-0.218750  
100005-Jun-87-0.218750  
100008-Jun-87-0.218750  
100009-Jun-87-0.218750  
1000010-Jun-87-0.218750  
1000011-Jun-87-0.21875 0-0.218750

 

data want:

permnodateprcretdlprcdlret
      
100001-Jun-87-0.218750  
100002-Jun-87-0.218750  
100003-Jun-87-0.218750  
100004-Jun-87-0.218750  
100005-Jun-87-0.218750  
100008-Jun-87-0.218750  
100009-Jun-87-0.218750  
1000010-Jun-87-0.218750  
1000011-Jun-87-0.218750   -0.21875 0
1000012-Jun-87-0.218750   

 

Is it correct to use the following code to implement:

 

if not missing(dlret)  and last.permno then ret = dlret;

1 REPLY 1
Quentin
Super User

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2921 views
  • 0 likes
  • 2 in conversation