<?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: Need help to recode a column with lab values in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527137#M75104</link>
    <description>&lt;P&gt;In addition to formula solution of DS you could handle it like shown below.&lt;/P&gt;
&lt;P&gt;First we need to sort Big Class by age (this is your lab data).&lt;/P&gt;
&lt;P&gt;The we select the column age and let jmp find all repeating rows for age.&lt;/P&gt;
&lt;P&gt;For these we delete the age values.&lt;/P&gt;
&lt;P&gt;BR Georg&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt &amp;lt;&amp;lt; sort( by( age, name ), Replace Table );

dt &amp;lt;&amp;lt; select columns(age);
dt &amp;lt;&amp;lt; select duplicate rows();
dt:age[dt &amp;lt;&amp;lt; get selected rows()]=.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Jul 2022 17:21:52 GMT</pubDate>
    <dc:creator>Georg</dc:creator>
    <dc:date>2022-07-27T17:21:52Z</dc:date>
    <item>
      <title>Need help to recode a column with lab values</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527080#M75098</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my table I have 3 columns : time, lab data and one temperature.&lt;/P&gt;&lt;P&gt;For the lab data I would like to keep only the value when it comes available and set all consecutive rows as null until we have a new lab result.&lt;/P&gt;&lt;P&gt;How should I write a script to handle this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&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="LogitTurtle576_0-1658936353883.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44365iD3DB44F489CEEB26/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LogitTurtle576_0-1658936353883.png" alt="LogitTurtle576_0-1658936353883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:51:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527080#M75098</guid>
      <dc:creator>LogitTurtle576</dc:creator>
      <dc:date>2023-06-10T23:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to recode a column with lab values</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527101#M75099</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/37335"&gt;@LogitTurtle576&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; One possible way is to generate a new column with the following formula:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	:Column 1 == Lag(:Column 1, 1), .,
	Row() == 1, :Column 1[1],
	:Column 1[Row()]
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where :Column 1 is your data column of interest. This will set all values to null, except when there is a change from one row to the next, then it'll use that value. The middle condition sets the first row to the value of row 1 of your data column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'm sure there are other ways, but I know this one can do what you're interested in doing. Plus, since you have another column, you don't lose any of your original data by recoding or overwriting the original column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!,&lt;/P&gt;
&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 18:22:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527101#M75099</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2022-07-27T18:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to recode a column with lab values</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527137#M75104</link>
      <description>&lt;P&gt;In addition to formula solution of DS you could handle it like shown below.&lt;/P&gt;
&lt;P&gt;First we need to sort Big Class by age (this is your lab data).&lt;/P&gt;
&lt;P&gt;The we select the column age and let jmp find all repeating rows for age.&lt;/P&gt;
&lt;P&gt;For these we delete the age values.&lt;/P&gt;
&lt;P&gt;BR Georg&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt &amp;lt;&amp;lt; sort( by( age, name ), Replace Table );

dt &amp;lt;&amp;lt; select columns(age);
dt &amp;lt;&amp;lt; select duplicate rows();
dt:age[dt &amp;lt;&amp;lt; get selected rows()]=.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2022 17:21:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527137#M75104</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-07-27T17:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to recode a column with lab values</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527195#M75113</link>
      <description>&lt;P&gt;Couple of additional formula options (using just replace &amp;lt;&amp;lt; set each value with Formula if you need one)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(9),
	New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 2, 2, 2, 3, 3, 3])),
	New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([1.2, 1.2, 1.3, 2.3, 2.4, 2.1, 3.5, 3.6, 3.1]))
);

dt &amp;lt;&amp;lt; New Column("Result", Numeric, Continuous, &amp;lt;&amp;lt; Set Each Value(
	IfMZ(:Dif(:Column 1) == 0,
		.
	,
		:Column 1
	)
));

dt &amp;lt;&amp;lt; New Column("Result2", Numeric, Continuous, &amp;lt;&amp;lt; Set Each Value(
	If(Row() == Col Min(Row(), :Column 1),
		:Column 1
	,
		.
	);
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2022 18:17:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527195#M75113</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-07-27T18:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to recode a column with lab values</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527469#M75132</link>
      <description>&lt;P&gt;Thanks for your quick reply&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 07:38:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-to-recode-a-column-with-lab-values/m-p/527469#M75132</guid>
      <dc:creator>LogitTurtle576</dc:creator>
      <dc:date>2022-07-28T07:38:58Z</dc:date>
    </item>
  </channel>
</rss>

