<?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 Script to change data type for all columns that contain a string in their header? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793868#M97113</link>
    <description>&lt;P&gt;I'm trying to write a script to change all the columns with the word "Mean" in their header to numeric data type and continuous modeling type.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting the error that "Send Expects Scriptible Object" regarding the last line "cols &amp;lt;&amp;lt; data type("numeric")". How would I fix my code? Or is there an easier way to accomplish the same task?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;cols = dt &amp;lt;&amp;lt; get column names( string );
For( i = N Items( cols ), i&amp;gt;=1, i--,
	If( Contains( cols[i], "Mean" ),
	 cols &amp;lt;&amp;lt; data type("numeric");  
	)
);&lt;/PRE&gt;&lt;P&gt;I'm using JMP Pro 16. Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 02 Sep 2024 21:26:59 GMT</pubDate>
    <dc:creator>Mcc99</dc:creator>
    <dc:date>2024-09-02T21:26:59Z</dc:date>
    <item>
      <title>Script to change data type for all columns that contain a string in their header?</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793868#M97113</link>
      <description>&lt;P&gt;I'm trying to write a script to change all the columns with the word "Mean" in their header to numeric data type and continuous modeling type.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting the error that "Send Expects Scriptible Object" regarding the last line "cols &amp;lt;&amp;lt; data type("numeric")". How would I fix my code? Or is there an easier way to accomplish the same task?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;cols = dt &amp;lt;&amp;lt; get column names( string );
For( i = N Items( cols ), i&amp;gt;=1, i--,
	If( Contains( cols[i], "Mean" ),
	 cols &amp;lt;&amp;lt; data type("numeric");  
	)
);&lt;/PRE&gt;&lt;P&gt;I'm using JMP Pro 16. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 21:26:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793868#M97113</guid>
      <dc:creator>Mcc99</dc:creator>
      <dc:date>2024-09-02T21:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Script to change data type for all columns that contain a string in their header?</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793878#M97114</link>
      <description>&lt;P&gt;You are sending the message to wrong variable. Something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cols = dt &amp;lt;&amp;lt; get column names(string);
For(i = N Items(cols), i &amp;gt;= 1, i--,
	If(Contains(cols[i], "Mean"),
		Column(dt, cols[i] &amp;lt;&amp;lt; data type("numeric")
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should work. I would also rewrite the script a little (use For Each and &amp;lt;&amp;lt; Set Data Type) as I think those are easier to read&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cols = dt &amp;lt;&amp;lt; get column names("String");

For Each({col}, cols,
	If(Contains(col, "Mean"),
		Column(dt, col) &amp;lt;&amp;lt; Set Data Type("Numeric");
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2024 21:34:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793878#M97114</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-02T21:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to change data type for all columns that contain a string in their header?</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793879#M97115</link>
      <description>&lt;P&gt;Thanks! That second script works great.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 21:45:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-change-data-type-for-all-columns-that-contain-a-string/m-p/793879#M97115</guid>
      <dc:creator>Mcc99</dc:creator>
      <dc:date>2024-09-02T21:45:24Z</dc:date>
    </item>
  </channel>
</rss>

