How to determine if column is non-zero and all-zeroHi all,
I have a data set that has an all-zero column. However, its column value is not consistent in having an all-zero value. How can I determine if it has an all-zero and when it has normal values? I just need it to create an if condition.
Expected output:
if Col1 is all-zero => print ("Col1 is all zero"), print ("Col1 is non-zero);
Automation and ScriptingRe: How to determine if column is non-zero and all-zeroHere are a few different ways to look code he solution
Names Default To Here( 1 );
If( Col Std Dev( :col1 ) == 0 & Col Sum( :col1 ) == 0,
Print( "Col1 is all zero" ),
Print( "Col1 is non-zero" )
);
dt = Current Data Table();
y = If( Length( Loc( dt[0, 6], 0 ) ) == N Rows( dt ),
Print( "Col1 is all zero" ),
Print( "Col1 is non-zero" )
);
y = If( Length( Loc( dt:col1 << get as matrix, 0 ) ) == N Rows( dt ),
Print( "Col1 is all zero" ),
Print( "Col1 is non-zero" )
);