<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding two columns in a table when one of columns can be blank in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70378#M35206</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have added bunch of data tables (Combined data table, attached) and found out the column Y and SPC_Y are indeed the same variable (Name change during the test). So I need to combine these columns. I wrote the following script and the added column (Y+SPC_Y) is blank.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=current data table();
 
// Two Columns Name that are the same Y and SPC_Y
 
dt&amp;lt;&amp;lt;new column("Y+SPC_Y", continious);
 
for each row(:Name("Y+SPC_Y")=:Y+:SPC_Y);
 
dt&amp;lt;&amp;lt;delete column("SPC_Y");
dt&amp;lt;&amp;lt; delete column("Y");
 
dt:Name("Y+SPC_Y")&amp;lt;&amp;lt; set name("SPC_Y");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="p6"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P class="p2"&gt;I appreciate your help. Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2018 10:05:54 GMT</pubDate>
    <dc:creator>AT</dc:creator>
    <dc:date>2018-08-30T10:05:54Z</dc:date>
    <item>
      <title>Adding two columns in a table when one of columns can be blank</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70378#M35206</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have added bunch of data tables (Combined data table, attached) and found out the column Y and SPC_Y are indeed the same variable (Name change during the test). So I need to combine these columns. I wrote the following script and the added column (Y+SPC_Y) is blank.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=current data table();
 
// Two Columns Name that are the same Y and SPC_Y
 
dt&amp;lt;&amp;lt;new column("Y+SPC_Y", continious);
 
for each row(:Name("Y+SPC_Y")=:Y+:SPC_Y);
 
dt&amp;lt;&amp;lt;delete column("SPC_Y");
dt&amp;lt;&amp;lt; delete column("Y");
 
dt:Name("Y+SPC_Y")&amp;lt;&amp;lt; set name("SPC_Y");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="p6"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P class="p2"&gt;I appreciate your help. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 10:05:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70378#M35206</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-08-30T10:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Adding two columns in a table when one of columns can be blank</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70391#M35208</link>
      <description>&lt;P&gt;I miss read the issue, please egnore the verbage below&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;If you delete a column that is being used in a formula that defines another column, the values in the column that is based upon the deleted column can not be calculated and therefore becomes a missing value.&amp;nbsp; To fix this issue, remove the formula from the column before deleting the columns.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
 
// Two Columns Name that are the same Y and SPC_Y
 
dt &amp;lt;&amp;lt; New Column( "Y+SPC_Y", continious );
 
For Each Row( :Name( "Y+SPC_Y" ) = :Y + :SPC_Y );

dt:Name( "Y+SPC_Y" ) &amp;lt;&amp;lt; delete formula;
 
dt &amp;lt;&amp;lt; delete column( "SPC_Y" );
dt &amp;lt;&amp;lt; delete column( "Y" );
 
dt:Name( "Y+SPC_Y" ) &amp;lt;&amp;lt; set name( "SPC_Y" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 01:11:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70391#M35208</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-08-29T01:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding two columns in a table when one of columns can be blank</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70396#M35212</link>
      <description>&lt;P&gt;Thanks Jim for the suggestion. However, It is still showing the output column SPC_Y all blank.&lt;/P&gt;&lt;P&gt;Should I impute missing values as zero in avoid blank output?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your continuous support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 00:55:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70396#M35212</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-08-29T00:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Adding two columns in a table when one of columns can be blank</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70397#M35213</link>
      <description>&lt;P&gt;My bad.....I missread the issue......what the real issue is, is that for each row in your calculation, one of the 2 values has a missing value.&amp;nbsp; In JMP a valid value that has a missing value mathematically applied to it results in a missing value.&amp;nbsp; A missing value is not a zero.&amp;nbsp; To get around that, the Sum() function does egnore missing values, so you can use it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
 
// Two Columns Name that are the same Y and SPC_Y
 
dt &amp;lt;&amp;lt; New Column( "Y+SPC_Y", continious );
 
For each row( :Name( "Y+SPC_Y" ) = sum(:Y , :SPC_Y ));
 
dt &amp;lt;&amp;lt; delete column( "SPC_Y" );
dt &amp;lt;&amp;lt; delete column( "Y" );
 
dt:Name( "Y+SPC_Y" ) &amp;lt;&amp;lt; set name( "SPC_Y" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 01:17:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70397#M35213</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-08-29T01:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding two columns in a table when one of columns can be blank</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70597#M35246</link>
      <description>&lt;P&gt;Thanks Jim. It works now.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 00:59:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-two-columns-in-a-table-when-one-of-columns-can-be-blank/m-p/70597#M35246</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-08-30T00:59:58Z</dc:date>
    </item>
  </channel>
</rss>

