Hi,
I am trying to calculate last year's YDT (i.e. 2023 Jan), last 5 year's YTD (i.e. 2019-2023 Jan), last 5 year's annual average (i.e. average 2019-2023 Jan) and compare with this year's YTD counts (i.e. 2024 Jan) to see if this year's YTD counts are high. Once we have Feb full data we will calc YTD accordingly. Here is the dataset, thanks in advance for your help.
DATA SHOWN ONLY FOR 3 MONTHS HERE
data have; infile datalines delimiter=','; input disease$ year month tot;
cards; A,2019,1,7 A,2019,2,9 A,2019,3,13 A,2020,1,7 A,2020,2,10 A,2020,3,9 A,2021,1,8 A,2021,2,16 A,2021,3,6 A,2022,1,8 A,2022,2,5 A,2022,3,7 A,2023,1,8 A,2023,2,4 A,2023,3,11 B,2019,1,11 B,2019,2,2 B,2019,3,5 B,2020,1,3 B,2020,2,6 B,2020,3,7 B,2021,1,2 B,2021,2,2 B,2021,3,1 B,2022,1,4 B,2022,2,4 B,2022,3,1 B,2023,1,2 B,2023,2,11 B,2023,3,5 A,2024,1,4 B,2024,1,7 ; run;
Expected OUTPUT
... View more