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";

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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