<?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: Is there a a way to input a list of columns as by group variables into column mean/std dev/median? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479181#M72346</link>
    <description>&lt;P&gt;If you columns in a list with :name format, you can also use this option (idea from &lt;LI-MESSAGE title="Using list of columns in formulas" uid="405133" url="https://community.jmp.com/t5/Discussions/Using-list-of-columns-in-formulas/m-p/405133#U405133" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt; )&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open("$SAMPLE_DATA/big class.jmp");

col_list = {:height, :Sex, :Age};
formula_expr = Name Expr(Substitute(col_list, Expr(List()), Expr(Col Mean())));

Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Column("Mean", Formula(Expr(formula_expr)));
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For using Eval, Eval Expr, Expr, Substitute... see &lt;LI-MESSAGE title="Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute" uid="48998" url="https://community.jmp.com/t5/JSL-Cookbook/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/m-p/48998#U48998" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2022 15:25:12 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-04-14T15:25:12Z</dc:date>
    <item>
      <title>Is there a a way to input a list of columns as by group variables into column mean/std dev/median?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479138#M72344</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm trying to generate a new column to be a mean column of :A by groups specified by :B, :C, :D.&lt;/P&gt;&lt;P&gt;Is there a way to do this where :B, :C, :D&lt;/img&gt; is a list? I'd like this so I can populate it using Col Dialog.&lt;/P&gt;&lt;P&gt;If not, is there a way to break the list into arguments?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first line below gives me the desired means while the second line gives me the overall mean of :A.&lt;/P&gt;&lt;P&gt;mean= New Column("Mean", Formula(Col Mean(:A, :B, :C, :D)));&lt;BR /&gt;mean = New Column("Mean", Formula(Col Mean(:A, {:B, :C, :D})));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:57:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479138#M72344</guid>
      <dc:creator>oto</dc:creator>
      <dc:date>2023-06-09T16:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a a way to input a list of columns as by group variables into column mean/std dev/median?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479180#M72345</link>
      <description>&lt;P&gt;Here is an easy way to solve this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );

colList = {"height", "Sex", "Age"};

Eval(
	Substitute(
			Expr(
				dt &amp;lt;&amp;lt; New Column( "Mean",
					formula( Col Mean( __one__, __two__, __three__ ) )
				)
			),
		Expr( __one__ ), Parse( ":" || colList[1] ),
		Expr( __two__ ), Parse( ":" || colList[2] ),
		Expr( __three__ ), Parse( ":" || colList[3] )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2022 15:09:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479180#M72345</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-04-14T15:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a a way to input a list of columns as by group variables into column mean/std dev/median?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479181#M72346</link>
      <description>&lt;P&gt;If you columns in a list with :name format, you can also use this option (idea from &lt;LI-MESSAGE title="Using list of columns in formulas" uid="405133" url="https://community.jmp.com/t5/Discussions/Using-list-of-columns-in-formulas/m-p/405133#U405133" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt; )&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open("$SAMPLE_DATA/big class.jmp");

col_list = {:height, :Sex, :Age};
formula_expr = Name Expr(Substitute(col_list, Expr(List()), Expr(Col Mean())));

Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Column("Mean", Formula(Expr(formula_expr)));
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For using Eval, Eval Expr, Expr, Substitute... see &lt;LI-MESSAGE title="Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute" uid="48998" url="https://community.jmp.com/t5/JSL-Cookbook/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/m-p/48998#U48998" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 15:25:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479181#M72346</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-04-14T15:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a a way to input a list of columns as by group variables into column mean/std dev/median?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479182#M72347</link>
      <description>&lt;P&gt;Thanks Jim, would there be a way to do this if the size of the list was undetermined?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 15:25:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479182#M72347</guid>
      <dc:creator>oto</dc:creator>
      <dc:date>2022-04-14T15:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a a way to input a list of columns as by group variables into column mean/std dev/median?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479184#M72348</link>
      <description>&lt;P&gt;Of course there is.&amp;nbsp;&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;shows one way of handling it, by converting the elements of the list you will be getting from your dialog box, to expressions.&amp;nbsp; Or, since JSL is a programming language, it provides you with all of the structures you need to solve the problem.&amp;nbsp; Given that you are somewhat new to JSL I strongly suggest that you take a look at the Scripting Guide.&amp;nbsp; It is the best way to learn about the structures and features of JSL.&amp;nbsp; The Scripting Guide is available in the JMP Documenation Library under the Help pull down menu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is another way to handle the issue, which should give you what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );

colList = {"height", "Sex", "Age"};

__vals__ = Concat Items( colList, "," );

Eval(
	Parse(
		Eval Insert(
			"dt &amp;lt;&amp;lt; New Column( \!"Mean\!",
					formula( Col Mean( ^__vals__^) )
				)
			;"
		)
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2022 16:03:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479184#M72348</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-04-14T16:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a a way to input a list of columns as by group variables into column mean/std dev/median?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479273#M72350</link>
      <description>&lt;P&gt;Thank you all, this got me down the right direction.&lt;/P&gt;&lt;P&gt;Still learning about expressions and evaluations, thank you for the example.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 18:42:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-a-way-to-input-a-list-of-columns-as-by-group/m-p/479273#M72350</guid>
      <dc:creator>oto</dc:creator>
      <dc:date>2022-04-14T18:42:54Z</dc:date>
    </item>
  </channel>
</rss>

