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

Hi,

 

I want to create a out file along with yyyymmddhhmmss.

Could someone help on this ?

 

Example : filename_yyyymmddhhmmss.txt

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The closest format I know to that is B8601DT, but it includes a T between the date and the time.  You could strip that out.

%let now = %sysfunc(compress(%sysfunc(datetime(),b8601dt.),T));
filename want "/folders/myfolders/mydata_&now..txt";

View solution in original post

3 REPLIES 3
ballardw
Super User

Where is the datetime value supposed to come from?

Tom
Super User Tom
Super User

The closest format I know to that is B8601DT, but it includes a T between the date and the time.  You could strip that out.

%let now = %sysfunc(compress(%sysfunc(datetime(),b8601dt.),T));
filename want "/folders/myfolders/mydata_&now..txt";
biopharma
Quartz | Level 8
Just curious! Why do you need to store files this way? Could become a maintenance headache.

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
  • 3 replies
  • 1687 views
  • 1 like
  • 4 in conversation