Weeks are not uniquely defined, but lets assume you want your week (in this problem) to begin on Sunday.
You would convert each date to the start of the week (Sunday of that week), then you can do whatever arithmetic you want on the variable containing the start of the week. You can do this conversion using the INTNX function.
Example:
data fake;
input date :date9.;
cards;
22SEP2025
14AUG2025
;
data next;
set fake;
sunday_of_week=intnx('week',date,0,'b');
format date sunday_of_week date9.;
run;
If , instead of weeks beginning on Sundays, you want weeks beginning on Monday, you would use
monday_of_week=intnx('week.1',date,0,'b');
and so on.
... View more