<?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 assign a series of value to selected rows without using a for loop？ in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404595#M65510</link>
    <description>&lt;P&gt;Hi, all&lt;BR /&gt;I used get rows where() to get a series of rows and want to assign the values in the rows under column b to the same rows under another column, like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rows = dt &amp;lt;&amp;lt; get rows where (column("b")[ ] == "xxx");&lt;BR /&gt;column ("a")[rows] = column ("b") [rows];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;But it doesn't work, want to know is there any way to assign a series of values to selected rows without using a for loop？&lt;BR /&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 19:53:30 GMT</pubDate>
    <dc:creator>j821005</dc:creator>
    <dc:date>2023-06-09T19:53:30Z</dc:date>
    <item>
      <title>How to assign a series of value to selected rows without using a for loop？</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404595#M65510</link>
      <description>&lt;P&gt;Hi, all&lt;BR /&gt;I used get rows where() to get a series of rows and want to assign the values in the rows under column b to the same rows under another column, like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rows = dt &amp;lt;&amp;lt; get rows where (column("b")[ ] == "xxx");&lt;BR /&gt;column ("a")[rows] = column ("b") [rows];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;But it doesn't work, want to know is there any way to assign a series of values to selected rows without using a for loop？&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:53:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404595#M65510</guid>
      <dc:creator>j821005</dc:creator>
      <dc:date>2023-06-09T19:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a series of value to selected rows without using a for loop？</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404605#M65513</link>
      <description>&lt;P&gt;Here is an example that shows one way to solve your issue&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$sample_data/big class.jmp");

// Create a new table with the same number of rows and a new
// character column called Gender
dtNew = New Table("New Table", add rows(nrows(dt)),
	New Column("Gender",character)
);

// Assign to all rows in big class that are females, the value
// of "Female" to the same rows in New Table
dtNew:Gender[dt&amp;lt;&amp;lt;get rows where(:sex=="F")]="Female";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jul 2021 03:13:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404605#M65513</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-28T03:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a series of value to selected rows without using a for loop？</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404608#M65514</link>
      <description>Thanks for your reply.&lt;BR /&gt;But instead of assign "a certain value", I want to assign "a series of values" to corresponding rows without a for loop.</description>
      <pubDate>Wed, 28 Jul 2021 03:22:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404608#M65514</guid>
      <dc:creator>j821005</dc:creator>
      <dc:date>2021-07-28T03:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a series of value to selected rows without using a for loop？</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404655#M65516</link>
      <description>&lt;P&gt;Others may have a more efficient way of doing this, but here is my solution&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$sample_data/big class.jmp");

// Create a new table with the same number of rows and a new
// character column called Gender
dtNew = New Table("New Table", add rows(nrows(dt)),
	New Column("Gender",character)
);

// Assign to all rows in big class that are females, the value
// of "Female" to the same rows in New Table
values = dt:sex &amp;lt;&amp;lt; get values;
dtNew:Gender &amp;lt;&amp;lt; set values(values);
dtNew:Gender[dt&amp;lt;&amp;lt;get rows where(:sex!="F")]="";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jul 2021 03:44:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404655#M65516</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-28T03:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a series of value to selected rows without using a for loop？</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404710#M65524</link>
      <description>&lt;P&gt;&lt;LI-MESSAGE title="Data table subscripting" uid="21013" url="https://community.jmp.com/t5/Uncharted/Data-table-subscripting/m-p/21013#U21013" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; might be what you are looking for. You can probably use something like dt[rows,{a}] = dt[rows,{b}]; where rows is a matrix with the row indexes and {a} and {b} are lists of columns. You'll also need the explicit dt which is returned by open() when you open the table, or by other functions like subset(), etc. that make new tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 11:33:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/404710#M65524</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-07-28T11:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a series of value to selected rows without using a for loop？</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/405035#M65548</link>
      <description>That's a good hint.&lt;BR /&gt;Thanks a lot!</description>
      <pubDate>Thu, 29 Jul 2021 01:29:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-assign-a-series-of-value-to-selected-rows-without-using-a/m-p/405035#M65548</guid>
      <dc:creator>j821005</dc:creator>
      <dc:date>2021-07-29T01:29:06Z</dc:date>
    </item>
  </channel>
</rss>

