<?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 Data preparation- substract column data by other column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762950#M94351</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a table with different scan results.&lt;/P&gt;&lt;P&gt;I have 180 scans with 1000 results per scan.&lt;/P&gt;&lt;P&gt;results are at the Z column.&lt;/P&gt;&lt;P&gt;I want to create a new column with relative scan results, meaning the results of scan 2 - the results of scan 1, results of scan 3 - the results of scan 2, and so on.&lt;/P&gt;&lt;P&gt;subtraction of results must be by Location number, 1-1, 2-2, 3-3, and so on.&lt;/P&gt;&lt;P&gt;I've tried to transpose the data but got lost in the way.&lt;/P&gt;&lt;P&gt;I would appreciate any help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ohad_s_0-1717917179624.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65024iC75CC81A6B87C591/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ohad_s_0-1717917179624.png" alt="Ohad_s_0-1717917179624.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Jun 2024 07:39:36 GMT</pubDate>
    <dc:creator>Ohad_s</dc:creator>
    <dc:date>2024-06-09T07:39:36Z</dc:date>
    <item>
      <title>Data preparation- substract column data by other column</title>
      <link>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762950#M94351</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a table with different scan results.&lt;/P&gt;&lt;P&gt;I have 180 scans with 1000 results per scan.&lt;/P&gt;&lt;P&gt;results are at the Z column.&lt;/P&gt;&lt;P&gt;I want to create a new column with relative scan results, meaning the results of scan 2 - the results of scan 1, results of scan 3 - the results of scan 2, and so on.&lt;/P&gt;&lt;P&gt;subtraction of results must be by Location number, 1-1, 2-2, 3-3, and so on.&lt;/P&gt;&lt;P&gt;I've tried to transpose the data but got lost in the way.&lt;/P&gt;&lt;P&gt;I would appreciate any help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ohad_s_0-1717917179624.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65024iC75CC81A6B87C591/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ohad_s_0-1717917179624.png" alt="Ohad_s_0-1717917179624.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2024 07:39:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762950#M94351</guid>
      <dc:creator>Ohad_s</dc:creator>
      <dc:date>2024-06-09T07:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data preparation- substract column data by other column</title>
      <link>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762954#M94353</link>
      <description>&lt;P&gt;You could first split your data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1717922171998.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65026iC1C334DB603AB6EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1717922171998.png" alt="jthi_0-1717922171998.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Perform the calculations in the split data, stack it and then join/update it back to your original data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other option is to sort your data by Location# (not necessary for my formula, but easier to very if the calculation is correct) and then create a formula to calculate the differences&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Z - (Col Moving Average(:Z, 1, 1, 0, :"Location #"n) * 2 - :Z);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Jun 2024 08:44:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762954#M94353</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-09T08:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Data preparation- substract column data by other column</title>
      <link>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762956#M94355</link>
      <description>&lt;P&gt;Thanks for the quick replay,&lt;/P&gt;&lt;P&gt;this works great.&lt;/P&gt;&lt;P&gt;can you elaborate on the formula a bit?&lt;/P&gt;&lt;P&gt;what are the parameters you put in?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2024 09:53:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762956#M94355</guid>
      <dc:creator>Ohad_s</dc:creator>
      <dc:date>2024-06-09T09:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Data preparation- substract column data by other column</title>
      <link>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762957#M94356</link>
      <description>&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/statistical-functions-2.shtml?os=win&amp;amp;source=application#ww6133391" target="_blank" rel="noopener"&gt;Col Moving Average(name, options, &amp;lt;By var, ...&amp;gt;)&lt;/A&gt; should explain the parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea is to use Col Moving Average to calculate the previous value (this is "easy" method to take groups into account). You can do this type of calculations using Dif() or Lag() but they would require additional checks for group changes (simple If is usually enough for that).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2024 10:08:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762957#M94356</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-09T10:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Data preparation- substract column data by other column</title>
      <link>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762960#M94359</link>
      <description>&lt;P&gt;The Scripting Index, available under the Help pull down menu has both the definition of the function and of the parameters, along with examples.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2024 11:57:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Data-preparation-substract-column-data-by-other-column/m-p/762960#M94359</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-06-09T11:57:07Z</dc:date>
    </item>
  </channel>
</rss>

