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
- :
- Discussions
- :
- JMP formula editor

Topic Options

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

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

Jan 10, 2012 11:58 AM
(1126 views)

I am still pretty new to JMP. I need help with the formula editor. I wanted to make a column (Y) that counts the number of variables that are the same in a different column (X). For example.

X | Y |
---|---|

22 | 3 |

22 | |

22 | |

345 | 1 |

567 | 3 |

567 | |

567 | |

99 | 1 |

777 | 2 |

777 |

Is that possible? Any help would be appreciated.

Thanks,

Jeff

2 REPLIES

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

If Column X is of type Categorical, you can go to Tables > Summary>select column X, Under statistics Choose N, Group By Column X.

You can then maintain this as a separate summary or have the option of joining it back to the main table using update command, matching with Column X. This would be a one time summary, not a dynamic formula.

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

It is possible make such a formula. Here is two variants that should work. Just paste the script in the formula editor and hit enter. JMP will render the code into the typical formula editor style.

1. No empty rows in Y, Column X does not have to be sorted

Summarize**(** g = by**(** :X **)**, n = Count**(** :X **)** **)**;

Associative Array**(** g, As List**(** n **)** **)[**Char**(** :X **)]**

2. Count only on first instance (as in your example above), Column X must be sorted.

Summarize**(** g = by**(** :X **)**, n = Count**(** :X **)** **)**;

aa = Associative Array**(** g, As List**(** n **)** **)**;

If**(**

Row**()** == **1**, aa**[**Char**(** :X **)]**,

:X**[**Row**()]** == :X**[**Row**()** - **1****]**, **.**,

aa**[**Char**(** :X **)]**

**)**