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 All,

 

Yes. It is easy to merge the Compustat and the CRSP.

What if I want something different?

 

I now have been trying to match these two in a more precise way.

For example, if a fiscal year-end of a firm in the Compustat is 2019/11/30(Saturday), I cannot match with the exact same date from the CRSP as the CRSP only contains trading days! (no holidays, no Saturdays, no Sundays!!!) 

I want to match this fiscal year-end with the closed next trading day. In the case of the above example, it should be 2019/12/02(Monday).

 

To achieve this matching, I referred this link: https://wrds-www.wharton.upenn.edu/pages/support/applications/event-studies/event-study-research-app...

 

Specifically in Step3. and this code: 

 

proc sql; create table temp
 as select a.permno, b.*
  from input a left join caldates b
  on b.evtdate-a.edate>=0
  group by a.edate
  having (b.evtdate-a.edate)=min(b.evtdate-a.edate);

The last row shows that it minimizes the days between trading day and fiscal year-end(calendar day). 

But... **bleep**:( That last code did not work and match quite weirdly...

This codes matched fiscal year-end of 2010/10/30 to 2009/03/31 (WHAT???) and many like this.

So far... my conclusion is having(~~~~) code does not work and need another.

I have tried revising on b.~~~ part as well but could not get meaningful one. Since I set fiscal year-ends to be ahead of trading days, the code looks logical(yes. it should be trading-fiscal >= 0). 

 

Cannot guess what's wrong with my code... looks all fine but wired outcomes.

Please have a look and share your thoughts!

 

Thank you,

 

Jerry

1 ACCEPTED SOLUTION

Accepted Solutions
JKCho
Pyrite | Level 9

No. there is nothing wrong in my code. This is good to use. 

There is no delete button to remove my post so... a happening 🙂 or 😞

 

Be sure to put (trading day - calendar day) so that the figure is positive (>=0)

View solution in original post

1 REPLY 1
JKCho
Pyrite | Level 9

No. there is nothing wrong in my code. This is good to use. 

There is no delete button to remove my post so... a happening 🙂 or 😞

 

Be sure to put (trading day - calendar day) so that the figure is positive (>=0)

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1376 views
  • 0 likes
  • 1 in conversation