Question : Find weekday for every year from 15aug1940 to now(today) ??
output
August 15, 1940: Thursday
August 15, 1941: Friday
August 15, 1942: Saturday
August 15, 1943: Sunday
August 15, 1944: Tuesday
August 15, 1945: Wednesday
... (continuing for each year up to the current year)
Hi @112211, you could use the mod function to to get the remainder from the division of the date (an integer number in SAS) by 7. If the remainder is negative you have to add 7. Each of the seven positive possible remainders correspond to a weekday.
Hope, this helps.
Best, Markus
Please show the code you have tried, so that we can help you improve it. In addition to the suggestions from others, you might want to use the INTNX function for advancing the date by a year at a time.
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.