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.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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