<?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: Recoding multiple variables in one column and remembering it as a script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370461#M62015</link>
    <description>&lt;P&gt;I created a new column in a data table with the test values you had in the JSL you provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="recode.PNG" style="width: 585px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31448i98E8C9C5B98A9D87/image-size/large?v=v2&amp;amp;px=999" role="button" title="recode.PNG" alt="recode.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I then opened the Recode dialog and made the recode changes.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="recode2.PNG" style="width: 648px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31449i13016A17E6313441/image-size/large?v=v2&amp;amp;px=999" role="button" title="recode2.PNG" alt="recode2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I then went to the red triangle and selected&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Script=&amp;gt;Save to Script Window&lt;/P&gt;
&lt;P&gt;and below is what it gave me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "Big Class" );
dt &amp;lt;&amp;lt; Begin Data Update;
col1 = dt &amp;lt;&amp;lt; New Column( dt:test );
col1 &amp;lt;&amp;lt; Set Name( "test 2" );
dt &amp;lt;&amp;lt; Move Selected Columns( {col1}, after( dt:test ) );
dt &amp;lt;&amp;lt; Recode Column(
	dt:test,
	{Map Value(
		_rcOrig,
		{"A(1)", "A", "A(2)", "A", "A(3)", "A", "A(4)", "A", "A(5)", "A", "A(6)",
		"A", "B(1)", "B", "B(2)", "B", "C(1)", "C", "C(2)", "C", "C(3)", "C", "C(4)",
		"C", "D(1)", "D", "D(2)", "D", "E(1)", "E", "E(2)", "E", "F(1)", "F", "F(2)",
		"F", "G(1)", "G", "G(2)", "G", "H(1)", "H", "H(2)", "H", "I(1)", "I", "I(2)",
		"I", "I(3)", "I", "I(4)", "I", "J(1)", "J", "J(2)", "J", "K(1)", "K", "K(2)",
		"K", "L(1)", "L", "L(2)", "L", "M(1)", "M", "M(2)", "M", "M(3)", "M", "M(4)",
		"M"},
		Unmatched( _rcNow )
	)},
	Target Column( col1 )
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the example, you can see how the values are set for each of the value/result pairs&lt;/P&gt;</description>
    <pubDate>Mon, 22 Mar 2021 21:44:52 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-03-22T21:44:52Z</dc:date>
    <item>
      <title>Recoding multiple variables in one column and remembering it as a script</title>
      <link>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370444#M62014</link>
      <description>&lt;P&gt;OK, so I have begun familiarizing with JMP and worked successfully on my first script to extract, rearrange and format a data table from a database. Works fine and saves time. As I have developed this script with a copy of &lt;STRONG&gt;Jump into JMP Scripting&lt;/STRONG&gt;&amp;nbsp;on my lap, I was naturally interested in understanding the script. So here comes the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Think of a manufacturing process requiring lots of different measurements. The database has all test methods in one column and all test results in another column. To get what I want I need to split this table. However, since a lot of what we have in the database is from legacy Excel files, some recoding of the column holding the test names is required due to earlier, erroneous entries. To get to that piece of (re)code I went via Recode... in the Columns menu, and it is the only piece in the script I cannot understand. (It's generally a very basic script.)&lt;BR /&gt;&lt;BR /&gt;In the example posted below, the capital letters and numbers reflect variations of the name of the actual test method used. For example, A is one test (say pH testing), B is another test (e.g. viscosity). A(1), A(2), ... A(n) would all be recoded to A, then B(1), ... B(n) to B, and so on. Now how does the software now from exactly this piece of code which variables belong together? I checked the scripting guide and the scripting index but still don't understand. _rcOrig and _rcNow, what do they mean? The script, i.e. the variables in their respective rows are arranged exactly as they are in my copy of the complete script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for an answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Recode Column(
	dt:TestName,
	{Map Value(
		_rcOrig,
		{"A(1)", "A(2)",
		"A(3)", "A(4)",
		"A(5)", "A(6)", "B(1)",
		"B(2)", "C(1)", "C(2)",
		"C(3)", "C(4)", "D(1)", "D(2)", "E(1)",
		"E(2)", "F(1)", "F(2)", "G(1)", "G(2)",
		"H(1)", "H(2)", "I(1)", "I(2)",
		"I(3)", "I(4)", "J(1)", "J(2)", "K(1)",
		"K(2)", "L(1)", "L(2)",
		"M(1)", "M(2)", "M(3)",
		"M(4)"},
		Unmatched( _rcNow )
	)},
	Target Column( col1 )
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:09:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370444#M62014</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2023-06-09T22:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding multiple variables in one column and remembering it as a script</title>
      <link>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370461#M62015</link>
      <description>&lt;P&gt;I created a new column in a data table with the test values you had in the JSL you provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="recode.PNG" style="width: 585px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31448i98E8C9C5B98A9D87/image-size/large?v=v2&amp;amp;px=999" role="button" title="recode.PNG" alt="recode.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I then opened the Recode dialog and made the recode changes.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="recode2.PNG" style="width: 648px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31449i13016A17E6313441/image-size/large?v=v2&amp;amp;px=999" role="button" title="recode2.PNG" alt="recode2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I then went to the red triangle and selected&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Script=&amp;gt;Save to Script Window&lt;/P&gt;
&lt;P&gt;and below is what it gave me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "Big Class" );
dt &amp;lt;&amp;lt; Begin Data Update;
col1 = dt &amp;lt;&amp;lt; New Column( dt:test );
col1 &amp;lt;&amp;lt; Set Name( "test 2" );
dt &amp;lt;&amp;lt; Move Selected Columns( {col1}, after( dt:test ) );
dt &amp;lt;&amp;lt; Recode Column(
	dt:test,
	{Map Value(
		_rcOrig,
		{"A(1)", "A", "A(2)", "A", "A(3)", "A", "A(4)", "A", "A(5)", "A", "A(6)",
		"A", "B(1)", "B", "B(2)", "B", "C(1)", "C", "C(2)", "C", "C(3)", "C", "C(4)",
		"C", "D(1)", "D", "D(2)", "D", "E(1)", "E", "E(2)", "E", "F(1)", "F", "F(2)",
		"F", "G(1)", "G", "G(2)", "G", "H(1)", "H", "H(2)", "H", "I(1)", "I", "I(2)",
		"I", "I(3)", "I", "I(4)", "I", "J(1)", "J", "J(2)", "J", "K(1)", "K", "K(2)",
		"K", "L(1)", "L", "L(2)", "L", "M(1)", "M", "M(2)", "M", "M(3)", "M", "M(4)",
		"M"},
		Unmatched( _rcNow )
	)},
	Target Column( col1 )
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the example, you can see how the values are set for each of the value/result pairs&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 21:44:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370461#M62015</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-03-22T21:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding multiple variables in one column and remembering it as a script</title>
      <link>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370536#M62023</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If its always one Letter, you may want to make a simple formula like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column( "Test_Name", formula( Left(:TestName, 1)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 07:41:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370536#M62023</guid>
      <dc:creator>Mauro_Gerber</dc:creator>
      <dc:date>2021-03-23T07:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding multiple variables in one column and remembering it as a script</title>
      <link>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370548#M62026</link>
      <description>It's not always one letter. The letters are just placeholders for "any test name". I know how the tests belong together, JMP does not unless I tell it. I was wondering how JMP knew. Now I do. I think I'm blind.</description>
      <pubDate>Tue, 23 Mar 2021 09:33:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370548#M62026</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2021-03-23T09:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding multiple variables in one column and remembering it as a script</title>
      <link>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370549#M62027</link>
      <description>We are blessed to have you in this community. Thank you. Just looking over the original script and pondering when to have the next appointment with my optician.</description>
      <pubDate>Tue, 23 Mar 2021 09:38:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recoding-multiple-variables-in-one-column-and-remembering-it-as/m-p/370549#M62027</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2021-03-23T09:38:57Z</dc:date>
    </item>
  </channel>
</rss>

