Hi I am making an automatic mail everyday where the file i attached included following in the name: 2021_05_06_thursday
The date changes every day so tomorrow it will be 2021_05_07_friday
How can I make a macro that can generate this
Hello
The following macro generates the date as you have desired
%sysfunc(translate(%sysfunc(date(),yymmdd10.)_%sysfunc(trim(%sysfunc(date(),downame10.))),'_','-'));
For today's date it will give this output :2021_05_06_Thursday as can be seen in the log below
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 %put %sysfunc(translate(%sysfunc(date(),yymmdd10.)_%sysfunc(trim(%sysfunc(date(),downame10.))),'_','-'));
2021_05_06_Thursday
74
75
76 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
Please post your code that sends one mail, we can then show you how to make it dynamic.
Hello
The following macro generates the date as you have desired
%sysfunc(translate(%sysfunc(date(),yymmdd10.)_%sysfunc(trim(%sysfunc(date(),downame10.))),'_','-'));
For today's date it will give this output :2021_05_06_Thursday as can be seen in the log below
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 %put %sysfunc(translate(%sysfunc(date(),yymmdd10.)_%sysfunc(trim(%sysfunc(date(),downame10.))),'_','-'));
2021_05_06_Thursday
74
75
76 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
Can I make the name of the days in the week (etc. Thursday) to another language?
1.Can I make the name of the days in the week (etc. Thursday) to another language?
I suggest you contact SAS Tech Support.
2.I think your original question is resolved, please mark it solved.
@mmea wrote:
Can I make the name of the days in the week (etc. Thursday) to another language?
Use the NLDATEWNw. format:
%put %sysfunc(date(),NLDATEWN20.);
It will display the weekday according to your locale.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.