SAS Enterprise Guide

Desktop productivity for business analysts and programmers
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

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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