BookmarkSubscribeRSS Feed
PavanKumar2
Fluorite | Level 6

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

 

3 REPLIES 3
FredrikE
Rhodochrosite | Level 12

Try this 🙂

 

data _null_;
 do i = '01jan2019'd to '01feb2019'd;
   if weekday(i) = 6 then put i yymmdd10.;
 end;
run;

//Fredrik

Patrick
Opal | Level 21

@PavanKumar2 

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;
Ksharp
Super User
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;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 700 views
  • 0 likes
  • 4 in conversation