BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Spintu
Quartz | Level 8

Hi Experts,

Could you please suggest me I want extract all Saturday's dates  from one beginning date of the month till last date of the same month.

So that I can automate the SAS Job. Right Now manually we are passing values,but going forward it has to be automate.

 

For example:

If creating Macro variable

%let sub_table_date='01MAR2018'd

I need to extract all Saturdays date till 31 Mar 2018. (endpoint we have to automate.)

so that we can extract 03Mar, 10Mar,17Mar,24mar,31mar.

 

Regards,

Purna

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Do something like this.

 

data want;
	sub_table_date='01MAR2018'd;
	end_date=intnx('month', sub_table_date, 0, 'e');

	do date=sub_table_date to end_date;
		if weekday(date)=7 then output;
	end;

	format date date9.;
	keep date;
run;

 

 

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Do something like this.

 

data want;
	sub_table_date='01MAR2018'd;
	end_date=intnx('month', sub_table_date, 0, 'e');

	do date=sub_table_date to end_date;
		if weekday(date)=7 then output;
	end;

	format date date9.;
	keep date;
run;

 

 

Spintu
Quartz | Level 8
Much appreciated your quick help.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2802 views
  • 2 likes
  • 2 in conversation