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
UserID16644
Level V

Looping Summary Tables

Hi all,

I am trying to summarize multiple table but I need it to be in a loop form. 

1. How can I loop the output table name to be in uniform name (eg. summary 1, summary 2)

2. How can I loop the following output table again for another summary

 

Please Help. TIA

1 REPLY 1
jthi
Super User

Re: Looping Summary Tables

  1. Is there a specific name for needing summary 1, summary 2... and so on name?
  2. If you have specific names you can use those, but I would advice against it and use references.

Here is an example with Big Class how to use references

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

dt_list = dt << Subset(
	By(:sex),
	All rows,
	Selected columns only(0),
	columns(:name, :age, :height, :weight)
);
show(dt_list);

//add dt to dt_list
Insert into(dt_list, dt);
show(dt_list);

//create list to collect summary tables
dt_summary_list = {}; 

//will require JMP16 due to For Each. For Each can be replöaced with for loop
For Each({val, idx}, dt_list,
	dt_summary = val << Summary(
		output table("Summary " || char(idx)), //we can use output table() to define name
		//output table("Summary"), //you could also let jmp take care of naming
		Group(:age),
		Mean(:height),
		Freq("None"),
		Weight("None")
	);
	Insert Into(dt_summary_list, dt_summary);
);

Show(dt_summary_list[2]); //should use list and indices rather than "hardcoded" names
summary_of_summary = Datatable("Summary 2") << Summary(
	output table("SummaryOfSummary2"),
	Mean(:"Mean(height)"n),
	Freq("None"),
	Weight("None")
);

jthi_0-1635950682876.png

 

-Jarmo