<?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 JSL: Iterate through columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Iterate-through-columns/m-p/40305#M23602</link>
    <description>&lt;P&gt;Hi, I have 2 questions (very new to this!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I have multple columns of like data, and I need to apply the same formula to all of them. For example, if I had to find the mean of each column, can I automate that through some sort of iteration?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, how do I go about saving an operation as a list and not as a new column? For exmaple, if I had the following operation creating a new column in my chart&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; New Column( "Example", Numeric, Formula(Col Mean( :Height, :Age&amp;nbsp;) ) );&lt;/P&gt;&lt;P&gt;(Basically finding the mean height for each age), could I simply store this operation as a list that can be used in another operation, rather than a column on my chart?&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;</description>
    <pubDate>Mon, 12 Jun 2017 20:41:34 GMT</pubDate>
    <dc:creator>matt7109</dc:creator>
    <dc:date>2017-06-12T20:41:34Z</dc:date>
    <item>
      <title>JSL: Iterate through columns</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Iterate-through-columns/m-p/40305#M23602</link>
      <description>&lt;P&gt;Hi, I have 2 questions (very new to this!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I have multple columns of like data, and I need to apply the same formula to all of them. For example, if I had to find the mean of each column, can I automate that through some sort of iteration?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, how do I go about saving an operation as a list and not as a new column? For exmaple, if I had the following operation creating a new column in my chart&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; New Column( "Example", Numeric, Formula(Col Mean( :Height, :Age&amp;nbsp;) ) );&lt;/P&gt;&lt;P&gt;(Basically finding the mean height for each age), could I simply store this operation as a list that can be used in another operation, rather than a column on my chart?&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;</description>
      <pubDate>Mon, 12 Jun 2017 20:41:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Iterate-through-columns/m-p/40305#M23602</guid>
      <dc:creator>matt7109</dc:creator>
      <dc:date>2017-06-12T20:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: JSL: Iterate through columns</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Iterate-through-columns/m-p/40311#M23607</link>
      <description>&lt;P&gt;The script below handles your first 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" );

colnames = dt &amp;lt;&amp;lt; get column names( numeric,string );
meanlist = {};
For( i = 1, i &amp;lt;= N Items( colnames ), i++,
	meanlist[i] = Col Mean( column(dt,colnames[i]) )
);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the second issue, you could meet what you need by creating a character column and then create your 2 or more calculations, convert each of them into a character string, and then concatinate the values together, to place them into a List, convert the list to a string: &amp;nbsp;Char(MyList)......which would end up looking like "{45, 34}";&lt;/P&gt;
&lt;P&gt;Or lastly, you could save the list as an expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But as far as JMP automatically handling the results in analyses, it currently does not have that capability&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 21:30:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Iterate-through-columns/m-p/40311#M23607</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-06-12T21:30:59Z</dc:date>
    </item>
  </channel>
</rss>

