<?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: A variable in a loop in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71506#M35431</link>
    <description>&lt;P&gt;Those options go inside the Import Settings.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Open(
  "C:\...\simple.txt",
  columns(
    New Column( "1", Numeric, "Continuous", Format( "Best", 12 ) ),
    New Column( "2", Numeric, "Continuous", Format( "Best", 12 ) )
  ),
  Import Settings(
    End Of Line( CRLF, CR, LF ),
    End Of Field( Comma, CSV( 0 ) ),
    Strip Quotes( 1 ),
    Use Apostrophe as Quotation Mark( 0 ),
    Use Regional Settings( 0 ),
    Scan Whole File( 1 ),
    Treat empty columns as numeric( 0 ),
    CompressNumericColumns( 0 ),
    CompressCharacterColumns( 0 ),
    CompressAllowListCheck( 0 ),
    Labels( 1 ),
    Column Names Start( 1 ), // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
    Data Starts( 2 ), // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
    Lines To Read( "All" ),
    Year Rule( "20xx" )
  )
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 05 Sep 2018 21:31:29 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2018-09-05T21:31:29Z</dc:date>
    <item>
      <title>A variable in a loop</title>
      <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71485#M35420</link>
      <description>&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;I like to replace the values for&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;Column Names Start(&lt;SPAN class="s2"&gt;2&lt;/SPAN&gt;),&lt;/P&gt;&lt;P class="p1"&gt;Data Starts(&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;) );&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;as a variable like Headstart=2, DataStart=3 in Column Names Start(HeadStart). I used&lt;/P&gt;&lt;P class="p1"&gt;Eval(Parse( "&amp;nbsp;&lt;SPAN&gt;Column Names Start("||HeadStart||"&lt;/SPAN&gt;&lt;SPAN&gt;),"&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;I get no error but the results are not correct.&lt;/P&gt;&lt;P class="p1"&gt;I appreciate your help. Thanks&lt;/P&gt;&lt;P class="p1"&gt;----------------------------------------------------------------&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1" style="font-family: inherit;"&gt;For&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;( iii = &lt;/SPAN&gt;&lt;SPAN class="s2" style="font-family: inherit;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;, iii &amp;lt;= nf, iii++, &lt;/SPAN&gt;&lt;SPAN class="s3" style="font-family: inherit;"&gt;//this starts the first loop&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;filenow = (filelist[iii]);&lt;/P&gt;&lt;P class="p1"&gt;dt = &lt;SPAN class="s1"&gt;Open&lt;/SPAN&gt;( filenow, private,&lt;/P&gt;&lt;P class="p1"&gt;Column Names Start(&lt;SPAN class="s2"&gt;2&lt;/SPAN&gt;),&lt;/P&gt;&lt;P class="p1"&gt;Data Starts( &lt;SPAN class="s2"&gt;3&lt;/SPAN&gt; ) );&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;New Column&lt;/SPAN&gt;( &lt;SPAN class="s5"&gt;"Source"&lt;/SPAN&gt;, Character, Nominal );&lt;/P&gt;&lt;P class="p1"&gt;:Source &amp;lt;&amp;lt; &lt;SPAN class="s6"&gt;set each value&lt;/SPAN&gt;( filenow );&lt;/P&gt;&lt;P class="p3"&gt;//dt&amp;lt;&amp;lt;new column("Source", character, nominal)&amp;lt;&amp;lt;set each value(9999);&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s4"&gt;dt &amp;lt;&amp;lt; &lt;/SPAN&gt;Run Formulas&lt;SPAN class="s4"&gt;();&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;//add the current table to the bottom of the combined data table&lt;/P&gt;&lt;P class="p1"&gt;cctable &amp;lt;&amp;lt; &lt;SPAN class="s6"&gt;Concatenate&lt;/SPAN&gt;( &lt;SPAN class="s1"&gt;Data Table&lt;/SPAN&gt;( dt ), Append to first table );&lt;/P&gt;&lt;P class="p3"&gt;//don't use "Create Source Column" argument&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN class="s1"&gt;Close&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;( dt, NoSave );&lt;/SPAN&gt;//after concatenating the table, close it and move on&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN class="s4"&gt;);&lt;/SPAN&gt;//end of the first for loop&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 18:31:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71485#M35420</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-09-05T18:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: A variable in a loop</title>
      <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71506#M35431</link>
      <description>&lt;P&gt;Those options go inside the Import Settings.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Open(
  "C:\...\simple.txt",
  columns(
    New Column( "1", Numeric, "Continuous", Format( "Best", 12 ) ),
    New Column( "2", Numeric, "Continuous", Format( "Best", 12 ) )
  ),
  Import Settings(
    End Of Line( CRLF, CR, LF ),
    End Of Field( Comma, CSV( 0 ) ),
    Strip Quotes( 1 ),
    Use Apostrophe as Quotation Mark( 0 ),
    Use Regional Settings( 0 ),
    Scan Whole File( 1 ),
    Treat empty columns as numeric( 0 ),
    CompressNumericColumns( 0 ),
    CompressCharacterColumns( 0 ),
    CompressAllowListCheck( 0 ),
    Labels( 1 ),
    Column Names Start( 1 ), // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
    Data Starts( 2 ), // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
    Lines To Read( "All" ),
    Year Rule( "20xx" )
  )
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Sep 2018 21:31:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71506#M35431</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-09-05T21:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: A variable in a loop</title>
      <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71517#M35434</link>
      <description>&lt;P&gt;Thanks. It is true that column data and name start can be defined in JMP preferences. But I have tried inside open() and it works fine. I just need to parametrize it inside the open().&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 21:40:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71517#M35434</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-09-05T21:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: A variable in a loop</title>
      <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71526#M35435</link>
      <description>&lt;P&gt;I would put the open into Substitution() structure to make the changes and to run the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;datastart = 2;
namestart = 1;

Eval(
	Substitute(
			Expr(
				Open(
					"C:\...\simple.txt",
					columns(
						New Column( "1", Numeric, "Continuous", Format( "Best", 12 ) ),
						New Column( "2", Numeric, "Continuous", Format( "Best", 12 ) )
					),
					Import Settings(
						End Of Line( CRLF, CR, LF ),
						End Of Field( Comma, CSV( 0 ) ),
						Strip Quotes( 1 ),
						Use Apostrophe as Quotation Mark( 0 ),
						Use Regional Settings( 0 ),
						Scan Whole File( 1 ),
						Treat empty columns as numeric( 0 ),
						CompressNumericColumns( 0 ),
						CompressCharacterColumns( 0 ),
						CompressAllowListCheck( 0 ),
						Labels( 1 ),
						Column Names Start( __namestart__ ), // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
						Data Starts( __datastart__ ), // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
						Lines To Read( "All" ),
						Year Rule( "20xx" )
					)
				)
			),
		Expr( __namestart__ ), namestart,
		Expr( __datastart__ ), datastart
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Sep 2018 22:02:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71526#M35435</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-05T22:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: A variable in a loop</title>
      <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71552#M35437</link>
      <description>&lt;P&gt;Thanks so much Jim. It works perfectly now.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 01:00:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71552#M35437</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-09-06T01:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: A variable in a loop</title>
      <link>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71601#M35449</link>
      <description>&lt;P&gt;Hm...so it does. This works for me:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;n=2; // b
d=4; // d
open(chartoblob(
"a
b
c
d"),columnnamesstart(n),datastarts(d))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I don't think the substitution is required for this. Glad Jim got you going!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 14:07:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/A-variable-in-a-loop/m-p/71601#M35449</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-09-06T14:07:37Z</dc:date>
    </item>
  </channel>
</rss>

