cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

auto fill today's date into data table name

Isabel26
Level III

I need to save as data table to xlsx AND auto adding today's date. For example, file name will be "old name 3/8/2022.xlsx" if I run the script on 3/8/2022, and  "old name 3/9/2022.xlsx" if I run the script on 3/9/2022. This is easy to do in SAS, and I assume JMP will be similar. Not sure how to fix the code. thanks

 

Data Table( "old name" ) << Save( "C:\old name || Today().xlsx" );

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager


Re: auto fill today's date into data table name

You need to Format the date:

 

Format( Today(), "ddMonYYYY" );

 

Two things to note:

  1. You don't need Char() since Format() returns a character string.
  2. Avoid the formats that contain slashes (/) since they are used as directory delimiters.  
-Jeff

View solution in original post

4 REPLIES 4
ron_horne
Super User (Alumni)


Re: auto fill today's date into data table name

Hi @Isabel26 

perhaps this will work:

Data Table( "old name" ) << Save( "C:\old name "|| char (Today())||".xlsx" );

 

Isabel26
Level III


Re: auto fill today's date into data table name

Thanks! But the date is not format in MM/DD/YYYY. It returns 3729589915. 

Jeff_Perkinson
Community Manager Community Manager


Re: auto fill today's date into data table name

You need to Format the date:

 

Format( Today(), "ddMonYYYY" );

 

Two things to note:

  1. You don't need Char() since Format() returns a character string.
  2. Avoid the formats that contain slashes (/) since they are used as directory delimiters.  
-Jeff
Isabel26
Level III


Re: auto fill today's date into data table name

Thank you! It worked perfectly.