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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 475 views
  • 0 likes
  • 4 in conversation