The previous posts all raise valid points. Let's take a look at your code a bit more closely.
You move back 365 * 30 days. That's only approximately correct. A block of 30 years will contain approximately 7 leap years, where that year contains 366 days. So a more accurate attempt would be:
DOB = intnx('year', today(), -30, 'same');
That moves back to the same day of the year as the current date, 30 years ago. And as was pointed out, there will be many valid dates that fit the bill. This calculation gives you one of those valid dates.
What have you tried so far? Please post your code.
Looks good to me. Have a look at the INTNX function for an alternative.
The previous posts all raise valid points. Let's take a look at your code a bit more closely.
You move back 365 * 30 days. That's only approximately correct. A block of 30 years will contain approximately 7 leap years, where that year contains 366 days. So a more accurate attempt would be:
DOB = intnx('year', today(), -30, 'same');
That moves back to the same day of the year as the current date, 30 years ago. And as was pointed out, there will be many valid dates that fit the bill. This calculation gives you one of those valid dates.
Thanks a lot for explaining it so well. The code worked perfectly.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: