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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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