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
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";
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";
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.