cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
shlomi_bakish
Level II

merging values from 2 columns into one (mixed numeric and character values)

Hi

 

I have 2 columns, one containing numeric values, and one containing strings.

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.

 

I tried this, but I'm getting an error "Column TEST_RESULT requires numeric values", although it's defined as Character type column.

I'm using JMP15 if it matters.

 

col_test_result =dt <<new column ("TEST_RESULT",Character);

Column(dt_subset,"TEST_RESULT")<<set formula(if(:COMMENTS=="Parametric",:NUMERIC_RESULT,:COMMENTS));

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
on the contents although the source column was character?

 

 

12 REPLIES 12
txnelson
Super User

Re: merging values from 2 columns into one (mixed numeric and character values)

The R followed by an all numeric value is being interpreted by JMP as a currency.  The South African Rand's notation is in the form:  R123 or R55.67 etc.  So JMP is interpreting it as numeric values.  You could add a check to the code to check for this exception.

Jim
shlomi_bakish
Level II

Re: merging values from 2 columns into one (mixed numeric and character values)

 

wow I didn't see this coming thanks a lot for your help!

Craige_Hales
Super User

Re: merging values from 2 columns into one (mixed numeric and character values)

JMP 17 will have an optional argument for num("R001", <<Restrict) to prevent this behavior.

Craige