I have formula for next Sunday and previous Monday of the week.
SUNDAY: intnx('week.1',datepart(ACTVN_DAT),1)
Monday: intnx('WEEK.2',datepart(ACTVN_DAT),0)
But I realized that it is giving me next Sunday if my ACTVN_DAT falls on Sunday itself (which tells formula is good). Example is below:
How can I amend my formula to keep my Next_Sunday as it is if it falls on Sunday. This is what I want in my data:
March 21st & Jan 3rd was Sunday. So I want Next_Sunday as 03/21/2021 & 01/03/2021 respectively. However. Jan 21st is Thursday so my formula works right for this date.
Thanks for your help.
Hi @sasuser_sk,
Just subtract one day before applying INTNX:
Next_Sunday=intnx('week',datepart(ACTVN_DAT)-1,1);
(The ".1" after "week" is redundant.)
Hi @sasuser_sk,
Just subtract one day before applying INTNX:
Next_Sunday=intnx('week',datepart(ACTVN_DAT)-1,1);
(The ".1" after "week" is redundant.)
Thank you @FreelanceReinh . This worked just fine.
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.