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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
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.