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;
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)));
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)));
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 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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.