<?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: Sort a column by variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/40286#M23588</link>
    <description>&lt;P&gt;What you've asked for is not easily done in a formula (that I can come up with anyway). It's relatively easy to do this interactively by using &lt;STRONG&gt;Tables-&amp;gt;Sort&lt;/STRONG&gt; to sort the table into a new table and then copy and paste the column of interest back into the original table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However the question&amp;nbsp;raises some interest&amp;nbsp;about what you're really trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally speaking, a row of a data table represents a collection of values for a single entity – an individual&amp;nbsp;student in your simple example – and each row is unrelated to other rows. I'm not sure how this new column – of Names in your example – would be useful in an analysis since the new column is only meaningful&amp;nbsp;in the context of it's order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you explain a little bit more of how you'd use this new column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;An example to hopefully clarify:&amp;nbsp;if I had a table with two rows: Name and age, how would I create a third row that displays the names sorted from oldest to youngest?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PS: you seem to have confused rows and columns in your example. I'm assuming that you really meant &lt;EM&gt;a table with two columns&lt;/EM&gt;&amp;nbsp;and that you wanted to create a third column as your original question states. If I'm mistaken and you really meant rows, please let us know.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2017 17:12:22 GMT</pubDate>
    <dc:creator>Jeff_Perkinson</dc:creator>
    <dc:date>2017-06-12T17:12:22Z</dc:date>
    <item>
      <title>Sort a column by variable</title>
      <link>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/40276#M23582</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How would I go about creating a new column that contains the sorted values of one column by another variabe?&lt;/P&gt;&lt;P&gt;An example to hopefully clarify:&amp;nbsp;if I had a table with two rows: Name and age, how would I create a third row that displays the names sorted from oldest to youngest?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 13:36:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/40276#M23582</guid>
      <dc:creator>matt7109</dc:creator>
      <dc:date>2017-06-12T13:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column by variable</title>
      <link>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/40286#M23588</link>
      <description>&lt;P&gt;What you've asked for is not easily done in a formula (that I can come up with anyway). It's relatively easy to do this interactively by using &lt;STRONG&gt;Tables-&amp;gt;Sort&lt;/STRONG&gt; to sort the table into a new table and then copy and paste the column of interest back into the original table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However the question&amp;nbsp;raises some interest&amp;nbsp;about what you're really trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally speaking, a row of a data table represents a collection of values for a single entity – an individual&amp;nbsp;student in your simple example – and each row is unrelated to other rows. I'm not sure how this new column – of Names in your example – would be useful in an analysis since the new column is only meaningful&amp;nbsp;in the context of it's order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you explain a little bit more of how you'd use this new column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;An example to hopefully clarify:&amp;nbsp;if I had a table with two rows: Name and age, how would I create a third row that displays the names sorted from oldest to youngest?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PS: you seem to have confused rows and columns in your example. I'm assuming that you really meant &lt;EM&gt;a table with two columns&lt;/EM&gt;&amp;nbsp;and that you wanted to create a third column as your original question states. If I'm mistaken and you really meant rows, please let us know.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 17:12:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/40286#M23588</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2017-06-12T17:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column by variable</title>
      <link>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/46585#M26550</link>
      <description>&lt;P&gt;If you have your data in rows instead of columns, like in Excel, you'd need to transpose the table before analyzing it. In your example, after transpose, you will have two columns: Name and age. At this point, it simply becomes a matter of sorting the table by the age column, as suggested by other users.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 14:35:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/46585#M26550</guid>
      <dc:creator>IcarusAgenda</dc:creator>
      <dc:date>2017-10-31T14:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a column by variable</title>
      <link>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/46606#M26560</link>
      <description>&lt;P&gt;Give this a try:&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 = Open("$SAMPLE_DATA/Big Class.jmp");

dt &amp;lt;&amp;lt; New Column(
	"Sorted names by age",
	Expression,
	"None",
	Formula( :Name[ Rank( :age &amp;lt;&amp;lt; Get Values )][ Row() ] )
);

dt &amp;lt;&amp;lt; New Column(
	"Sorted names by height",
	Expression,
	"None",
	Formula( :Name[ Rank( :height &amp;lt;&amp;lt; Get Values )][ Row() ] )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that it might be slow for large tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edited to show a more relevent example.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 19:51:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sort-a-column-by-variable/m-p/46606#M26560</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2017-10-31T19:51:11Z</dc:date>
    </item>
  </channel>
</rss>

