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
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;
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;
Anytime, glad to help.
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.
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.