cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
robot
Level VI

Convert Missing Numeric to Char

When converting a missing Numeric value to Char, Char() will return ".".  Is there a simple way to return ""?

(I know I can wrap with If( Is Missing( )), but this seems unnecessarily cumbersome.

 

 

New Table( "Missing Numeric to Char",
	Add Rows( 1 ),
	New Column( "Numeric", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [.] ) ),
	New Column( "Is Numeric Missing?", Numeric, "Continuous", Format( "Best", 12 ), Formula( Is Missing( :Numeric ) ) ),
	New Column( "Char", Character, "Nominal", Formula( Char( :Numeric ) ) ),
	New Column( "Is Char Missing?", Numeric, "Continuous", Format( "Best", 12 ), Formula( Is Missing( :Char ) ) ),
	New Column( "Really cumbersome method", Character, "Nominal", Formula( If( Is Missing( :Numeric ), "", Char( :Numeric ) ) ) ),
	New Column( "Is Really cumbersome method missing?",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Is Missing( :Really cumbersome method ) )
	)
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Convert Missing Numeric to Char

I think easiest is to just use If + Is Missing. Using the that like you do is better (easier to understand), but you can also leave the "" out

If(!IsMissing(:numeric), Char(:numeric))

And if you don't need a formula, just change the data type.

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Convert Missing Numeric to Char

I think easiest is to just use If + Is Missing. Using the that like you do is better (easier to understand), but you can also leave the "" out

If(!IsMissing(:numeric), Char(:numeric))

And if you don't need a formula, just change the data type.

-Jarmo
robot
Level VI

Re: Convert Missing Numeric to Char

Thanks.  Not as elegant as I hoped, but it works.

Recommended Articles