If you literally just want the number of days between 0001-01-01 and 2023-01-01 then you know it is the number of days in 2022 years.
The only question is how to define all those years.
If the years are ALL defined using the Gregorian Calendar convention, then you have
5 groups of 400 years (from 0001-01-01 through 2000-12-31).
ndays_0001_through_2000 = 5*intck('day','01jan1601'd,'01jan2001'd)
I chose 400 years because that is the longest cycle defined in the Gregorian Calendar, so any 400 year range would do. I also could have avoided the multiplication by choosing some valid (for SAS date calculations) 2000 year interval, like
ndays_0001_through_2000 = intck('day',01jan1601'd,01jan3601'd)
And the directly calculated number of days from 2000-12-31 to through 2023-01-01
ndays_2001_through_2022 = intck('day','01jan2000'd,'01jan2023'd);
Then just add ndays_0001_through_2000 + ndays_2001_through_2022.
... View more