<?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: Loop for Recode in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Loop-for-Recode/m-p/517728#M74403</link>
    <description>&lt;P&gt;I found replacing 'dt;col_lis[21]' with 'as column(col_list[21])' solved my problem&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2022 14:49:52 GMT</pubDate>
    <dc:creator>Jemster</dc:creator>
    <dc:date>2022-07-05T14:49:52Z</dc:date>
    <item>
      <title>Loop for Recode</title>
      <link>https://community.jmp.com/t5/Discussions/Loop-for-Recode/m-p/517701#M74397</link>
      <description>&lt;P&gt;I have several columns of data with numbers in.&lt;/P&gt;&lt;P&gt;When I import the data from excel some columns get imported as strings.&lt;/P&gt;&lt;P&gt;I would like to be able to loop through all columns and change their data type to integer.&lt;/P&gt;&lt;P&gt;The below script is an attempt to change one column.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_list = dt &amp;lt;&amp;lt; Get Column Names ()

dt &amp;lt;&amp;lt; Begin Data Update;
dt &amp;lt;&amp;lt; Recode Column(
	dt;col_list[21],
	{Num( _rcNow )},
	Update Properties( 1 ),
	Target Column( ;col_list[21] )
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The command&amp;nbsp; below gives the right column but the code above gives an error on line 5 stating "Source column cannot be found in access or evaluation of 'Glue' , dt; /*###*/col_list[21] /*###*/;" I was wondering if I had to write the code as an expression then evaluate it and substitute the column into the relevant parts.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Show(dt;col_list[2]);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:03:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Loop-for-Recode/m-p/517701#M74397</guid>
      <dc:creator>Jemster</dc:creator>
      <dc:date>2023-06-09T17:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Recode</title>
      <link>https://community.jmp.com/t5/Discussions/Loop-for-Recode/m-p/517728#M74403</link>
      <description>&lt;P&gt;I found replacing 'dt;col_lis[21]' with 'as column(col_list[21])' solved my problem&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 14:49:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Loop-for-Recode/m-p/517728#M74403</guid>
      <dc:creator>Jemster</dc:creator>
      <dc:date>2022-07-05T14:49:52Z</dc:date>
    </item>
  </channel>
</rss>

