Hello,
First thank you very much for you SAS code to get the week start date on a Saturday.
I have kept the same logic for the end of the week.
But for the begining of the year, and the end of the year I think values could be different.
/* Therefore, if the fist January 2025 is Weneday then the begining of the year will be Saturday 28, 2024 */
data demo;
format date weekdatx. sat_start_of_week sat_end_of_week sat_start_of_year sat_end_of_year date9.;
do date='28dec2013'd to '10jan2015'd;
sat_start_of_week=intnx('week.7',date,0,'b');
sat_end_of_week=intnx('week.7',date,0,'e');
sat_start_of_year=intnx('year', sat_start_of_week, 0, 'b');
sat_end_of_year=intnx('year', sat_start_of_week, 0, 'e');
output;
end;
run;
proc print data=demo;
run;
I am pretty confortable with the estimate for the begining and the end of the week. It starts on Saturday and end on a Friday.
But if for the week we have a lead of few day should we expect the same for the year ? So should the year 2014 start on 28dec2013 and end on 02jan2015 ? So if I want to apply that logic, how do we estimate those two dates?
... View more