BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JKCho
Pyrite | Level 9

HI!

 

I think I need different codes for 1)holding period return and 2)monthly, yearly return, or similar.

 

holding period return is tricky because I need to use days from a certain date to another certain date. In other words, I cannot simply make code someday+1's price and divide a previous day by the next day.

 

For exmaple, from July 12th, 2019, one-day HPR needs the next business day, July 15th, 2019. So... To calculate one-day holding period return, I may need a new code other than day+1.  I guess there should the code navigating adding or subtracting days by the order of rows on certain variables. (For example, if the interval is +- 1 business days, that would be July 11st and July 15th, 2019 as my CRSP daily data has the price row following business days) So far, I have looked for the code having date interval specified by the order of rows of interest. Please share your knowledge... Maybe my ability to search for the answer is so poor...

 

Another question is also related to the above question. If I need to know a month return from June 7th, 2019 to July 7th, 2019, I need to have stock prices on both dates. Well... 2019/07/07 is Sunday so I need next day, Monday. In that case, I need another code that automatically finds the next available date on my dataset.  I think this is quite an advanced SAS programming.  

 

Maybe the gist of those coding is how to skillfully use the order of rows and I even wonder whether this is possible. 

 

There is almost no way to express my thankfulness to you have helped me other than writing here. However, I would like to thank you again for your helpful replies very much!!!!

 

Jerry

1 ACCEPTED SOLUTION

Accepted Solutions
JKCho
Pyrite | Level 9

https://wrds-www.wharton.upenn.edu/pages/support/applications/event-studies/event-study-research-app...

 

 

This link can answer most of my questions.

 

But still... I wonder how can I get a monthly return from a specific date.

 

View solution in original post

3 REPLIES 3
JKCho
Pyrite | Level 9

It would be better to elaborate more.

 

There is data having the date stocks purchased. (stock ID, date_purchased)

There is another data having the daily price of stocks. (stock ID, date, price)

 

I want to calculate holding period returns using date and price in the second data. Both date_purchased and date are based on business days so ordinary +@ days does not work... 😞

JKCho
Pyrite | Level 9

https://wrds-www.wharton.upenn.edu/pages/support/applications/event-studies/event-study-research-app...

 

 

This link can answer most of my questions.

 

But still... I wonder how can I get a monthly return from a specific date.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 2774 views
  • 2 likes
  • 2 in conversation