<?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 Removing a part of the same string name for each row in different data tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Removing-a-part-of-the-same-string-name-for-each-row-in/m-p/448367#M69525</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have different data tables that i created from another tables, In each Data Tables, it contains strings of variable length in the format Character in the same column name. I've added some examples below. I am trying to remove the last 4 characters of the string from the column, and keep everything else. The last 4 characters are always "DATA", . I have tried to accomplish if statement to link different Data tables and using Left(), and Contains() but I think the way i wrote it is wrong. I hope I could get anyone help in this community since I just started to learn jmp jsl.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;Data Table 1&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Table 2&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I want the each Data Table looks like;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Table 1&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Table 2&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached my jsl as below&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtList = {};

For( i = 1, i &amp;lt;= N Table(), i++,
	tempdt = data table(i)&amp;lt;&amp;lt;get name;
	if(contains(eval(tempdt),"Subset"),
	insert into(dtList, tempdt ), // to define how many Data table created
	);
);

Current Data Table( dtList );

For( i = 1, i &amp;lt;= N Items( dtList ), i++, 
      dtList: Source [i] = Left( Source, Contains( Source, "DATA") - 2 );

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Jun 2023 18:08:00 GMT</pubDate>
    <dc:creator>PieAardvark840</dc:creator>
    <dc:date>2023-06-09T18:08:00Z</dc:date>
    <item>
      <title>Removing a part of the same string name for each row in different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-a-part-of-the-same-string-name-for-each-row-in/m-p/448367#M69525</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have different data tables that i created from another tables, In each Data Tables, it contains strings of variable length in the format Character in the same column name. I've added some examples below. I am trying to remove the last 4 characters of the string from the column, and keep everything else. The last 4 characters are always "DATA", . I have tried to accomplish if statement to link different Data tables and using Left(), and Contains() but I think the way i wrote it is wrong. I hope I could get anyone help in this community since I just started to learn jmp jsl.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;Data Table 1&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH_DATA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Table 2&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE_DATA&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I want the each Data Table looks like;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Table 1&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;FARAH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Table 2&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Source&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;MIKE&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached my jsl as below&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtList = {};

For( i = 1, i &amp;lt;= N Table(), i++,
	tempdt = data table(i)&amp;lt;&amp;lt;get name;
	if(contains(eval(tempdt),"Subset"),
	insert into(dtList, tempdt ), // to define how many Data table created
	);
);

Current Data Table( dtList );

For( i = 1, i &amp;lt;= N Items( dtList ), i++, 
      dtList: Source [i] = Left( Source, Contains( Source, "DATA") - 2 );

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:08:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-a-part-of-the-same-string-name-for-each-row-in/m-p/448367#M69525</guid>
      <dc:creator>PieAardvark840</dc:creator>
      <dc:date>2023-06-09T18:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of the same string name for each row in different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-a-part-of-the-same-string-name-for-each-row-in/m-p/448386#M69526</link>
      <description>&lt;P&gt;Many ways to handle this. Some examples how to delete _DATA from string&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);&lt;BR /&gt;&lt;BR /&gt;str = "FARAH_DATA";

//Word
Show(Word(1, str, "_"));

//Contains and left/substr
Show(Substr(str, 1, Contains(str, "_", -1) - 1));
Show(Left(str, Contains(str, "_", -1) - 1));

//Substitute
Show(Substitute(str, "_DATA", ""));

//Regex
Show(Regex(str, "_DATA", "", GLOBALREPLACE));
Show(Regex(str, "^(.*?)(_DATA)", "\1"));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Using with datatables:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1)
dt1 = New Table("Untitled",
	Add Rows(4),
	New Column("Source",
		Character,
		"Nominal",
		Set Values({"FARAH_DATA", "FARAH_DATA", "FARAH_DATA", "FARAH_DATA"})
	)
);
dt2 = New Table("Untitled 2",
	Add Rows(3),
	New Column("Source",
		Character,
		"Nominal",
		Set Values({"MIKE_DATA", "MIKE_DATA", "MIKE_DATA"})
	)
);
dt_list = {dt1, dt2};
//using contains with left
//JMP16, if previous use For-loop
For Each({cur_dt}, dt_list,
	Column(cur_dt, "Source") &amp;lt;&amp;lt; Set Each Value(Left(:Source, Contains(:Source, "_", -1) - 1));	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 08:30:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-a-part-of-the-same-string-name-for-each-row-in/m-p/448386#M69526</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-12-30T08:30:39Z</dc:date>
    </item>
  </channel>
</rss>

