<?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 Script to subset columns and rename them in the new file in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780509#M96263</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make a script combining the 2 actions of creating a subset Table and renaming column name of the subset at the same time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a "Main" table and would like to create 2 subsets from it. One subset "Subset 1" with some of the columns, the other one "Subset 2" with some other columns.&lt;/P&gt;&lt;P&gt;This part of the script is working well but I can't get it right to rename the columns in Subset 1 and Subset 2 without having to run another script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help ? Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "MAIN" ) &amp;lt;&amp;lt;
Subset(
	Output Table( "Subset 1" ),
	Linked,
	Suppress formula evaluation( 0 ),
	All rows,
	columns(
		:"Time 1"n, :"Parameter 1"n
	)
);

Data Table( "MAIN" ) &amp;lt;&amp;lt;
Subset(
	Output Table( "Subset 2" ),
	Linked,
	Suppress formula evaluation( 0 ),
	All rows,
	columns(
		:"Time 2"n, :"Parameter 2"n
	)
);

dt1 = Open("Subset 1.jmp");
:"Time 1" &amp;lt;&amp;lt; Set Name("Time");


dt2 = Open("Subset 2.jmp");
:"Time 2" &amp;lt;&amp;lt; Set Name("Time");&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Aug 2024 11:02:37 GMT</pubDate>
    <dc:creator>Lea_JMP</dc:creator>
    <dc:date>2024-08-09T11:02:37Z</dc:date>
    <item>
      <title>Script to subset columns and rename them in the new file</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780509#M96263</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make a script combining the 2 actions of creating a subset Table and renaming column name of the subset at the same time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a "Main" table and would like to create 2 subsets from it. One subset "Subset 1" with some of the columns, the other one "Subset 2" with some other columns.&lt;/P&gt;&lt;P&gt;This part of the script is working well but I can't get it right to rename the columns in Subset 1 and Subset 2 without having to run another script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help ? Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "MAIN" ) &amp;lt;&amp;lt;
Subset(
	Output Table( "Subset 1" ),
	Linked,
	Suppress formula evaluation( 0 ),
	All rows,
	columns(
		:"Time 1"n, :"Parameter 1"n
	)
);

Data Table( "MAIN" ) &amp;lt;&amp;lt;
Subset(
	Output Table( "Subset 2" ),
	Linked,
	Suppress formula evaluation( 0 ),
	All rows,
	columns(
		:"Time 2"n, :"Parameter 2"n
	)
);

dt1 = Open("Subset 1.jmp");
:"Time 1" &amp;lt;&amp;lt; Set Name("Time");


dt2 = Open("Subset 2.jmp");
:"Time 2" &amp;lt;&amp;lt; Set Name("Time");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2024 11:02:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780509#M96263</guid>
      <dc:creator>Lea_JMP</dc:creator>
      <dc:date>2024-08-09T11:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script to subset columns and rename them in the new file</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780529#M96264</link>
      <description>&lt;P&gt;I think you might not be able to rename them as you have linked subsets&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt_main = New Table("Untitled",
	Add Rows(1),
	Compress File When Saved(1),
	New Column("Time 1", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
	New Column("Parameter 1", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
	New Column("Time 2", Numeric, "Continuous", Format("Best", 12), Set Values([2])),
	New Column("Parameter 2", Numeric, "Continuous", Format("Best", 12), Set Values([2]))
);

dt_subset1 = dt_main &amp;lt;&amp;lt; Subset(
	Output Table("Subset 1"),
	Linked,
	Suppress formula evaluation(0),
	All rows,
	columns(:"Time 1"n, :"Parameter 1"n)
);

dt_subset2 = dt_main &amp;lt;&amp;lt; Subset(
	Output Table("Subset 2"),
//	Linked,
	Suppress formula evaluation(0),
	All rows,
	columns(:"Time 2"n, :"Parameter 2"n)
);


dt_subset1:"Time 1" &amp;lt;&amp;lt; Set Name("Time");
dt_subset2:"Time 2" &amp;lt;&amp;lt; Set Name("Time");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this example you can see that Time 2 gets renamed to Time but Time 1 doesn't. Also depending on your starting data and what you wish to do in the end, some stack/split combination could be useful here.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 11:16:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780529#M96264</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-09T11:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script to subset columns and rename them in the new file</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780613#M96277</link>
      <description>&lt;P&gt;Hi !&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked well removing the linked data.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 14:46:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-subset-columns-and-rename-them-in-the-new-file/m-p/780613#M96277</guid>
      <dc:creator>Lea_JMP</dc:creator>
      <dc:date>2024-08-09T14:46:44Z</dc:date>
    </item>
  </channel>
</rss>

