@bijayadhikar wrote:
@FreelanceReinh I did run your script. It did produce a desired result for now. I am not sure if I will have any issue going into next year, i.e. 2024. The 5-years block will be from 2019-2023, and current year will be 2024.
There should be no issues with future years. The first two criteria after "a.disease=b.disease" in the ON clause could be summarized equivalently to
intck('month',a.d,b.d) in (1 2 10:14 22:26 34:38 46:50 58:62)
(where 10:14 is the SAS abbreviation for 10 11 12 13 14). The last criterion ensures that the moving average is not calculated if the available count data for the disease in question (whether missing values or not) don't go back to at least 62 months before the "pivot" month. So the code uses only relative date criteria.
... View more