Subscribe Bookmark RSS Feed

writing script to export tables

rmay

New Contributor

Joined:

Jul 28, 2017

Hi,

 

I was wondering how to write a script to automate exportation of specific tables in an output file? I need to calculate confidence intervals for a large set of data, and would like JMP to automatically copy those confidence intervals to either a .txt or .csv file. 

3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Here is an example taken directly from the Scripting Index on how to save a data table to an output format:

     Help==.Scripting Index==>Data Table==>Save As

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Save( "$temp\deleteme Big Class.jmp" ); // explicit location
If( dt << Save( "" ),
	Write( "\!nsaved to " || (dt << GetPath) ),
	Write( "\!nsave canceled" )
); // prompt
dt << Save( "$temp\deleteme Big Class.csv" ); // convert to CSV format
Close( dt, "NoSave" );
Jim
rmay

New Contributor

Joined:

Jul 28, 2017

Thanks, but I need a script to export output tables, not a data table. So for example, JMP will save scripts to reproduce analyses in the current state; I need to export the results of those analyses to a .csv file. 

txnelson

Super User

Joined:

Jun 22, 2012

Any display table in JMP can be turned into a data table.  Interactively, you right mouse click on the table and select "Make into Data Table" or "Make into Combined Data Table".

To do this in a script, you pass a message of "Make into Data Table" to the object.

Here is the example from the Scripting Index

     Help==>Scripting Index==>Make Into Data Table

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Baltic.jmp" );
p = PLS(
	Y( :ls, :ha, :dt ),
	X(
		:v1,
		:v2,
		:v3,
		:v4,
		:v5,
		:v6,
		:v7,
		:v8,
		:v9,
		:v10,
		:v11,
		:v12
	)
);
pr = p << report;
pr[Outline Box( 2 )] << Close;
pr[Outline Box( 3 )] << Close;
tb = pr[Table Box( 1 )];
tb << Make Into Data Table;
Jim