<?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: Stacking multiple variables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822052#M100139</link>
    <description>&lt;P&gt;Have you tried multiple series stack? You can stack many columns.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-12-11 at 1.39.01 PM.jpg" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71051i5DB512C281BCE4FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-12-11 at 1.39.01 PM.jpg" alt="Screenshot 2024-12-11 at 1.39.01 PM.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/19.0/?os=mac&amp;amp;source=application#page/jmp/stack-columns-in-data-tables.shtml" target="_blank"&gt;https://www.jmp.com/support/help/en/19.0/?os=mac&amp;amp;source=application#page/jmp/stack-columns-in-data-tables.shtml&lt;/A&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2024 20:41:39 GMT</pubDate>
    <dc:creator>statman</dc:creator>
    <dc:date>2024-12-11T20:41:39Z</dc:date>
    <item>
      <title>Stacking multiple variables</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/821981#M100130</link>
      <description>&lt;P&gt;I have a large dataset from a long session in which many tasks were conducted for each subject.&amp;nbsp; Many of the tasks involved the same 4-5 types and multiple ratings and behavioral outcomes from those types.&amp;nbsp; However, each outcome variable is named a bit differently in terms of how the "type" is reflected in the name.&amp;nbsp; I am trying to stack across "types" for each outcome, and combine in a single spreadsheet.&amp;nbsp; So far I have been able to stack a single variable, and I was then able to join two sheets in which different variables had been stacked by merging and matching subject ID and a recoded "type" column.&amp;nbsp; Is this the correct sequence?&amp;nbsp; Stack variable, save resulting table, stack another from another spreadsheet, save resulting table, join/merge tables, and then stack and merge more?&amp;nbsp; Can 5 tables be merged/matched at the same time?&amp;nbsp; I tried to add a new stacked variable to the result of two merged tables and the result seemed incorrect.&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 19:41:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/821981#M100130</guid>
      <dc:creator>LauraC</dc:creator>
      <dc:date>2024-12-11T19:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking multiple variables</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822052#M100139</link>
      <description>&lt;P&gt;Have you tried multiple series stack? You can stack many columns.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-12-11 at 1.39.01 PM.jpg" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71051i5DB512C281BCE4FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-12-11 at 1.39.01 PM.jpg" alt="Screenshot 2024-12-11 at 1.39.01 PM.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/19.0/?os=mac&amp;amp;source=application#page/jmp/stack-columns-in-data-tables.shtml" target="_blank"&gt;https://www.jmp.com/support/help/en/19.0/?os=mac&amp;amp;source=application#page/jmp/stack-columns-in-data-tables.shtml&lt;/A&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 20:41:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822052#M100139</guid>
      <dc:creator>statman</dc:creator>
      <dc:date>2024-12-11T20:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking multiple variables</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822065#M100143</link>
      <description>&lt;P&gt;I'm not clear that that function will work. Right now my data are analogous to:&lt;/P&gt;&lt;P&gt;Task 1 arm; Task 1 leg; Task 2 arm; Task 2 leg; Task 3 arm; Task 3 leg; Task 3 face&lt;BR /&gt;Except that the variable names diverge from the format above and aren't all consistent. I want to stack the Task 1 values, and also separately the Task 2 values, and also separately the Task 3 values, but all joined by the Body Site variable:&lt;BR /&gt;Arm&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Task 1 value&amp;nbsp; &amp;nbsp;Task 2 value.&amp;nbsp; (no data)&lt;/P&gt;&lt;P&gt;Leg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Task 1 value&amp;nbsp; &amp;nbsp;Task 2 value.&amp;nbsp; &amp;nbsp;(no data)&lt;/P&gt;&lt;P&gt;Face&amp;nbsp; &amp;nbsp; &amp;nbsp;Task 1 value&amp;nbsp; &amp;nbsp;Task 2 value&amp;nbsp; &amp;nbsp; Task 3 value&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 22:03:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822065#M100143</guid>
      <dc:creator>LauraC</dc:creator>
      <dc:date>2024-12-11T22:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking multiple variables</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822100#M100147</link>
      <description>&lt;P&gt;A script can be written that will test for the different variations in a column name, and then change the name to the standard form.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once in the standard form, as you describe the names, the following script takes the standard form&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1733972080882.png" style="width: 606px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71052i17304D6A51D6B0CB/image-dimensions/606x468?v=v2" width="606" height="468" role="button" title="txnelson_0-1733972080882.png" alt="txnelson_0-1733972080882.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And convert it into the new form for the table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1733972149451.png" style="width: 625px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71053iE958486AC1B1496C/image-dimensions/625x696?v=v2" width="625" height="696" role="button" title="txnelson_1-1733972149451.png" alt="txnelson_1-1733972149451.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = new table("Example",
	add rows(20),
	New column("Task 1 arm", set each value(random integer(1,100))),
	New column("Task 1 leg", set each value(random integer(1,100))),
	New column("Task 2 arm", set each value(random integer(1,100))),
	New column("Task 2 leg", set each value(random integer(1,100))),
	New column("Task 3 arm", set each value(random integer(1,100))),
	New column("Task 3 leg", set each value(random integer(1,100))),
	New column("Task 3 face", set each value(random integer(1,100)))
);

dt &amp;lt;&amp;lt; new column("Row", set each value(Row()));

dtStack = dt &amp;lt;&amp;lt; Stack(
	columns(
		:Task 1 arm, :Task 1 leg, :Task 2 arm, :Task 2 leg, :Task 3 arm, :Task 3 leg,
		:Task 3 face
	),
	Output Table( "Stack" )
);

dtStack &amp;lt;&amp;lt; new column("Body Part", character, formula( word(-1, :label, " ")));
dtStack &amp;lt;&amp;lt; new column( "Task", character, formula( substr(:Label, 1 ,length(:label)-length(:body part)-1)));

dtFinal = dtStack &amp;lt;&amp;lt; Split(
	Split By( :Task ),
	Split( :Data ),
	Group( :Body Part, :row ),
	Output Table( "Final" ),
	Remaining Columns( Drop All ),
	Sort by Column Property
);

dtFinal &amp;lt;&amp;lt; Sort( By(:row, :Body Part), Replace Table(1));
dtFinal &amp;lt;&amp;lt; delete columns(:row);

dt &amp;lt;&amp;lt; delete columns(:row);

close( dtStack, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2024 02:56:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-variables/m-p/822100#M100147</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-12-12T02:56:23Z</dc:date>
    </item>
  </channel>
</rss>

