<?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 do I reference to a column by column number in jsl when column number is a variable? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231706#M45962</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I'm having trouble subsetting columns.&amp;nbsp; In the code below, I'm looking to create multiple new data tables (and perform some analyses with them- though I deleted that part of the script) from my current table. My current table is formatted with one "X" column (column 1) and several "Y" columns (columns 2 through ncols(dt). I'm having an issue where the columns() function does not recognize icol as a variable representing a number (I assume it's looking for a column named icol). Is there a fix for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=current data table();
For( icol = 2, icol &amp;lt;= ncols(dt) , icol++,
	dt &amp;lt;&amp;lt; Subset( All rows, columns( 1, icol  ))
)&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2019 12:21:49 GMT</pubDate>
    <dc:creator>Melissa</dc:creator>
    <dc:date>2019-11-01T12:21:49Z</dc:date>
    <item>
      <title>How do I reference to a column by column number in jsl when column number is a variable?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231706#M45962</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I'm having trouble subsetting columns.&amp;nbsp; In the code below, I'm looking to create multiple new data tables (and perform some analyses with them- though I deleted that part of the script) from my current table. My current table is formatted with one "X" column (column 1) and several "Y" columns (columns 2 through ncols(dt). I'm having an issue where the columns() function does not recognize icol as a variable representing a number (I assume it's looking for a column named icol). Is there a fix for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=current data table();
For( icol = 2, icol &amp;lt;= ncols(dt) , icol++,
	dt &amp;lt;&amp;lt; Subset( All rows, columns( 1, icol  ))
)&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 12:21:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231706#M45962</guid>
      <dc:creator>Melissa</dc:creator>
      <dc:date>2019-11-01T12:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reference to a column by column number in jsl when column number is a variable?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231718#M45964</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9344"&gt;@Melissa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this method,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Current Data Table();
icol = dt &amp;lt;&amp;lt; Get Column Names();

For( i = 2, i &amp;lt;= N Items( icol ), i++,
	dt1 = dt &amp;lt;&amp;lt; subset( all rows, columns( 1, icol[i] ),
		output table( "subset - " || Char( icol[i] ) ), 
		
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let us know if it works for you.&lt;/P&gt;
&lt;P&gt;ron&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 12:43:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231718#M45964</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2019-11-01T12:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reference to a column by column number in jsl when column number is a variable?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231719#M45965</link>
      <description>Thanks! that's exactly what I was looking for.</description>
      <pubDate>Fri, 01 Nov 2019 13:00:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-reference-to-a-column-by-column-number-in-jsl-when/m-p/231719#M45965</guid>
      <dc:creator>Melissa</dc:creator>
      <dc:date>2019-11-01T13:00:08Z</dc:date>
    </item>
  </channel>
</rss>

