data wt;
datenew=intnx('qtr','01jan94'd,1,'middle');
format datenew mmddyy10.;
run;
its output is coming as 05/16/1994 but qarter consists of 3 months so it should be 04/16/1994.
Please help me with this.
@s_m wrote:
data wt;
datenew=intnx('qtr','01jan94'd,1,'middle');
format datenew mmddyy10.;
run;
its output is coming as 05/16/1994 but qarter consists of 3 months so it should be 04/16/1994.
Please help me with this.
Why? The middle of the second quarter (months 4, 5 and 6) is the middle of month 5.
@s_m wrote:
data wt;
datenew=intnx('qtr','01jan94'd,1,'middle');
format datenew mmddyy10.;
run;
its output is coming as 05/16/1994 but qarter consists of 3 months so it should be 04/16/1994.
Please help me with this.
Why? The middle of the second quarter (months 4, 5 and 6) is the middle of month 5.
If you want 3 months from the date use MONTH and 3 instead of QTR. Also note that April has 30 days so it would be the 15th NOT the 16th. See the code and output below.
You need to tell it that is what you want.
data test1;
date = '01JAN1994'd ;
next_qtr = intnx('qtr','01jan94'd,1,'middle');
first_month_of_next_qtr = intnx('month',intnx('qtr','01jan94'd,1,'s'),0,'middle');
format _all_ yymmdd10.;
put (_all_) (=/);
run;
date=1994-01-01
next_qtr=1994-05-16
first_month_of_next_qtr=1994-04-15
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.