Hello,
Below my data:
data what_I_want;
input ID $ DT:date9. Amount Sum_of_Next_2_Days;
format DT date9.;
datalines;
A 09JUL2021 3600 3600
A 03AUG2021 456 489
A 04AUG2021 33 268
A 06AUG2021 235 335
A 07AUG2021 100 186
A 09AUG2021 86 86
A 12AUG2021 456 456
A 24AUG2021 22 1925
A 25AUG2021 987 1984
A 26AUG2021 916 1551
A 27AUG2021 81 828
B 07AUG2021 554 992
B 08AUG2021 193 438
B 09AUG2021 245 245
;
run;
Along the line I would like something like that.
For each date, I want to find the sum of its next 2 days.
Find for next 2 dates:
For 09Jul, sum Amount where DT Between 09Jul and 11Jul
For 03Aug, sum Amount where DT Between 03Aug and 05Aug
For 04Aug, sum Amount where DT Between 04Aug and 06Aug
For 06Aug, sum Amount where DT Between 06Aug and 08Aug
For 07Aug, sum Amount where DT Between 07Aug and 09Aug
For 09Aug, sum Amount where DT Between 09Aug and 11Aug
For 12Aug, sum Amount where DT Between 12Aug and 14Aug
For 24Aug, sum Amount where DT Between 24Aug and 26Aug
For 25Aug, sum Amount where DT Between 25Aug and 27Aug
For 26Aug, sum Amount where DT Between 26Aug and 28Aug
For 27Aug, sum Amount where DT Between 27Aug and 29Aug
For 07Aug, sum Amount where DT Between 07Aug and 09Aug
For 08Aug, sum Amount where DT Between 08Aug and 10Aug
For 09Aug, sum Amount where DT Between 09Aug and 11Aug
... View more