<?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: How do I correctly iterate over column names to produce summary tables grouped by each? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590509#M79499</link>
    <description>&lt;P&gt;The main issue that you were running into was that the Column() function has an optional element that can be specified that points to the data table reference to set the table to get the column from.&amp;nbsp; If it is not specified, it points to the currently active data table.&amp;nbsp; Since the Summary platform creates a new data table, it is that new table that it points to, rather than the original one you want it to point to.&amp;nbsp; The code below provides specific references.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = Current Data Table();
N = N Col( dt );
For( i = 1, i &amp;lt;= N, i++,
	colname = Column( dt, i ) &amp;lt;&amp;lt; getname();
	If( Starts With( As Column( dt, i ) &amp;lt;&amp;lt; getname(), "9" ),
		dt &amp;lt;&amp;lt; Summary(
			Group(  colname  ),
			N,
			Subgroup( :INTERFACE_BIN_119325 ),
			Freq( "None" ),
			Weight( "None" )
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 16:17:45 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-01-17T16:17:45Z</dc:date>
    <item>
      <title>How do I correctly iterate over column names to produce summary tables grouped by each?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590473#M79497</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm writing a script in jsl to search through column headers, find those beginning with the number 9, and then produce a summary table from a large data set that is grouped by those columns. Currently, my code is working for the first column, but seems to stop after that. Any help would be appreciated!&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
N = N Col( dt );
For( i = 1, i &amp;lt;= N, i++,
	colname = Column( i ) &amp;lt;&amp;lt; getname();
	If( Starts With( :Column( i ) &amp;lt;&amp;lt; getname(), "9" ),
		Data Table( "Func Counter pull" ) &amp;lt;&amp;lt; Summary(
			Group( :Column( i ) &amp;lt;&amp;lt; getname() ),
			N,
			Subgroup( :INTERFACE_BIN_119325 ),
			Freq( "None" ),
			Weight( "None" )
		)
	)

	;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works through the iterations when doing like the following, but doesn't actually summarise by the group:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
N = N Col( dt );
emp_array = {};
For( i = 1, i &amp;lt;= N, i++,
	colname = Column( i ) &amp;lt;&amp;lt; getname();
	If( Starts With( :Column( i ) &amp;lt;&amp;lt; getname(), "9" ),
		Insert Into( emp_array, :Column( i ) &amp;lt;&amp;lt; getname() )
	);
);

For( m = 1, m &amp;lt;= N Items( emp_array ), m++,
	a = emp_array[m];
	Data Table( "Func Counter pull" ) &amp;lt;&amp;lt; Summary(
		Group( :Name( "a" ) ),
		N,
		Subgroup( :INTERFACE_BIN_119325 ),
		Freq( "None" ),
		Weight( "None" )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If someone could point out how either is going wrong , that would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:42:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590473#M79497</guid>
      <dc:creator>OC200m</dc:creator>
      <dc:date>2023-06-08T16:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I correctly iterate over column names to produce summary tables grouped by each?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590509#M79499</link>
      <description>&lt;P&gt;The main issue that you were running into was that the Column() function has an optional element that can be specified that points to the data table reference to set the table to get the column from.&amp;nbsp; If it is not specified, it points to the currently active data table.&amp;nbsp; Since the Summary platform creates a new data table, it is that new table that it points to, rather than the original one you want it to point to.&amp;nbsp; The code below provides specific references.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = Current Data Table();
N = N Col( dt );
For( i = 1, i &amp;lt;= N, i++,
	colname = Column( dt, i ) &amp;lt;&amp;lt; getname();
	If( Starts With( As Column( dt, i ) &amp;lt;&amp;lt; getname(), "9" ),
		dt &amp;lt;&amp;lt; Summary(
			Group(  colname  ),
			N,
			Subgroup( :INTERFACE_BIN_119325 ),
			Freq( "None" ),
			Weight( "None" )
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:17:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590509#M79499</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-17T16:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I correctly iterate over column names to produce summary tables grouped by each?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590969#M79513</link>
      <description>&lt;P&gt;Makes sense, thanks so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 08:42:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-correctly-iterate-over-column-names-to-produce-summary/m-p/590969#M79513</guid>
      <dc:creator>OC200m</dc:creator>
      <dc:date>2023-01-18T08:42:29Z</dc:date>
    </item>
  </channel>
</rss>

