I need to add a current date to the output I am exporting from SAS in the following format: filename_YYYYMMDDhhmmss.csv
I am creating a macro variable the following way:
%let date_human = %sysfunc(today(), YYYYMMDDn8.);
Does anybody know how to create a custom format for the date I have got? datetime20. gives an incorrect one.
Thank you.
Use the B8601 formats.
%let now=%sysfunc(datetime());
%let date_human=%sysfunc(putn(&now,B8601DN8))%sysfunc(timepart(&now),B8601TM6);