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 ) )
)
);
我认为最简单的方法是直接使用“If + Is Missing”。像你这样使用“that”更好(更容易理解),但你也可以省略“”。
If(!IsMissing(:numeric), Char(:numeric))
如果不需要公式,只需更改数据类型即可。