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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.