<?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: How to interchange columns using JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810272#M99251</link>
    <description>&lt;P&gt;Do you wish to reorder your columns or just move the data around inside the columns? This should help you with re-ordering of the columns BUT it won't work the same with all JMP versions due to how &amp;lt;&amp;lt;move selected columns did work in some version(s)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled 2",
	Add Rows(0),
	Compress File When Saved(1),
	New Column("1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("4", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("5", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("6", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("7", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("8", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("9", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);


wait(1); // demo purposes

collist = dt &amp;lt;&amp;lt; Get Column Names("String");
col_order = {"7", "8", "3", "4", "5", "6", "1", "2", "9"};
dt &amp;lt;&amp;lt; Move Selected Columns(col_order);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Nov 2024 08:46:56 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-11-11T08:46:56Z</dc:date>
    <item>
      <title>How to interchange columns using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810270#M99250</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a CSV file that is being used in JMP. However, I need to interchange columns 1 &amp;amp; 2 with Columns 7 &amp;amp; 8. How to do it using JSL. It looks something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original File&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interchanged columns&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 11 Nov 2024 08:26:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810270#M99250</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-11-11T08:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to interchange columns using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810272#M99251</link>
      <description>&lt;P&gt;Do you wish to reorder your columns or just move the data around inside the columns? This should help you with re-ordering of the columns BUT it won't work the same with all JMP versions due to how &amp;lt;&amp;lt;move selected columns did work in some version(s)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled 2",
	Add Rows(0),
	Compress File When Saved(1),
	New Column("1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("4", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("5", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("6", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("7", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("8", Numeric, "Continuous", Format("Best", 12), Set Values([])),
	New Column("9", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);


wait(1); // demo purposes

collist = dt &amp;lt;&amp;lt; Get Column Names("String");
col_order = {"7", "8", "3", "4", "5", "6", "1", "2", "9"};
dt &amp;lt;&amp;lt; Move Selected Columns(col_order);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Nov 2024 08:46:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810272#M99251</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-11T08:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to interchange columns using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810369#M99291</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;This works well. But just one question, is it also possible to move only the data inside the columns and not its headers? How is it done using JSL?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 23:31:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810369#M99291</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-11-11T23:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to interchange columns using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810370#M99292</link>
      <description>&lt;P&gt;You can either just change the Header names rather than moving the data, or you can actually move the data.&amp;nbsp; See example below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

// Move header is easier than moving all of the data
:weight &amp;lt;&amp;lt; set name("new name");
:height &amp;lt;&amp;lt; set name("weight");

// One way to move data
theHeights = :weight &amp;lt;&amp;lt; get values;
theWeights = :new name &amp;lt;&amp;lt; get values;
:new name &amp;lt;&amp;lt; set name("height");

:weight &amp;lt;&amp;lt; set values(theWeights);
:height &amp;lt;&amp;lt; set values(theHeights);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Nov 2024 02:27:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-interchange-columns-using-JSL/m-p/810370#M99292</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-11-12T02:27:00Z</dc:date>
    </item>
  </channel>
</rss>

