Hi,
I have 2Dates.
Start-Date:01-01-2019
End-Date:01-02-2019
I need weekend dates between Start-Date and End-Date as
04-01-2019
11-01-2019
18-01-2019
25-01-2019
01-02-2019
Colud you please Help me
Try this 🙂
data _null_;
do i = '01jan2019'd to '01feb2019'd;
if weekday(i) = 6 then put i yymmdd10.;
end;
run;
//Fredrik
If this is about shifting week-end dates to the date of the previous Friday then below code should do.
data sample;
format calendar_date workingDate yymmdd10.;
do calendar_date = '01jan2019'd to '01feb2019'd;
workingDate=intnx('weekday',calendar_date,0,'b');
output;
end;
run;
proc print data=sample;
run;
data x;
do i=0 to intck('week','01jan2019'd, '01feb2019'd);
date=intnx('week.7','01jan2019'd,i,'e');output;
end;
format date ddmmyy10.;
run;
proc print;run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.