Subscribe Bookmark RSS Feed

How to add columns with empty data

sirihofstadtrap

Community Trekker

Joined:

Feb 17, 2016

I have a table similar to this:

 xyz xyzxyz
aa12  .3
bb    ..
cc2 3 .5

The columns have rows containing both numeric and empty data.

I want to create a new column (xyz) where I add the data in column x, y and z.

In other words, I want the result to look like the green xyz-column.

 

The problem is, when I run my script, I get the result in the red xyz-column..

How do I add columns with empty data?

 

I use the following script to create the xyz-column:

dt << New Column("xyz",

         Numeric,

         Formula(:Name("x")+:Name("y")+:Name("z")

         )

         );

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Use:

dt << New Column( "xyz", Numeric, Formula( Sum( :x, :y,:z ) ) );

 The Sum() function ignores missing values.

Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Use:

dt << New Column( "xyz", Numeric, Formula( Sum( :x, :y,:z ) ) );

 The Sum() function ignores missing values.

Jim
sirihofstadtrap

Community Trekker

Joined:

Feb 17, 2016

Thank you, it works :)