- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have an old calendar and I am trying to recalculate the varioius date in it.
One of the issue I have, is to estimate the begining date and the ending date of the previous quadrimester (a fourth months period).
As example in the old calendar, imagine that I have the date = '28DEC2013 so the ending date for the corresponding quadrimester will be 31DEC2013
and the begining date will be 01SEP2013. Therefore, the previous quadrimester begining date value will be 01MAY2013 and the ending date will be 31AUG2013.
I was trying to use the intnx function to estimate those but I don't see the quadrimester interval into the documentation.
I think that we can use user defined interval but I don't know how to do that.
Does someone should help me and provide me an example.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello @alepage,
The MONTH4 interval should do it:
data _null_;
date='28DEC2013'd;
qm_curr_beg=intnx('month4',date,0,'b');
qm_curr_end=intnx('month4',date,0,'e');
qm_prev_beg=intnx('month4',date,-1,'b');
qm_prev_end=intnx('month4',date,-1,'e');
format date qm: date9.;
put (_numeric_)(=/);
run;
Result:
date=28DEC2013 qm_curr_beg=01SEP2013 qm_curr_end=31DEC2013 qm_prev_beg=01MAY2013 qm_prev_end=31AUG2013
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello @alepage,
The MONTH4 interval should do it:
data _null_;
date='28DEC2013'd;
qm_curr_beg=intnx('month4',date,0,'b');
qm_curr_end=intnx('month4',date,0,'e');
qm_prev_beg=intnx('month4',date,-1,'b');
qm_prev_end=intnx('month4',date,-1,'e');
format date qm: date9.;
put (_numeric_)(=/);
run;
Result:
date=28DEC2013 qm_curr_beg=01SEP2013 qm_curr_end=31DEC2013 qm_prev_beg=01MAY2013 qm_prev_end=31AUG2013