<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script the &amp;quot;Group Similar Values&amp;quot; function in the Recode platform with JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771889#M95245</link>
    <description>&lt;P&gt;I think you might have to build your own grouping using Choose Closest(). It seems to have MOST of the same options so maybe JMP is using something similar which it isn't recording (I think there are many other things recode isn't recording either).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1720590137767.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66039iF5415FB6FCA77ADB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1720590137767.png" alt="jthi_0-1720590137767.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2024 05:43:53 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-07-10T05:43:53Z</dc:date>
    <item>
      <title>Script the "Group Similar Values" function in the Recode platform with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771878#M95244</link>
      <description>&lt;P&gt;I want to automate a recode function in JSL but I can not found any documentation on how to achieve it.&lt;BR /&gt;No luck in this forum, JMP search function or the scripting index. The workflow recorder and the log file only gets the final result (lock-up table) and its the same with the save script to data table function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mauro_Gerber_0-1720589195844.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66037i0EBDBBD904B97F8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mauro_Gerber_0-1720589195844.png" alt="Mauro_Gerber_0-1720589195844.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If possible to hand over some of those settings if possible but is not important in a first step:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mauro_Gerber_1-1720589322267.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66038i97533857BEA03938/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mauro_Gerber_1-1720589322267.png" alt="Mauro_Gerber_1-1720589322267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Mauro&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 05:33:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771878#M95244</guid>
      <dc:creator>Mauro_Gerber</dc:creator>
      <dc:date>2024-07-10T05:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script the "Group Similar Values" function in the Recode platform with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771889#M95245</link>
      <description>&lt;P&gt;I think you might have to build your own grouping using Choose Closest(). It seems to have MOST of the same options so maybe JMP is using something similar which it isn't recording (I think there are many other things recode isn't recording either).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1720590137767.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66039iF5415FB6FCA77ADB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1720590137767.png" alt="jthi_0-1720590137767.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 05:43:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771889#M95245</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-10T05:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script the "Group Similar Values" function in the Recode platform with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771953#M95256</link>
      <description>&lt;P&gt;I made a small script using Choose Closest() but now run into a problem that it only executes once within any form of loop.&lt;/P&gt;&lt;P&gt;Wait didn't help and I tried a lot of scenarios. As long I execute Choose Closest() multiple times in a loop, it gives back the same string regardless of the input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Outside / after the loop, it works fine (again).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added a test setup and will make a ticket at JMP Support.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 13:39:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/771953#M95256</guid>
      <dc:creator>Mauro_Gerber</dc:creator>
      <dc:date>2024-07-10T13:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script the "Group Similar Values" function in the Recode platform with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/772349#M95258</link>
      <description>&lt;P&gt;Yeah, seems like Choose Closest is doing some weird things when it is inside a loop. For example this didn't seem to work without using Eval(EvalExpr()) as it was matching abcabcb with abcabca if run inside a loop (if you run it manually until failure, the result was ok).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my attempt on something like this (I think Group Choose Closest or something similar would be a good idea for Wish List which would do what Recode is doing)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = Open("$DOWNLOADS/Test_Table.jmp");
dt &amp;lt;&amp;lt; new column("Ones", Numeric, Continuous, Set Each Value(1)); // summarize...

Summarize(dt, groups = By(:Column 1), counts = Sum(:Ones));

aa_matches = Associative Array(groups);

groups = groups[Rank(Ranking(counts))];
aa_matches[Reverse(groups)[1]] = Reverse(groups)[1]; // highest is group with itself

str_a = Remove From(groups, 1)[1];
While(N Items(groups) &amp;gt; 0,
	Eval(EvalExpr(
		str_b = Choose Closest(Expr(str_a), Expr(groups), Ignore Case(1), Ignore Whitespace(1), Ignore Nonprintable(1), Max Edit Count(2), Max Edit Ratio(0.25));	
	));
	aa_matches[str_a] = str_b;
	str_a = Remove From(groups, 1)[1];
);

dt &amp;lt;&amp;lt; New Column("Recoded", Character, Nominal, Set Each Value(
	aa_matches[:Column 1];
));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2024 14:37:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-the-quot-Group-Similar-Values-quot-function-in-the-Recode/m-p/772349#M95258</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-10T14:37:20Z</dc:date>
    </item>
  </channel>
</rss>

