cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
lwx228
Level VIII

How do can save a JMP file with the column name as a CSV file?

I searched the Discussions posts, and saved JMP as TXT file first, and then changed TXT name to CSV.

But my JMP default does not check "Export Table Headers".

2019-10-18_16-37.png
How can the JSL be saved as a CSV file with the column name?

I added "Export Table Headers(1)" in the code, which did not work.

Thanks!

2 REPLIES 2
gzmorgan0
Super User (Alumni)

Re: How do can save a JMP file with the column name as a CSV file?

@lwx228 ,

 

Your screenshot looks like an older version of JMP.  Please provide the JMP version and the OS (Windows?) that you are using.

 

In JMP 13 and later versions you can just save  the .csv format. It might not be available for your version.  If it is, this is the best method.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Save( "c:\temp\deleteme2 Big Class.csv" ); // convert to CSV format
Close( dt, "NoSave" );

Saving a text file requires changing the ExportSettings preference. I recommend saving the current preferences, change it, export/save the text file(s), then reset the preference.  Here is a script to do that.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

pathout = "c:\temp\";
ofid    =  "BigClass_csv";

// Save as text with comma delimiters
// Get user Export Preferences
xptPref = Get Preferences( Export Settings );

// Set desired Export Preferences
Preferences(
	ExportSettings(
		End Of Line( CRLF ),
		End Of Field( Comma ),  //optionally try: Tab|Space|Other("|")|Other("^") etc
		Export Table Headers( 1 )
	)
);

// Save as .txt
dt << Save( pathOut || ofid || ".txt" );

// Reset user Export Preferences
Eval( xptPref ); 

// xptPref;  // works as well.

Close(dt,NoSave);

Rename File( pathout || ofid || ".txt", ofid || ".csv");.

Hope one of these work for you.

lwx228
Level VIII

Re: How do can save a JMP file with the column name as a CSV file?

I used win7,
The CSV file saved by the second method ,
the first code still has no column name.
Thank gzmorgan0!