cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
dadawasozo
Level IV

find unique strings separated by comma for each row in a column and count the total recurrence

Hi,

 

I wonder if there is a way to create column with formula to find unique strings separated by comma in a column and count total recurrence of each like below?

dadawasozo_1-1751749418746.png

 

 




1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: find unique strings separated by comma for each row in a column and count the total recurrence

Here is one way of handling this

txnelson_0-1751756988501.png

Unique Item formula

x = Words( :Input, "," );
For Each( {element, index}, x, x[index] = Trim( element ) );
x = Associative Array( x ) << get keys;
x = Concat Items( x, "," );

Total Recurrence formula

x = Words( :Input, "," );
For Each( {element, index}, x, x[index] = Trim( element ) );
theList = Associative Array( x ) << get keys;
value = "";
For Each( {element}, theList, value = value || "," || Char( N Rows( Loc( x, element ) ) ) );
Substr( value, 2 );
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: find unique strings separated by comma for each row in a column and count the total recurrence

Here is one way of handling this

txnelson_0-1751756988501.png

Unique Item formula

x = Words( :Input, "," );
For Each( {element, index}, x, x[index] = Trim( element ) );
x = Associative Array( x ) << get keys;
x = Concat Items( x, "," );

Total Recurrence formula

x = Words( :Input, "," );
For Each( {element, index}, x, x[index] = Trim( element ) );
theList = Associative Array( x ) << get keys;
value = "";
For Each( {element}, theList, value = value || "," || Char( N Rows( Loc( x, element ) ) ) );
Substr( value, 2 );
Jim
dadawasozo
Level IV

Re: find unique strings separated by comma for each row in a column and count the total recurrence

Hi Jim, 

 

it looks like both formula is same

txnelson
Super User

Re: find unique strings separated by comma for each row in a column and count the total recurrence

My error......I corrected my initial post to the correct formula

Jim
dadawasozo
Level IV

Re: find unique strings separated by comma for each row in a column and count the total recurrence

Thank you for the helps!!!

Recommended Articles