BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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

View solution in original post

1 REPLY 1
FreelanceReinh
Jade | Level 19

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 501 views
  • 1 like
  • 2 in conversation