Did I understand correctly that your year variable is actually a character string, not actual numbers/date? If this is the case then you first need to create a new date type variable from the character string. You can do this f.ex. by using Substring, Parse and DateFromMDY functions.
Is your year variable just four digits (2020) or more like a date (2020-08-17)? You could create a numeric variable just for year, but I personally prefer to create date variables with year format as it enables use of VA's periodic operators.
You can calculate differences between date variables by utilizing TreatAs (_number_) function. First you convert your date type variable to numbers, then calculate the difference, and finally convert number type variable back to date type variable by using TreatAs second time. It's actually very easy and straightforward even though it might not sound like it.
Btw. which version of VA you have?
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.