cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
ToddKeebler
Level I

Changing Summary Statistics Format of Distribution - JSL

Hi, I think this should be a quickie, but I'm stuck on it: How do I change the format of all the Summary Statistics of a Distribution report at once?

 

After formatting as I'd like, the auto-generated script shows to change it for every entry of the distribution individually like so:

	SendToReport(
		Dispatch(
			{},
			"Distributions",
			OutlineBox,
			{Set Title( "Summary Data Distribution" )}
		),
		Dispatch(
			{"20 Hz (dB re: 1 kHz)"},
			"1",
			ScaleBox,
			{Min( -10 ), Max( -1 ), Inc( 0.1 ), Minor Ticks( 1 )}
		),

But I'd like to apply it to all of them at once to reduce the code significantly.  I tried sending a set format to the report and a few other things, but none worked.

 

Thanks!

 

T

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Changing Summary Statistics Format of Distribution - JSL

Try this alternative.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dist = dt << Distribution( Y( :weight ) );

dist rep = dist << Report;

(dist rep << XPath("//NumberColBox")) << Set Format( "Fixed Dec", 15, 8 );

Just be aware that this simple script assumes that EVERY number column box should be changed.

View solution in original post

7 REPLIES 7

Re: Changing Summary Statistics Format of Distribution - JSL

I am not sure I really understand this request but here goes.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dist = dt << Distribution( Y( :weight ) );

dist rep = dist << Report;

dist rep["Summary Statistics"][NumberColBox(1)] << Set Format( "Fixed Dec", 15, 8 );
ToddKeebler
Level I

Re: Changing Summary Statistics Format of Distribution - JSL

Hey Mark,

 

Apologies if my initial question wasn't clear.  I also realized that I didn't copy the important part of the code in the original post.

 

The code snippet you supplied works well for a single Y column, but what I was looking to do was to change the format of all the Y columns that are included in the distribution with one line of code rather than multiple.  So basically rather than specify "NumberColBox(X)" to change the Xth Y Column, I'd like to just specify something like "NumberColBox" to change all of the Y Columns.

 

Does that make more sense?

ToddKeebler
Level I

Re: Changing Summary Statistics Format of Distribution - JSL

ToddKeebler_0-1611786745442.png

Here you can see that I've customized the summary statistics using the following:

SummaryDist << Customize Summary Statistics( 
	Std Err Mean( 0 ),
	Upper Mean Confidence Interval( 0 ),
	Lower Mean Confidence Interval( 0 ),
	Minimum( 1 ),
	Maximum( 1 ),
	Trimmed Mean( 1 )
);

and then I used your code to change the 20 Hz Y column of data to 2 decimal places:

SummaryDistRep["SummaryStatistics"][NumberColBox(1)] << Set Format("Fixed Dec", 15,2);

But the remaining y columns for 20 kHz and Sensitivity haven't had their format changed.

Re: Changing Summary Statistics Format of Distribution - JSL

Try this alternative.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dist = dt << Distribution( Y( :weight ) );

dist rep = dist << Report;

(dist rep << XPath("//NumberColBox")) << Set Format( "Fixed Dec", 15, 8 );

Just be aware that this simple script assumes that EVERY number column box should be changed.

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Changing Summary Statistics Format of Distribution - JSL

Expanding just a bit on @Mark_Bailey's solution, changing the last line to this would apply this formatting to only items inside outlines boxes called 'Summary Statistics':

 

(dist rep << XPath("//OutlineBox[text()='Summary Statistics']//NumberColBox")) << Set Format( "Fixed Dec", 15, 8 );
ToddKeebler
Level I

Re: Changing Summary Statistics Format of Distribution - JSL

Perfect, this works great and seems like this may come in useful in other instances!  Many thanks.

 

Todd

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Changing Summary Statistics Format of Distribution - JSL

The last line in here might be what you are looking for:

 

Names default to here(1);

dt = Open("$Sample_Data/iris.jmp");

dist = dt << Distribution(
	Continuous Distribution( Column( :Sepal length ) ),
	Continuous Distribution( Column( :Sepal width ) ),
	Continuous Distribution( Column( :Petal length ) ),
	Continuous Distribution( Column( :Petal width ) ),
	Nominal Distribution( Column( :Species ) )
);

//use this to help create XPath queries
dist << Get XML; 

//rename some outline boxes
(dist << XPath("//OutlineBox[@helpKey='Distrib Freq']")) << Set title("Freq");
(dist << XPath("//OutlineBox[@helpKey='Distrib Quantiles']")) << Set title("Quant");

//Find all scale boxes from continuous distributions and change the scales
(dist << XPath("//OutlineBox[@helpKey='DistribC']//ScaleBox[@ID='1']")) << {Min( 0 ), Max( 8 ), Inc( 0.5 ), Minor Ticks( 0 )};