<?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: JMP - How to pass a dynamic list of columns to Summary() in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6408#M6404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This example seems to work and may help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;colList = dt &amp;lt;&amp;lt; Get Column Names();&lt;/P&gt;&lt;P&gt;dtsum = dt &amp;lt;&amp;lt; Summary(Mean( Eval( colList ) ) );&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Mar 2013 13:14:33 GMT</pubDate>
    <dc:creator>mpb</dc:creator>
    <dc:date>2013-03-08T13:14:33Z</dc:date>
    <item>
      <title>JMP - How to pass a dynamic list of columns to Summary()</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6407#M6403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to open a data table (using Big Class.jmp as example, but want to do this for any table) and create a summary table for each column, returning the number of non-missing values for each column (as shown in table below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;N Rows&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;N(name)&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;N(age)&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;N(sex)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;N(height)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;N(weight)&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried two different approaches to this and have had no success (I'm using JMP 9.0.3 64bit).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the first example, I try to pass a list of parsed strings {N(:name),N(:age),N(:sex),N(:height),N(:weight)} to Summary(). However, when I run this, it only creates a summary table with N Rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example1&lt;/P&gt;&lt;P&gt;///////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt = current data table();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;colList = dt&amp;lt;&amp;lt;Get Column Names();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;icols = N Items(colList);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sumList={};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for(i=1, i&amp;lt;=icols, i++,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Insert Into(sumList, parse("N(:" || char(colList&lt;I&gt;) || ")"))&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;summDt = dt&amp;lt;&amp;lt;Summary(Group, Eval(sumList), output table name("Summary_Table"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then tried to define an expression and pass a parsed string (N(:name),N(:age),N(:sex),N(:height),N(:weight)). However, when I try to evaluate this expression, I get the following...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unexpected ",". Perhaps there is a missing ";" or ",".&lt;/P&gt;&lt;P&gt;Line 1 Column 9: N(:name)►, N(:age), N(:sex), N(:height), N(:weight) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The remaining text that was ignored was&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example2&lt;/P&gt;&lt;P&gt;///////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt = current data table();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;colList = dt&amp;lt;&amp;lt;Get Column Names();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;icols = N Items(colList);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MyExpr = expr(summDt = dt&amp;lt;&amp;lt;Summary(Group, expr(parse(strColumns)), output table name("Summary_Table")));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for(i=1, i&amp;lt;=icols, i++,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i==1, strColumns = "N(:" || char(colList&lt;I&gt;) || ")", strColumns = strColumns || ", N(:" || char(colList&lt;I&gt;) || ")")&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//bypass above for check&lt;/P&gt;&lt;P&gt;//strColumns = "N(:name)"; //will work for one column, but throws an error when I try to pass more than one column (i.e. "Unexpected ",". Perhaps there is a missing ";" or ",".")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test = Eval Expr(MyExpr);&lt;/P&gt;&lt;P&gt;test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must be doing something silly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advice/help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 09:28:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6407#M6403</guid>
      <dc:creator>brianm</dc:creator>
      <dc:date>2013-03-08T09:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: JMP - How to pass a dynamic list of columns to Summary()</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6408#M6404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This example seems to work and may help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;colList = dt &amp;lt;&amp;lt; Get Column Names();&lt;/P&gt;&lt;P&gt;dtsum = dt &amp;lt;&amp;lt; Summary(Mean( Eval( colList ) ) );&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 13:14:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6408#M6404</guid>
      <dc:creator>mpb</dc:creator>
      <dc:date>2013-03-08T13:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: JMP - How to pass a dynamic list of columns to Summary()</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6409#M6405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks mpb!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I feel pretty pretty embarrassed now - it was so simple &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 13:27:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/6409#M6405</guid>
      <dc:creator>brianm</dc:creator>
      <dc:date>2013-03-08T13:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: JMP - How to pass a dynamic list of columns to Summary()</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/264515#M51575</link>
      <description>Thanks. Plain and helpful.</description>
      <pubDate>Tue, 05 May 2020 14:25:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-How-to-pass-a-dynamic-list-of-columns-to-Summary/m-p/264515#M51575</guid>
      <dc:creator>Thomas1</dc:creator>
      <dc:date>2020-05-05T14:25:16Z</dc:date>
    </item>
  </channel>
</rss>

