<?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: Generating a Recode Column script... in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/110713#M39810</link>
    <description>&lt;P&gt;It is not clear from your post whether you are creating the 40 classifications from a clustering analysis, or whether you are doing it manually by the diagnosos name and using Recode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you did not mention which version of JMP you are using. If you have recoded one table's 900 to 40 categories, depending upon your version of JMP you might have the option for Script &amp;gt; Save to File. Below is a screenshot of the option using JMP PRO v 14.2. The save script is attached.&amp;nbsp; You could run this script after opening each file and the recode column (in my script it is called orginal 2) will be created automatically.&amp;nbsp; &amp;nbsp;However, I am not sure of the performance if you have extremely large files. (More discussion below).&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="image.png" style="width: 735px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15554i16EE9FFDA3780853/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What does seem to work very quickly is an associative array which is a keyed list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached are 2 tables,&lt;/P&gt;
&lt;UL style="list-style-position: inside;"&gt;
&lt;LI&gt;firsttbl_recodebyhand.jmp&lt;/LI&gt;
&lt;LI&gt;newtbl.jmp&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Open firtstbl_recodebyhand.jmp. It needs to have the original column and the recoded column, then run this script, changing the names to match your hand recoded table columns, and run this script&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
ng_aa = Associative Array(:original, :original2);
aa_str = "ng_aa =" || Log Capture(write(ng_aa)) ||";";
save text file("c:\temp\myrecode.txt", aa_str);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Next open newtbl.jmp. Note there are more rows and it is in random order. Now run this script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = current data table();  //open newtbl
_cmd_str = LoadTextFile("c:\temp\myrecode.txt");
Eval(Parse(_cmd_str));
dt &amp;lt;&amp;lt; new Column("original 2", character, &amp;lt;&amp;lt;set each value(ng_aa[:original]) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The associative array acts as a look-up function.&amp;nbsp; An assocaitive array is likely available on all versions of JMP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This discussion so far assumes you have a hand recoded column.&amp;nbsp; If you have used other methods like a k-means cluster analysis or other algorithmic methods, JMP likely has a Save Formula option and you could just copy and paste that formula each time you open a new file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without more details, I have nothing more to offer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Feb 2019 13:11:56 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2019-02-13T13:11:56Z</dc:date>
    <item>
      <title>Generating a Recode Column script...</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/110708#M39809</link>
      <description>&lt;P&gt;I am running multiple analyses for different tables. Each table has a column for diagnosis and there are over 900 different types of diagnosis. SO what I do is recode column and then reclassify each diagnosis into 40 "diagnostic classes". However this is a tedious process repeating the recoding of the diagnoses column for each table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help creating a recode script that captures the logic for grouping 900 diagnosis into 40 clusters and then apply the same recode process to a similar column in different tables. Is there a way to save and apply the recode script to a new column?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 11:15:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/110708#M39809</guid>
      <dc:creator>DrMoka</dc:creator>
      <dc:date>2019-02-13T11:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a Recode Column script...</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/110713#M39810</link>
      <description>&lt;P&gt;It is not clear from your post whether you are creating the 40 classifications from a clustering analysis, or whether you are doing it manually by the diagnosos name and using Recode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you did not mention which version of JMP you are using. If you have recoded one table's 900 to 40 categories, depending upon your version of JMP you might have the option for Script &amp;gt; Save to File. Below is a screenshot of the option using JMP PRO v 14.2. The save script is attached.&amp;nbsp; You could run this script after opening each file and the recode column (in my script it is called orginal 2) will be created automatically.&amp;nbsp; &amp;nbsp;However, I am not sure of the performance if you have extremely large files. (More discussion below).&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="image.png" style="width: 735px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15554i16EE9FFDA3780853/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What does seem to work very quickly is an associative array which is a keyed list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached are 2 tables,&lt;/P&gt;
&lt;UL style="list-style-position: inside;"&gt;
&lt;LI&gt;firsttbl_recodebyhand.jmp&lt;/LI&gt;
&lt;LI&gt;newtbl.jmp&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Open firtstbl_recodebyhand.jmp. It needs to have the original column and the recoded column, then run this script, changing the names to match your hand recoded table columns, and run this script&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
ng_aa = Associative Array(:original, :original2);
aa_str = "ng_aa =" || Log Capture(write(ng_aa)) ||";";
save text file("c:\temp\myrecode.txt", aa_str);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Next open newtbl.jmp. Note there are more rows and it is in random order. Now run this script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = current data table();  //open newtbl
_cmd_str = LoadTextFile("c:\temp\myrecode.txt");
Eval(Parse(_cmd_str));
dt &amp;lt;&amp;lt; new Column("original 2", character, &amp;lt;&amp;lt;set each value(ng_aa[:original]) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The associative array acts as a look-up function.&amp;nbsp; An assocaitive array is likely available on all versions of JMP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This discussion so far assumes you have a hand recoded column.&amp;nbsp; If you have used other methods like a k-means cluster analysis or other algorithmic methods, JMP likely has a Save Formula option and you could just copy and paste that formula each time you open a new file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without more details, I have nothing more to offer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 13:11:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/110713#M39810</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-02-13T13:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a Recode Column script...</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/113932#M39915</link>
      <description>&lt;P&gt;Thank YOU...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using JMP V14.2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to save the script of the recoded column. Will try to run the script with another table and see if that works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;DrMoka&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2019 12:30:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-a-Recode-Column-script/m-p/113932#M39915</guid>
      <dc:creator>DrMoka</dc:creator>
      <dc:date>2019-02-17T12:30:21Z</dc:date>
    </item>
  </channel>
</rss>

