Date values are number of days from 01Jan1960.
Datetime values are number of seconds from 01Jan1960:00:00:00.
So except when your datetime values are kind of close to 1960 many of the date functions will not return any value. The date functions basically do not work for any date after 31 Dec 20000 (yes year 20,000).
Please see:
data junk;
x=6589335;
y=year(x);
put "X as datetime: " x= datetime20. +1 "X as date: " x= mmddyy10. 'year: ' y=;
x2 = x+100;
y = year(x2);
put "X2 as datetime: " x2= datetime20. +1 'year for X2: ' y=;
run;
Notice that the date displayed using the mmddyy10 format doesn't display because 5 digits don't fit into the 4 allowed by the format. None of the SAS supplied formats can display a year past 9999 correctly.
After we add 100 days to the date we get an error for the Year() function because the date is out of range.
So generally the date functions will not return anything useful when applied to a DATETIME value.
I would examine my data very carefully to see if that "filter" actually worked. Post example data in the form of data step to see others replicate your results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712 will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
... View more