<?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: merging values from 2 columns into one (mixed numeric and character values) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536406#M75847</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;well sort of working.. I found a problem. There was a column with 'char' data type that had a fixed string content : "R001"&lt;/P&gt;&lt;P&gt;after running the script it changes to numeric type, with value of '1'. Why is this hapenning?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2022 11:44:24 GMT</pubDate>
    <dc:creator>shlomi_bakish</dc:creator>
    <dc:date>2022-08-23T11:44:24Z</dc:date>
    <item>
      <title>merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536312#M75832</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 columns, one containing numeric values, and one containing strings.&lt;/P&gt;&lt;P&gt;I want to create a third column that takes the numeric value if the string value is 'parametric', and the string value if it's not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this, but I'm getting an error "Column TEST_RESULT requires numeric values", although it's defined as Character type column.&lt;/P&gt;&lt;P&gt;I'm using JMP15 if it matters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_test_result =dt &amp;lt;&amp;lt;new column ("TEST_RESULT",Character);

Column(dt_subset,"TEST_RESULT")&amp;lt;&amp;lt;set formula(if(:COMMENTS=="Parametric",:NUMERIC_RESULT,:COMMENTS));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Later on I want to split this column so the output table will have either numeric or character type data, will JMP be able to set it to numeric based&lt;BR /&gt;on the contents although the source column was character?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:53:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536312#M75832</guid>
      <dc:creator>shlomi_bakish</dc:creator>
      <dc:date>2023-06-10T23:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536335#M75834</link>
      <description>&lt;P&gt;You need to use the Char() function to convert the numeric data to character&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_test_result = dt &amp;lt;&amp;lt; New Column( "TEST_RESULT", Character );

dt_subset:TEST_RESULT &amp;lt;&amp;lt; set formula( If( :COMMENTS == "Parametric", Char( :NUMERIC_RESULT ), :COMMENTS ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Aug 2022 06:35:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536335#M75834</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-23T06:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536338#M75835</link>
      <description>&lt;P&gt;You cannot have mixed values in one column. You could add Char() around your :NUMERIC_RESULT if those are numeric values&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Column(dt_subset, "TEST_RESULT") &amp;lt;&amp;lt; set formula(If(:COMMENTS == "Parametric", Char(:NUMERIC_RESULT), :COMMENTS));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And when you split the column just set the data type to what you want. Do note that if you have character values in numeric column, those will be changed to missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 06:39:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536338#M75835</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-08-23T06:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536365#M75837</link>
      <description>&lt;P&gt;Thanks ! adding the 'char()' solved the first issue.&lt;/P&gt;&lt;P&gt;But now - I have 2 other issues, after splitting the merged column.&lt;BR /&gt;I'm splitting it by another column, so the resulting columns all have one type of data (string or numeric), there are ~150 different columns.&lt;/P&gt;&lt;P&gt;The problems :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. All the split columns are still with the original formula from merged column. How do I make the source column a value (like in excel - paste speical, values).&lt;/P&gt;&lt;P&gt;2. All the split columns are generated as character type, and that's not what I wanted, I want them to got automatic type based on their content, just like&lt;BR /&gt;when I'm opening a csv file - JMP sets the type automatically, so if all values in a column are numeric, it will get numeric type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 08:55:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536365#M75837</guid>
      <dc:creator>shlomi_bakish</dc:creator>
      <dc:date>2022-08-23T08:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536369#M75838</link>
      <description>&lt;P&gt;Here is a little piece of code that will go through a data table and convert any character column that is made up of all valid numeric values, to a numeric data type;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

For Each( {value, index}, dt &amp;lt;&amp;lt; get column names( string ),
	If( Column( value ) &amp;lt;&amp;lt; get data type == "Character",
		vals = Column( value ) &amp;lt;&amp;lt; get values;
		nonMissing = Col Number( As Column( value ) );
		Column( value ) &amp;lt;&amp;lt; set data type( numeric ) &amp;lt;&amp;lt; modeling type( continuous );
		If( nonMissing != Col Number( As Column( value ) ),
			Column( value ) &amp;lt;&amp;lt; set data type( character ) &amp;lt;&amp;lt; set values( vals )
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Aug 2022 09:54:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536369#M75838</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-23T09:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536392#M75841</link>
      <description>&lt;P&gt;Thanks ! that looks exactly what I need, but unfortunately it's not working.&lt;/P&gt;&lt;P&gt;I tried to debug - the first line is working - getting list of columns names.&lt;/P&gt;&lt;P&gt;The second one get the below error. any idea?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shlomi_bakish_0-1661250829655.png" style="width: 895px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44929i6AC11B60088BF383/image-dimensions/895x170?v=v2" width="895" height="170" role="button" title="shlomi_bakish_0-1661250829655.png" alt="shlomi_bakish_0-1661250829655.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 10:35:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536392#M75841</guid>
      <dc:creator>shlomi_bakish</dc:creator>
      <dc:date>2022-08-23T10:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536393#M75842</link>
      <description>&lt;P&gt;Just as a comment:&lt;/P&gt;
&lt;P&gt;It is not a restriction, but it is the basic mindset of JMP that each column has a defined datatype, that you can actively set according to your needs.&lt;/P&gt;
&lt;P&gt;The datatype, once set properly, makes following analyses so easy to perform.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 10:40:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536393#M75842</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-08-23T10:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536398#M75844</link>
      <description>&lt;P&gt;I think you're using &amp;lt; Version 16, so you have to use std "For" syntax, see&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

// JMP16 "For Each"
dt &amp;lt;&amp;lt; get column names( string );
For Each( {value, index}, dt &amp;lt;&amp;lt; get column names( string ), Print( value ) );

// JMP &amp;lt;16 "For"
col_lst = dt &amp;lt;&amp;lt; get column names( string );
For( i = 1, i &amp;lt;= N Items( col_lst ), i++,
	Print( col_lst[i] )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 10:58:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536398#M75844</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-08-23T10:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536401#M75845</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks it's working now !&lt;/P&gt;&lt;P&gt;now just one thing - how do I get rid of the original formula? I just want the resulting value of the formula, is it possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 11:07:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536401#M75845</guid>
      <dc:creator>shlomi_bakish</dc:creator>
      <dc:date>2022-08-23T11:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536406#M75847</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;well sort of working.. I found a problem. There was a column with 'char' data type that had a fixed string content : "R001"&lt;/P&gt;&lt;P&gt;after running the script it changes to numeric type, with value of '1'. Why is this hapenning?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 11:44:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536406#M75847</guid>
      <dc:creator>shlomi_bakish</dc:creator>
      <dc:date>2022-08-23T11:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536428#M75849</link>
      <description>&lt;P&gt;The R followed by an all numeric value is being interpreted by JMP as a currency.&amp;nbsp; The South African Rand's notation is in the form:&amp;nbsp; R123 or R55.67 etc.&amp;nbsp; So JMP is interpreting it as numeric values.&amp;nbsp; You could add a check to the code to check for this exception.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 12:43:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536428#M75849</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-23T12:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536464#M75851</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wow I didn't see this coming :)&lt;/img&gt; thanks a lot for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 13:54:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/536464#M75851</guid>
      <dc:creator>shlomi_bakish</dc:creator>
      <dc:date>2022-08-23T13:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: merging values from 2 columns into one (mixed numeric and character values)</title>
      <link>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/549656#M76607</link>
      <description>&lt;P&gt;JMP 17 will have an optional argument for num("R001", &lt;STRONG&gt;&amp;lt;&amp;lt;Restrict&lt;/STRONG&gt;) to prevent this behavior.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 01:13:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/merging-values-from-2-columns-into-one-mixed-numeric-and/m-p/549656#M76607</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-09-27T01:13:52Z</dc:date>
    </item>
  </channel>
</rss>

