Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Re: add a summary statistic column

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 24, 2020 2:33 AM
(2329 views)

Dear Community

first best wishes for good health!

i need to add summary statistic for a data table with a grouping variable. i want the summary statistic to appear in every row that the matching grouping variable appears.

what i've done until now is to create a separate summary statistic table and then manually recode the grouping variable column. this is a bit tedious. is there a way to just merge the recode and summary table?

see pics

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Is this what you are after? Do 'File > New Script', copy and paste the code below, then 'Edit > Run Script'.

```
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column( "Mean weight Grouped by age", Formula( Col Mean( :weight, :age ) ) );
```

If so, take a look at the formula column in the table. Using 'Help > Scripting Index' gives some other possibilities:

6 REPLIES 6

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Is this what you are after? Do 'File > New Script', copy and paste the code below, then 'Edit > Run Script'.

```
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column( "Mean weight Grouped by age", Formula( Col Mean( :weight, :age ) ) );
```

If so, take a look at the formula column in the table. Using 'Help > Scripting Index' gives some other possibilities:

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: add a summary statistic column

Thanks for the prompt response!

It looks right, but my wife kicked me off the computer to watch the kids

so I'll try it soon and let u know.

It looks right, but my wife kicked me off the computer to watch the kids

so I'll try it soon and let u know.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: add a summary statistic column

I am not accomplishing the task

Here is the output of the summary table script:

```
Tabulate(
Add Table( Column Table( Analysis Columns( :OTU ) ), Row Table( Grouping Columns( :Plot and replicate ) ) )
)
```

It gives me the exact statistic that i need in one row per grouping variable. now i need it to repeat for each row with the grouping variable (and i have 73000 rows!)

anyway i am new to scripting so pardon my obvious lack of experience

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: add a summary statistic column

@ian_jmp gave you an example of what you need to use, he just didn't put it into the specifics of your data table. So if you run this little script, against your data table, it should give you what you want.

```
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Mean OTU Grouped by Plot and replicate",
formula( Col Mean( :OTU, :Plot and replicate ) ) );
```

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: add a summary statistic column

Thank you both very much I was able to make the column!!

This saved me from manually recoding the grouping variable column. Also this script was useful for helping me to understand the col sum function better, which I used in a formula to achieve the same result. Thanks again and best of health

This saved me from manually recoding the grouping variable column. Also this script was useful for helping me to understand the col sum function better, which I used in a formula to achieve the same result. Thanks again and best of health

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: add a summary statistic column

My error.....I totally skipped over that you wanted the sum, not the mean....sorry

Jim