<?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 How to set values for last 30 rows of a column? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-set-values-for-last-30-rows-of-a-column/m-p/463713#M70835</link>
    <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a complete scripting newbie here so please have patience with me :crossed_fingers:&lt;/img&gt;.&amp;nbsp; I have a data set with multiple columns and am trying to make a script that will automatically select the last 30 rows of a column and change the content from "baseline" to "CLCR". Please see my attempt:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt1 = dt &amp;lt;&amp;lt; Select Columns( :CLCR );
dt1 &amp;lt;&amp;lt; select where( Row() &amp;gt; N Rows( dt ) - 30 );
dt1 &amp;lt;&amp;lt; set value ("CLCR");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Should I have taken the&amp;nbsp;&lt;EM&gt;for loop&amp;nbsp;&lt;/EM&gt;or&amp;nbsp;&lt;EM&gt;while loop&amp;nbsp;&lt;/EM&gt;approach?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS GUYS ✌&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:44:43 GMT</pubDate>
    <dc:creator>kkrog</dc:creator>
    <dc:date>2023-06-10T23:44:43Z</dc:date>
    <item>
      <title>How to set values for last 30 rows of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-set-values-for-last-30-rows-of-a-column/m-p/463713#M70835</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a complete scripting newbie here so please have patience with me :crossed_fingers:&lt;/img&gt;.&amp;nbsp; I have a data set with multiple columns and am trying to make a script that will automatically select the last 30 rows of a column and change the content from "baseline" to "CLCR". Please see my attempt:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt1 = dt &amp;lt;&amp;lt; Select Columns( :CLCR );
dt1 &amp;lt;&amp;lt; select where( Row() &amp;gt; N Rows( dt ) - 30 );
dt1 &amp;lt;&amp;lt; set value ("CLCR");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Should I have taken the&amp;nbsp;&lt;EM&gt;for loop&amp;nbsp;&lt;/EM&gt;or&amp;nbsp;&lt;EM&gt;while loop&amp;nbsp;&lt;/EM&gt;approach?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS GUYS ✌&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:44:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-set-values-for-last-30-rows-of-a-column/m-p/463713#M70835</guid>
      <dc:creator>kkrog</dc:creator>
      <dc:date>2023-06-10T23:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to set values for last 30 rows of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-set-values-for-last-30-rows-of-a-column/m-p/463722#M70836</link>
      <description>&lt;P&gt;I would use &lt;A href="https://community.jmp.com/t5/Uncharted/Data-table-subscripting/ba-p/21013" target="_blank" rel="noopener"&gt;datatable subscripting&lt;/A&gt;:&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[N Rows(dt) - 29::N Rows(dt), "height"] = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit, one more option:&lt;/P&gt;
&lt;P&gt;You can also use get rows where to get specific rows. You can use similar where argument here as you would in select where&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

// get rows into a matrix
r = dt &amp;lt;&amp;lt; Get Rows Where(Row() &amp;gt; N Rows(dt) - 30);

// set values
Column(dt, "height")[r] = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 12:16:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-set-values-for-last-30-rows-of-a-column/m-p/463722#M70836</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-02-24T12:16:53Z</dc:date>
    </item>
  </channel>
</rss>

