proc sql;
select HAVE.FRIMID, COMP_T, CRSP_T, ASSET, RETURN
from HAVE, CRSP
where HAVE.date =CRSP.(date+1year or +1month) and HAVE.ID =CRSP.ID
quit;This code just represents what I want...
you can see
HAVE.date =CRSP.(date+1year)
What I am doing now is to calculate annual return starting from a specific date. e.g. 2019/10/31~2020/10/31. To do this, I need to have prices now and a year later. However, I do not know how to match. Since it is not just a number but year... +1 does not work.
Please help me how can I add day/month/year on my identifiers when they are calendar dates...
I first made code to transform that YYMMDD to YYMM and then +1. but it sometimes does not make sense as if the case is 2013/12 then +1 is 2013/13... or 2013/10/31 became 2013/10/32... instead 2013/11/01.
Because I need to match same to same+@ instead same to same, I am struggling with this.
Please help me. I searched for other posts but haven't found similar.
Use the intnx() function to calculate date intervals.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.