Is Missing( " " ) returns True?I would like to differentiate a space cell and an empty cell. The Is Missing() function interprets both as missing. Is there a better way?
I am using JMP 16.2.0.
New Table( "Example",
Add Rows( 1 ),
New Column( "Empty", Character, "Nominal", Set Values( {""} ) ),
New Column( "Empty Missing?",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Is Missing( :Empty ) )
),
New Column( "Space", Character, "Nominal", Set Values( {" "} ) ),
New Column( "Space Missing?",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Is Missing( :Space ) )
)
)OtherRe: Is Missing( " " ) returns True?Thanks @vince_faller and @txnelson . This is not the answer I was hoping for, but it does explain the behavior.
Re: Is Missing( " " ) returns True?To add to @vince_faller , JMP does convert " " to "" in inputting into a data table, however, it does not conver " a" to "a". That is, when valid characters do exist in the given cell, JMP maintains the leading spaces( "20" hex). JMP also has escape strings to input blanks( \!b )( "08" hex ), and nulls( \!0 )( "" hex ).
Re: Is Missing( " " ) returns True?A blank is just "" and it seems like JMP trims the inputs of spaces to just be blank again.
Names default to here(1);
dt = New Table( "Example",
New Column( "Fun", Character, Set Values( {" ", "", "A"} ) ),
New Column("State", character, Formula(
Match(:Fun,
"", "Blank",
" ", "Space"
, // else
"Filled"
)
))
);
dt:Fun << Get Values(); // {"", "", "A"}
At least in 16.2
I know in earlier versions you couldn't even do ismissing() on non numbers.
Re: Is Missing( " " ) returns True?Little to add to what is said. Maybe a question:
"So, there is NO space cell" - no chance to create one?
Interesting, even via a formula, the space is converted to "".
New Table( "Example",
Add Rows( 1 ),
New Column( "space and A", Character, "Nominal", Set Values( {" A"} ) ),
New Column( "Space", Character, "Nominal", Formula( Substr(:space and A,1,1) ) ),
New Column( "Space Missing?", Formula( Is Missing( :Space ) ))
);
Show("x"||Substr(:space and A[1],1,1) ||"x"); // sure, JSL doesn't lose the space
Show("x"||:space_v2 [1] ||"x") //automatically trimmed, even with a formula!
Under the line, if it's impossible to create a space cell, maybe one could reshape the riddle such that there is a solution.
e.g. don't take the space and save it in the cell - add a character - and then check if it's just a character or a character with a space in front.
Re: Is Missing( " " ) returns True?I guess there is a rule that trailing spaces are automatically removed from strings when saving them in a data table?
because they are hard to detect (much harder than for leading spaces).
An a simple space " " is treated as trailing space - extremely hard to be seen.
Is this rule mentioned in the documentation? couldn't find it ...
Interesting, this rule even applies for Column Formulas: trailing spaces are simply removed.

dt = new table("test");
New Column( "input", Character, set values({"ABC","A B"}) );
New Column( "first 2 letters", Character, Formula( Substr( :input, 1, 2 ) ));
New Column( "length first_two_letters", Formula( Length( :first 2 letters ) ))