<?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 Remove Quotes :  Script to make column Formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/487733#M73128</link>
    <description>&lt;P&gt;I am in the beginnings of making a script to find the delta between two measurements for many columns.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having difficulty making column formulas when the column name has a dash....&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The parse command to remove quotes changes the dash to a minus operand which then messes with what I am trying to accomplish.&lt;/P&gt;
&lt;P&gt;Error log:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unexpected "_92MHz_test_data". Perhaps there is a missing ";" or ",".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the script (which works if the column(s) do not have an operand in the name.&lt;/P&gt;
&lt;P&gt;E.g.,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
Col_Name = "diff";&amp;nbsp; // column(5) - Column(300)

Col_Name1_char = Char( Column Name( 5 ) ); // "bin of DWK112079-01_92MHz_test_data""&amp;nbsp;&amp;nbsp;
Col_Name2_char = Char( Column Name( 300 ) );// "bin of&amp;nbsp; DWK112079-01_90MHz_test_data""

Col1_Name = (Concat( ":", (Col_Name1_char) )); //":bin of DWK112079-01_92MHz_test_data";
Col2_Name = ((Concat( ":", Col_Name2_char ))); // ":bin of DWK112079-01_90MHz_test_data";

Formula_I = ((Concat( col1_Name, " - ", Col2_Name )));&amp;nbsp; //Make the formula expression

a = Expr(
    New Column( X, formula( Z ) )
); // New column with name Diff
b = Substitute( Name Expr( a ), Expr( X ), Col_Name, Expr( Z ), Parse( Formula_I ) );&amp;nbsp; // This has error when Colnames has "-" in the name

Eval( b );&amp;nbsp;&amp;nbsp;

//Note:

Show( Forumula_I, Parse( Formula_I ) );

//Note :&amp;nbsp;&amp;nbsp;Formula_I = ":bin of DWK112079-01_92MHz_test_data - :bin of DWK112079-01_new_updated_test_data";
//Note&amp;nbsp; &amp;nbsp; Parse(formula_I) = :bin of DWK112079 - 1;&amp;nbsp; This is not what I want
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:48:21 GMT</pubDate>
    <dc:creator>justvince</dc:creator>
    <dc:date>2023-06-10T23:48:21Z</dc:date>
    <item>
      <title>Remove Quotes :  Script to make column Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/487733#M73128</link>
      <description>&lt;P&gt;I am in the beginnings of making a script to find the delta between two measurements for many columns.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having difficulty making column formulas when the column name has a dash....&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The parse command to remove quotes changes the dash to a minus operand which then messes with what I am trying to accomplish.&lt;/P&gt;
&lt;P&gt;Error log:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unexpected "_92MHz_test_data". Perhaps there is a missing ";" or ",".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the script (which works if the column(s) do not have an operand in the name.&lt;/P&gt;
&lt;P&gt;E.g.,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
Col_Name = "diff";&amp;nbsp; // column(5) - Column(300)

Col_Name1_char = Char( Column Name( 5 ) ); // "bin of DWK112079-01_92MHz_test_data""&amp;nbsp;&amp;nbsp;
Col_Name2_char = Char( Column Name( 300 ) );// "bin of&amp;nbsp; DWK112079-01_90MHz_test_data""

Col1_Name = (Concat( ":", (Col_Name1_char) )); //":bin of DWK112079-01_92MHz_test_data";
Col2_Name = ((Concat( ":", Col_Name2_char ))); // ":bin of DWK112079-01_90MHz_test_data";

Formula_I = ((Concat( col1_Name, " - ", Col2_Name )));&amp;nbsp; //Make the formula expression

a = Expr(
    New Column( X, formula( Z ) )
); // New column with name Diff
b = Substitute( Name Expr( a ), Expr( X ), Col_Name, Expr( Z ), Parse( Formula_I ) );&amp;nbsp; // This has error when Colnames has "-" in the name

Eval( b );&amp;nbsp;&amp;nbsp;

//Note:

Show( Forumula_I, Parse( Formula_I ) );

//Note :&amp;nbsp;&amp;nbsp;Formula_I = ":bin of DWK112079-01_92MHz_test_data - :bin of DWK112079-01_new_updated_test_data";
//Note&amp;nbsp; &amp;nbsp; Parse(formula_I) = :bin of DWK112079 - 1;&amp;nbsp; This is not what I want
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:48:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/487733#M73128</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2023-06-10T23:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Quotes :  Script to make column Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/487842#M73136</link>
      <description>&lt;P&gt;The "-" in the middle of a column name is being interpreted by JMP as a subtraction.&amp;nbsp; Therefore, you need to indicate to JMP that the whole term is a column name.&amp;nbsp; The easiest way to do this is to use the naming structure of&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;":column name"n&lt;/P&gt;
&lt;P&gt;The below is a rework of your script with the changes made&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = Current Data Table();
Col_Name = "diff";  // column(5) - Column(300)

Col_Name1_char = Char( Column Name( 5 ) ); // "bin of DWK112079-01_92MHz_test_data""  
Col_Name2_char = Char( Column Name( 300 ) );// "bin of  DWK112079-01_90MHz_test_data""

Col1_Name = (Concat( ":\!"", (Col_Name1_char), "\!"n" )); //":bin of DWK112079-01_92MHz_test_data";
Col2_Name = ((Concat( ":\!"", Col_Name2_char  , "\!"n" ))); // ":bin of DWK112079-01_90MHz_test_data";

Formula_I = ((Concat( col1_Name, " - ", Col2_Name )));  //Make the formula expression

a = Expr(
    New Column( X, formula( Z ) )
); // New column with name Diff
b = Substitute( Name Expr( a ), Expr( X ), Col_Name, Expr( Z ), Parse( Formula_I ) );  // This has error when Colnames has "-" in the name

Eval( b );  

//Note:

Show( Forumula_I, Parse( Formula_I ) );

//Note :  Formula_I = ":bin of DWK112079-01_92MHz_test_data - :bin of DWK112079-01_new_updated_test_data";
//Note    Parse(formula_I) = :bin of DWK112079 - 1;  This is not what I want&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 May 2022 03:11:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/487842#M73136</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-05-18T03:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Quotes :  Script to make column Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/488224#M73163</link>
      <description>&lt;P&gt;I would have never been able to figure this out.&amp;nbsp; &amp;nbsp;Thanks so much, works perfectly!&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 19:50:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Quotes-Script-to-make-column-Formula/m-p/488224#M73163</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2022-05-18T19:50:59Z</dc:date>
    </item>
  </channel>
</rss>

