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

Hi

 

This is my sample program

proc printto log='/Desktop/alternate-log-file.log';

run;

Data test;

Input ID name $ Amount;

Datalines;

 

1 A 10

2 B 20

3 C 30

4 D 40

5 E 50

;

Run;

proc printto;

run;

 

I want to know how can I add current date and time timestamp in the name "alternate-log-file.log"?

Any suggestion.

 

 

Regards

Sourav

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What type of timestamp, there are various formats. E.g.

proc printto log="/desktop/alternate_log_file_%sysfunc(now(),datetime.).log";

proc printto log="/desktop/alternate_log_file_%sysfunc(date(),date9.).log";

proc printto log="/desktop/alternate_log_file_%sysfunc(date(),e8601dt.).log";

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What type of timestamp, there are various formats. E.g.

proc printto log="/desktop/alternate_log_file_%sysfunc(now(),datetime.).log";

proc printto log="/desktop/alternate_log_file_%sysfunc(date(),date9.).log";

proc printto log="/desktop/alternate_log_file_%sysfunc(date(),e8601dt.).log";

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1 reply
  • 7934 views
  • 1 like
  • 2 in conversation