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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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