Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Level I

## Customize Oneway analysis

Hi guys!
I'm wondering if there is a way/script to move the minimum, median and maximum in to the Means and Std Deviations area.
Thank you !

``````dt = Open( "\$SAMPLE_DATA\Big Class.jmp",invisible(1) );ow= dt<<Oneway(
Y( :Eval(colListY<<GetItems) ),
X( :Eval(colListX<<GetItems) ),
All Graphs( 0 ),
Quantiles( 1 ),
Means and Std Dev( 1 ),
Plot Quantile by Actual( 1 ),
Line of Fit( 0 ),
Points( 0 ),
Box Plots( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 ),
SendToReport(
Dispatch(
{"Quantiles"},
"",
TableBox,
),
Dispatch( {"Quantiles"}, "10%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "25%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "75%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "90%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch(
{"Normal Quantile Plot"},
"2",
ScaleBox,
{Format("Percent",9,2 )}

)

),

);``````

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User

## Re: Customize Oneway analysis

Here is a pretty hard coded example of one way to do this:

``````dt = Open( "\$SAMPLE_DATA\Big Class.jmp", invisible( 1 ) );
colListY="height";
colListX="sex";
ow = dt << Oneway(
Y( :Eval( colListY  ) ),
X( :Eval( colListX  ) ),
All Graphs( 0 ),
Quantiles( 1 ),
Means and Std Dev( 1 ),
Plot Quantile by Actual( 1 ),
Line of Fit( 0 ),
Points( 0 ),
Box Plots( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 ),
SendToReport(
Dispatch( {"Quantiles"}, "10%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "25%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "75%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "90%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch(
{"Normal Quantile Plot"},
"2",
ScaleBox,
{Format( "Percent", 9, 2 )}

)

),

);

// calculate the required new statistics
summarize(byGroup=by(as column(colListX)),byMax=Max(as column(colListY)),
byMin=Min(as column(colListY)),byMedian=Quantile(as column(colListY),.5)
);

// Access the report output
repOW = ow << report;

// Capture the names of the columns in the current table box output
namesList = repOW["Means and Std Deviations"][tablebox(1)] << get names;

// Get the values from the current columns in the table box
levels = repOW["Means and Std Deviations"][stringcolbox(1)]<<get;
numbers = repOW["Means and Std Deviations"][numbercolbox(1)]<<get;
means = repOW["Means and Std Deviations"][numbercolbox(2)]<<get;
stddevs = repOW["Means and Std Deviations"][numbercolbox(3)]<<get;
stderrs = repOW["Means and Std Deviations"][numbercolbox(4)]<<get;
lowers = repOW["Means and Std Deviations"][numbercolbox(5)]<<get;
uppers = repOW["Means and Std Deviations"][numbercolbox(6)]<<get;

// Build the new table box adding in the new statistics
newTB = Table Box(
string col box(namesList[1], levels),
number col box(namesList[2], numbers),
number col box(namesList[3], means),
number col box(namesList[4], stddevs),
number col box(namesList[5], stderrs),
number col box(namesList[6], lowers),
number col box(namesList[7], uppers),
number col box("Minimum", byMin),
number col box("Median", byMedian),
number col box("Maximum", byMax)
);

// Append the new table box into the Means and Std Devs outline box
repOW["Means and Std Deviations"] << append(newTB);

// Delete the original table box
repOW["Means and Std Deviations"][tablebox(1)]<<delete;

``````
Jim
2 REPLIES 2
Highlighted
Super User

## Re: Customize Oneway analysis

Here is a pretty hard coded example of one way to do this:

``````dt = Open( "\$SAMPLE_DATA\Big Class.jmp", invisible( 1 ) );
colListY="height";
colListX="sex";
ow = dt << Oneway(
Y( :Eval( colListY  ) ),
X( :Eval( colListX  ) ),
All Graphs( 0 ),
Quantiles( 1 ),
Means and Std Dev( 1 ),
Plot Quantile by Actual( 1 ),
Line of Fit( 0 ),
Points( 0 ),
Box Plots( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 ),
SendToReport(
Dispatch( {"Quantiles"}, "10%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "25%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "75%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch( {"Quantiles"}, "90%", NumberColBox, {Visibility( "Collapse" )} ),
Dispatch(
{"Normal Quantile Plot"},
"2",
ScaleBox,
{Format( "Percent", 9, 2 )}

)

),

);

// calculate the required new statistics
summarize(byGroup=by(as column(colListX)),byMax=Max(as column(colListY)),
byMin=Min(as column(colListY)),byMedian=Quantile(as column(colListY),.5)
);

// Access the report output
repOW = ow << report;

// Capture the names of the columns in the current table box output
namesList = repOW["Means and Std Deviations"][tablebox(1)] << get names;

// Get the values from the current columns in the table box
levels = repOW["Means and Std Deviations"][stringcolbox(1)]<<get;
numbers = repOW["Means and Std Deviations"][numbercolbox(1)]<<get;
means = repOW["Means and Std Deviations"][numbercolbox(2)]<<get;
stddevs = repOW["Means and Std Deviations"][numbercolbox(3)]<<get;
stderrs = repOW["Means and Std Deviations"][numbercolbox(4)]<<get;
lowers = repOW["Means and Std Deviations"][numbercolbox(5)]<<get;
uppers = repOW["Means and Std Deviations"][numbercolbox(6)]<<get;

// Build the new table box adding in the new statistics
newTB = Table Box(
string col box(namesList[1], levels),
number col box(namesList[2], numbers),
number col box(namesList[3], means),
number col box(namesList[4], stddevs),
number col box(namesList[5], stderrs),
number col box(namesList[6], lowers),
number col box(namesList[7], uppers),
number col box("Minimum", byMin),
number col box("Median", byMedian),
number col box("Maximum", byMax)
);

// Append the new table box into the Means and Std Devs outline box
repOW["Means and Std Deviations"] << append(newTB);

// Delete the original table box
repOW["Means and Std Deviations"][tablebox(1)]<<delete;

``````
Jim
Highlighted
Level I

## Re: Customize Oneway analysis

Hi txnelson!
Thank you so much for helping once again.
Yes, this was what I was looking for, I'll learn through the code and understand it

Article Labels

There are no labels assigned to this post.