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.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

JSL Saving EXCEL format and Keeping Leading Zeroes

fat_angus
Level III

Greetings, 

I have a JMP file that has leading 0s in several of the columns that I want to keep. 

Data Type is Character... and Modeling Type is Nominal

 

When I save the file into EXCEL format using the JSL code below,  the leading 0s disappear. Is there anyway to keep them in? 

 


du = Cust_join << Save( Concat("C:\file",Format( Today(), "yyyymmdd" ),".xlsx") );

I suppose script some code that puts an apostrophe in front of every instance but there are some row

5 REPLIES 5
txnelson
Super User


Re: JSL Saving EXCEL format and Keeping Leading Zeroes

Here is the file name that I get using your JSL......where are the leading zeros that have been dropped

"C:\file20220210.xlsx"

What release of JMP are you using?

Jim
fat_angus
Level III


Re: JSL Saving EXCEL format and Keeping Leading Zeroes

Hi Txnelson...

 

Using JMP16. 

 

I am not at all concerned about the file name. I am concerned about the columns in the file that have leading 0's. They look look fine in JMP but when I save as an EXCEL file using the script above or even using File... Save... As, the columns delete the leading 0's. 

 

Example: 

 

IN JMP I have file that contains a column that looks like this;

 

fat_angus_0-1644585681544.png

 

When I save it in EXCEL, the leading 0's are trimmed... thus, 0001585350 gets trimmed to 1585350

 

txnelson
Super User


Re: JSL Saving EXCEL format and Keeping Leading Zeroes

JMP is exporting all of the leading zeros.  It is Excel that is stripping them off.  Your suggestion of placing a non numeric value in of the column's values would be one way to preserve the leading zeros.

 

Maybe another community member has a better solution

Jim
lala
Level VIII


回复: JSL Saving EXCEL format and Keeping Leading Zeroes

dt << Save( "C:\file" || Char( Format( Today(), "y/m/d" ) ) || Char( Hour( Today() ) ) || Char( Minute( Today() ) ) || ".xlsx" );
pmroz
Super User


回复: JSL Saving EXCEL format and Keeping Leading Zeroes

It does appear that Excel is stripping off the leading zeroes.  Guess you'll have to stay in JMP and not use Excel LOL.  But if you must use Excel, you can preface the values with a single quote.  Here are the JMP table and Excel spreadsheet:

pmroz_0-1644591928582.png

 

Recommended Articles