- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
auto fill today's date into data table name
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: auto fill today's date into data table name
You need to Format the date:
Format( Today(), "ddMonYYYY" );
Two things to note:
- You don't need Char() since Format() returns a character string.
- Avoid the formats that contain slashes (/) since they are used as directory delimiters.
-Jeff
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: auto fill today's date into data table name
Created:
Mar 8, 2022 01:04 PM
| Last Modified: Mar 8, 2022 10:05 AM
(1768 views)
| Posted in reply to message from Isabel26 03-08-2022
Hi @Isabel26
perhaps this will work:
Data Table( "old name" ) << Save( "C:\old name "|| char (Today())||".xlsx" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: auto fill today's date into data table name
Thanks! But the date is not format in MM/DD/YYYY. It returns 3729589915.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: auto fill today's date into data table name
You need to Format the date:
Format( Today(), "ddMonYYYY" );
Two things to note:
- You don't need Char() since Format() returns a character string.
- Avoid the formats that contain slashes (/) since they are used as directory delimiters.
-Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: auto fill today's date into data table name
Thank you! It worked perfectly.