- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
HI!!!
I found a very close answer here:
But still... I wonder how can I get a monthly return from a specific date.
e.g. from July 13th to Aug 13.
If either or both dates are nontrading days, then select the next trading days. Since I have to have a month interval, the code used in the link that can only sets intervals instead of a certain period of time(like month and year) is not the right one.
I wonder how other CRSP users can get stock returns too.
If you use CRSP and know how to get month-long returns please share your knowledge.
Thank you,
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The first part will be starting with actual SAS date values. Do you have that yet?
I think that you want the INTNX function with the 'Same' option.
data example; do date='25Jan2020'd to '31JAN2020'd; newdate = intnx('month',date,1,'S'); output; end; format date newdate date9.; run;
I used dates from 2020 as it is a leap year. 29, 30 and 31 Jan all get advanced to 29 Feb.
If you use 2019 then 28, 29, 30 and 31 Jan all get advanced to 28 Feb.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For a starting date of Jan 28, 29, 30, or 31, the ending date will be Feb 28?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to know return a month later. But it is depending on the data(trading days) whether the date a month later is a trading day or not. If not, the date will be the next trading day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The first part will be starting with actual SAS date values. Do you have that yet?
I think that you want the INTNX function with the 'Same' option.
data example; do date='25Jan2020'd to '31JAN2020'd; newdate = intnx('month',date,1,'S'); output; end; format date newdate date9.; run;
I used dates from 2020 as it is a leap year. 29, 30 and 31 Jan all get advanced to 29 Feb.
If you use 2019 then 28, 29, 30 and 31 Jan all get advanced to 28 Feb.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That is what I want!!
THX X 10000000000!!!!