BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Estelle
Calcite | Level 5

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
collinelliot
Barite | Level 11

Use double quotes - " " instead of single.

View solution in original post

4 REPLIES 4
collinelliot
Barite | Level 11

Use double quotes - " " instead of single.

Estelle
Calcite | Level 5

All the time I spent pouring over this... 

 

I knew it'd be something simple. Thank You!!!

SASKiwi
PROC Star

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. 

Estelle
Calcite | Level 5

I miss batch. It's not used in my current position.

sas-innovate-white.png

Our biggest data and AI event of the year.

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.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1453 views
  • 0 likes
  • 3 in conversation