Another way to approach this is to maintain a dataset that has a single value...the date it last ran. You then pass that value into a start_date variable that can be used in your program. At the very end, you overwrite the dataset with today's date, that becomes the start date, the next time you run it. This way, if you happen to have a day it can't run during the week, you pick up that data the next day it does run. libname mydata "directory_path";
data _null_;
set mydata.last_run_date;
call symputx('start_date',"'"||put(date_last_run,date9.)||"'d");
run;
data want;
set have;
where date_var >= &start_date. and date_var < date();
run;
data mydata.last_run_date;
date_last_run=date();
run;
... View more