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
Rich
Level II

Table Summary Script Without Hardcoding Table Names

I have a project that I will be adding tables to. I am trying to make a script that produces a summary with some basic stats.

In the following script, MyDataTable is hard coded, looking for help to replace that with something that calls up the table's name.

This my first post here, I also spent a couple of hours trying to figure it out with forum and google searches.

Thanks!!

 

New Table( "Summary of MyDataTable grouped by Name",
	Add Rows( 6 ),
	New Script(
		"Source",
		Data Table( "MyDataTable" ) <<
		Summary(
			Group( :Name ),
			Mean( :Resp. ),
			Std Dev( :Resp. ),
			Std Err( :Resp. ),
			N( :Resp. ),
			Freq( "None" ),
			Weight( "None" ),
			output table name( "Summary of MyDataTable grouped by Name" )
		)
	),
	New Column( "Name",
		Character( 20 ),
		"Nominal",
		Lock( 1 ),
		Set Display Width( 83 )
	),
	New Column( "N Rows",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Lock( 1 ),
		Set Display Width( 42 )
	),
	New Column( "Mean(Resp.)",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Set Selected,
		Lock( 1 ),
		Set Display Width( 70 )
	),
	New Column( "Std Dev(Resp.)",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Set Selected,
		Lock( 1 ),
		Set Display Width( 83 )
	),
	New Column( "Std Err(Resp.)",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Set Selected,
		Lock( 1 ),
		Set Display Width( 77 )
	),
	New Column( "N(Resp.)",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Lock( 1 ),
		Set Display Width( 48 )
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII

Re: Table Summary Script Without Hardcoding Table Names

In the above case, it is just the part

Summary(
	Group( :Name ),
	Mean( :Resp. ),
	Std Dev( :Resp. ),
	Std Err( :Resp. ),
	N( :Resp. )
)

Just import the column from Excel and execute the code.

View solution in original post

8 REPLIES 8
jthi
Super User

Re: Table Summary Script Without Hardcoding Table Names

Where is the "MyDataTable" coming from? How do you define which table should be used when? Are you saving this script to some other data table than MyDataTable?

-Jarmo
Rich
Level II

Re: Table Summary Script Without Hardcoding Table Names

I am using the JMP add-in in Excel to create the data table. MyDataTable is the name of the table from Excel. So my thought was when I add more data tables to my project, I can run the script to generate my summary table(s). Maybe there is an easier/cleaner way? I did try selecting multiple tables then generate the summary (Table>Summary dropdown), but it only generated the summary for one table. SO maybe I am missing a step there?

jthi
Super User

Re: Table Summary Script Without Hardcoding Table Names

If all the tables have same column names, you could have a simple script in the project which would create a summary of the current data table which you run as needed. Other option could be to loop over the tables in your project and creating summaries which are still missing but this does require quite a bit of extra scripting. You might also be able to load the data directly to JMP without using the add-in and create the summary immediately after the data is loaded.

-Jarmo
hogi
Level XII

Re: Table Summary Script Without Hardcoding Table Names

In the above case, it is just the part

Summary(
	Group( :Name ),
	Mean( :Resp. ),
	Std Dev( :Resp. ),
	Std Err( :Resp. ),
	N( :Resp. )
)

Just import the column from Excel and execute the code.

Rich
Level II

Re: Table Summary Script Without Hardcoding Table Names

Thanks jthi and hogi!

 

I will try to figure out where to save the script in the project instead of associated with a table.

 

 

hogi
Level XII

Re: Table Summary Script Without Hardcoding Table Names

You might have a look at:

Workflow Builder or the "baby steps" into Scripting  

 

Depending on the total length of your workflow, it might be suitable to store the workflow for the data import and the processing  separate from a project or from the actual data.

 

As 


@jthi wrote:

If all the tables have same column names, you could have a simple script 


... if the column names vary, it gets a bit more complicated ...

 

 

Rich
Level II

Re: Table Summary Script Without Hardcoding Table Names

I will give this a look tomorrow!!

Rich
Level II

Re: Table Summary Script Without Hardcoding Table Names

Thank you both. Very helpful!!