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 out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.