cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
aimeeh60
Level II

How do I create a summary table with mean ± SD in the same column?

I generate tables by hand that express mean ± SD in the same column.  This is very time consuming.  Is there a way to generate in a table in JMP that looks like the table below?

Thanks,

A~

   

TimeGroup 1Group 2Group 3
(hr)
1mean ± SDmean ± SDmean ± SD
2mean ± SDmean ± SDmean ± SD
3mean ± SDmean ± SDmean ± SD

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
KarenC
Super User (Alumni)

Re: How do I create a summary table with mean ± SD in the same column?

The non-scripting solution:

First you need to build a summary table which is really easy to do.  There are two options, use the tabulate and when your table looks like what you want then use save to table option.  Or alternately from the Tables menu select Summary.  Put your grouping variables into the group (so in your case Group and Time) then select the data column and then in the "Statistics" drop down menu in the summary dialog box select mean and then again select std dev.  Before you hit the OK button check the little "keep dialog open" button so that if your table is not what you want it is easy to go back to the dialog and try again (and don't worry, we all do this multiple times to get exactly what we want).


Now you have a table with a Group Column, a Time Column, a mean, and a std dev.  Now you can add another column (double click to the right of your last column) and now right click on that empty column and select formula.  You want to build a formula that concatenates the mean, the ± symbol, and the standard deviation.  The only trick is that the mean and std dev are numbers so I have a 3 part concatenate (look that up in the formula functions) with a char function to convert numbers to characters. I also use the ^ option on the character function to get a space for the "7" to control the length of the character.  Maybe someone has a better solution to get a constant 2 digits when converting a number to a character.

Char( :Name( "Mean(Data)" ), 7 ) || "±" || Char( :Name( "Std Dev(Data)" ), 7 )

Finally to get the layout you were looking for you would Split your table.  Table menu, Split option, dialog box: split by = group, split columns = new column, and group = time, again utilize that "keep dialog open" to go back and redo when you put the columns in the wrong places.

View solution in original post

10 REPLIES 10
txnelson
Super User

Re: How do I create a summary table with mean ± SD in the same column?

I have attached a script that illustrates how to do the 3 different solutions for your request.  I think the 3rd one is the closest to what you want.

11038_pastedImage_0.png

11039_pastedImage_1.png

11040_pastedImage_2.png

Jim
aimeeh60
Level II

Re: How do I create a summary table with mean ± SD in the same column?

Thank you, Jim. The third option is exactly what I am looking for. How do I arrive at this format? I have very little experience creating data tables using JMP.

Thanks,

A~

txnelson
Super User

Re: How do I create a summary table with mean ± SD in the same column?

The script that I encluded in the response has the jsl code to create the table.  If you need more explanation after you look at the attached file, get back to me and we can walk through it.

Jim
aimeeh60
Level II

Re: How do I create a summary table with mean ± SD in the same column?

Hi Jim,

Unfortuantely, I can't follow the jsl code so I'll need step by step instrcution. I am happy to share my desktop for a virtual session.

Thanks.

KarenC
Super User (Alumni)

Re: How do I create a summary table with mean ± SD in the same column?

The non-scripting solution:

First you need to build a summary table which is really easy to do.  There are two options, use the tabulate and when your table looks like what you want then use save to table option.  Or alternately from the Tables menu select Summary.  Put your grouping variables into the group (so in your case Group and Time) then select the data column and then in the "Statistics" drop down menu in the summary dialog box select mean and then again select std dev.  Before you hit the OK button check the little "keep dialog open" button so that if your table is not what you want it is easy to go back to the dialog and try again (and don't worry, we all do this multiple times to get exactly what we want).


Now you have a table with a Group Column, a Time Column, a mean, and a std dev.  Now you can add another column (double click to the right of your last column) and now right click on that empty column and select formula.  You want to build a formula that concatenates the mean, the ± symbol, and the standard deviation.  The only trick is that the mean and std dev are numbers so I have a 3 part concatenate (look that up in the formula functions) with a char function to convert numbers to characters. I also use the ^ option on the character function to get a space for the "7" to control the length of the character.  Maybe someone has a better solution to get a constant 2 digits when converting a number to a character.

Char( :Name( "Mean(Data)" ), 7 ) || "±" || Char( :Name( "Std Dev(Data)" ), 7 )

Finally to get the layout you were looking for you would Split your table.  Table menu, Split option, dialog box: split by = group, split columns = new column, and group = time, again utilize that "keep dialog open" to go back and redo when you put the columns in the wrong places.

aimeeh60
Level II

Re: How do I create a summary table with mean ± SD in the same column?

Hi Karen,

Your instructions were very easy to follow and I have a table to work with. However, I am stuck at that point. I am struggling with the '3 part concatenate' and what I am understanding as the conversion of numbers to characters. It also looks like there is some place I am supossed to put a code, correct? Any further details would be much appreciated.

Thanks!

KarenC
Super User (Alumni)

Re: How do I create a summary table with mean ± SD in the same column?

If you add a new column to the summary table, then from the column properties (or right click on the column and select formula) and you will get something that looks like this:

[Missing image]

If you cut and paste the line of code from my previous post and paste it here you should get what you are looking for.  The two formulas are "Concatenate" and "Character".  Here is the link to the start of the formula editor help info.  The formula editor takes a bit of "playing with" to get the hang of but once you do...watch out.

http://www.jmp.com/support/help/Formula_Editor.shtml#96570

txnelson
Super User

Re: How do I create a summary table with mean ± SD in the same column?

Attached is a cut down version of the script that previously sent you.  I have eliminated the sections that produced the output that you didn't want, and have annotated the sections of the code with how these could have been done interactively rather than with the JSL.  Please take a look at it.  I think it will walk you though the process to get what you need.

Jim
ezorlo
Level IV

Re: How do I create a summary table with mean ± SD in the same column?

I agree there should be a one click option to create mean ± SD