BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10
title 'Find Second Saturday for Every Month in the Given Year'
data wrk (drop=start end i);
	format date ddmmyyd10.;
	start = '01-Jan-2021'd;
	end =   '31-Dec-2021'd ;
	do i = 1 to intck('month',start,end);
		Date = nwkdom(2,i,start,end);
 		Weekday = left(put(date,downame.)); 
		output;
	end;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21
Date = nwkdom(2,7,i,year(start));

...and for this to work for more than one year:

Date = nwkdom(2,7,i,year(intnx('month',start,i-1)));

 

View solution in original post

4 REPLIES 4
Patrick
Opal | Level 21
Date = nwkdom(2,7,i,year(start));

...and for this to work for more than one year:

Date = nwkdom(2,7,i,year(intnx('month',start,i-1)));

 

BrahmanandaRao
Lapis Lazuli | Level 10
data ss (drop=start end i);
format date ddmmyyd10. ;
start='01-Jan-2020'd ;
end=  '31-Dec-2021'd ;
 do i =1 to intck('month',start,end);
 date=nwkdom(2,7,i,year(intnx('Month','Start',i-1)));
 weekday=left(put(date,downame.));
 output; ;
 end;

run;

For Multiple Years its not give proper output

BrahmanandaRao
Lapis Lazuli | Level 10
Any one fix the above error
Patrick
Opal | Level 21

@BrahmanandaRao wrote:
Any one fix the above error

May-be copy the code I've suggested correctly. Right now your code returns all missings. 

What might create below log message using your code?

NOTE: Invalid numeric data, 'Start' , at line 34 column 42.
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
  • 4 replies
  • 1914 views
  • 1 like
  • 2 in conversation