Subscribe Bookmark RSS Feed

JMP formula editor

jstewart

Community Trekker

Joined:

Jan 10, 2012

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.

XY
223
22
22
3451
5673
567
567
991
7772
777

Is that possible?  Any help would be appreciated.

Thanks,

Jeff

2 REPLIES
data_driven

Community Trekker

Joined:

Jan 10, 2012

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.

ms

Super User

Joined:

Jun 23, 2011

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 )]

)