<?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 Re: Using Word() or Words() function to parse string in a column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624483#M82321</link>
    <description>&lt;P&gt;JMP has a builtin text to columns() function.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = New Table("split", 
	&amp;lt;&amp;lt; New Column("new_batch", character, &amp;lt;&amp;lt;Set Values({"1bc5ef-gh7"}))
);

dt &amp;lt;&amp;lt; Text To Columns(
	delimiter( "-" ),
	columns( :new_batch )
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Apr 2023 19:53:31 GMT</pubDate>
    <dc:creator>vince_faller</dc:creator>
    <dc:date>2023-04-20T19:53:31Z</dc:date>
    <item>
      <title>Using Word() or Words() function to parse string in a column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624393#M82317</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table where one of the columns had data that is in the form of an alphanumeric string (e.g. 1bc5ef-gh7) and I would like to parse the string using the hyphen as the delimiter and they return the first part of the string (1bc5ef) as data in a new column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, I have the code below. If I use the &lt;STRONG&gt;Word&lt;U&gt;s&lt;/U&gt;&lt;/STRONG&gt;() function, it only returns the second part of the of the string (e.g. gh7). However, if I use the &lt;STRONG&gt;Word&lt;/STRONG&gt;() function, the RES list comes up empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to get the first part of the string and put it into a new column in the same table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// there is a data table that already has a column called new_batch&lt;BR /&gt;&lt;BR /&gt;	Vals = :new_batch &amp;lt;&amp;lt; Get Values;  // Get Values out 
	Res = List(); // Define empty list 

For(i = 1 , i &amp;lt;= N Items(Vals), i++,
	 Test = Words(Vals[i],"-"); // Words is the function that will split your string by delimiter 
	  Insert Into(Res,Test[N Items(Test)]);
   );
   dt &amp;lt;&amp;lt; New Column("new_batch_2", RES);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated. Thanks,&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 00:00:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624393#M82317</guid>
      <dc:creator>JMPnoob</dc:creator>
      <dc:date>2023-06-11T00:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Word() or Words() function to parse string in a column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624430#M82318</link>
      <description>&lt;P&gt;Try using 1 for the index instead of N Items() if you want the first index (with &lt;A href="https://www.jmp.com/support/help/en/17.0/#page/jmp/list-functions.shtml#ww2491421" target="_blank" rel="noopener"&gt;Words()&lt;/A&gt;) and with &lt;A href="https://www.jmp.com/support/help/en/17.0/#page/jmp/character-functions-2.shtml?os=win&amp;amp;source=application#ww8107571" target="_blank" rel="noopener"&gt;Word()&lt;/A&gt; the syntax should be something like Word(1, Vals[i], "-")&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

str = "1bc5ef-gh7";

w1 = Words(str, "-");
show(w1);
show(w1[1]);

w2 = Word(1, str, "-");
show(w2);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2023 17:37:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624430#M82318</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-04-20T17:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Word() or Words() function to parse string in a column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624483#M82321</link>
      <description>&lt;P&gt;JMP has a builtin text to columns() function.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = New Table("split", 
	&amp;lt;&amp;lt; New Column("new_batch", character, &amp;lt;&amp;lt;Set Values({"1bc5ef-gh7"}))
);

dt &amp;lt;&amp;lt; Text To Columns(
	delimiter( "-" ),
	columns( :new_batch )
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2023 19:53:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624483#M82321</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2023-04-20T19:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using Word() or Words() function to parse string in a column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624569#M82326</link>
      <description>&lt;P&gt;Thanks for the help. I ended up using the code below to split the data into a new column separated by the delimiter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt; dt3 &amp;lt;&amp;lt; Text To Columns( delimiter( "-" ), columns( :new_batch )); // strips out the bottle number from BCB batch numbers. Other chemicals not affected&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It gives the following output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMPnoob_0-1682025571000.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/52180i1CFEAB612C2EE946/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMPnoob_0-1682025571000.png" alt="JMPnoob_0-1682025571000.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 21:19:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624569#M82326</guid>
      <dc:creator>JMPnoob</dc:creator>
      <dc:date>2023-04-20T21:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using Word() or Words() function to parse string in a column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624570#M82327</link>
      <description>&lt;P&gt;Thanks for the help. The example with word() and words() worked. However, I ended up using the code below because it required only 1 line and was simpler.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt; dt3 &amp;lt;&amp;lt; Text To Columns( delimiter( "-" ), columns( :new_batch )); // strips out the bottle number from BCB batch numbers. Other chemicals not affected&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 21:21:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-Word-or-Words-function-to-parse-string-in-a-column/m-p/624570#M82327</guid>
      <dc:creator>JMPnoob</dc:creator>
      <dc:date>2023-04-20T21:21:29Z</dc:date>
    </item>
  </channel>
</rss>

