<?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 &amp;quot;Left&amp;quot; on a string in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567744#M77859</link>
    <description>&lt;P&gt;Hi John, Thanks for your reply. I had tried that but still get X = excurl.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2022 13:35:08 GMT</pubDate>
    <dc:creator>Shadow</dc:creator>
    <dc:date>2022-11-10T13:35:08Z</dc:date>
    <item>
      <title>Using "Left" on a string</title>
      <link>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567720#M77855</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think this should be easy but have spent too much time trying to figure it out. I have a more complex worksheet with a longer list (that refers to column names that may change) but what I am trying to do is create a new list to be used else where by removing the word "_Yield" from my original list. Simple example below;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;JSL&amp;gt;&lt;/P&gt;&lt;P&gt;Names Default To Here( 1 );&lt;BR /&gt;exurl = {"Test_Yield, Help_Yield"};&lt;BR /&gt;X = Left(exurl, Contains( exurl, "_Yield" ) - 1 );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I want to get X = {"Test", "Help"} but I just get X = exurl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:02:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567720#M77855</guid>
      <dc:creator>Shadow</dc:creator>
      <dc:date>2023-06-09T16:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using "Left" on a string</title>
      <link>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567740#M77858</link>
      <description>&lt;P&gt;I tend to use substitute in these situations&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;X = substitute(exurl,"_Yield","");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Nov 2022 13:29:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567740#M77858</guid>
      <dc:creator>JohnDMoore1</dc:creator>
      <dc:date>2022-11-10T13:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using "Left" on a string</title>
      <link>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567744#M77859</link>
      <description>&lt;P&gt;Hi John, Thanks for your reply. I had tried that but still get X = excurl.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 13:35:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567744#M77859</guid>
      <dc:creator>Shadow</dc:creator>
      <dc:date>2022-11-10T13:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using "Left" on a string</title>
      <link>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567747#M77860</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/45115"&gt;@Shadow&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Along with what&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/32970"&gt;@JohnDMoore1&lt;/a&gt;&amp;nbsp;suggested for the substitute, which is a great way to do it, another option can be the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

exurl = {"Test_Yield", "Help_Yield"};

x={};
For(i=1, i&amp;lt;=NItems(exurl), i++,
	x[i]=left(exurl[i], Contains(exurl[i], "_Yield")-1);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; I think one of the things that's throwing the Left command off is that it is a multi-element list -- even though the scripting index says it can deal with lists, it doesn't appear to actually have that ability. The For loop helps to build your output variable as a list. Sometimes this kind of approach is more flexible, especially when you have large data tables and need to rename many columns, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Also, I think there is a mistake in your example url that you gave. You wrote: exurl={"Test_Yield, Help_Yield"}, which is only a single string, not a list. I think what you meant to write is&amp;nbsp;exurl={"Test_Yield", "Help_Yield"} which has the extra quotes and comma separating the elements in the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 13:38:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567747#M77860</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2022-11-10T13:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using "Left" on a string</title>
      <link>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567799#M77863</link>
      <description>&lt;P&gt;If you have access to JMP16+, this is a good place to use Transform Each&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
exurl = {"Test_Yield", "Help_Yield"};
X = Transform Each({url}, exurl, Substitute(url, "_Yield", ""));
show(X); // X = {"Test", "Help"};&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 14:25:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-quot-Left-quot-on-a-string/m-p/567799#M77863</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-10T14:25:33Z</dc:date>
    </item>
  </channel>
</rss>

