I am successfully creating date macros, as seen from the put statement in the log. The odd thing is, I'm trying to append my log file name with these date macros and it is just plum not resolving in the log file name.
All of the following dates resolve just fine:
%LET DATE = %SYSFUNC(DATE(),DATE10.);
%LET HR = %SYSFUNC(SUBSTR(&TIME, 1, 2));
%LET MIN = %SYSFUNC(SUBSTR(&TIME, 4, 2));
%LET SEC = %SYSFUNC(SUBSTR(&TIME, 7, 2));
%PUT DATE = &DATE;
%PUT = &HR.;
%PUT = &MIN.;
%PUT = &SEC.;
And then I try to resolve macros within the log filename which doesn't work:
proc printto log = '\\sasprod\Finance\HealthAnalytics\Projects\Mental_Health_Build\Logs\MH_BUILD_&DATE&HR&MIN&SEC..log';
I have tried many different variations of date macros that will resolve in the put statement and then not in the log. I end up with filename MH_BUILD_&DATE&HR&MIN&SEC or whatever other unresolved date macro names I've tried creating.
Help much appreciated.
Use double quotes - " " instead of single.
Use double quotes - " " instead of single.
All the time I spent pouring over this...
I knew it'd be something simple. Thank You!!!
If you ran your program as a batch job then you can easily get a time-stamped SAS log file without doing any extra SAS coding.
I miss batch. It's not used in my current position.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.