- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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".
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do can save a JMP file with the column name as a CSV file?
The CSV file saved by the second method ,
the first code still has no column name.
Thank gzmorgan0!