<?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 columns, and adding repeating values to new columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869043#M103191</link>
    <description>&lt;P&gt;Stack your data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1744916490397.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74979iAF690763977D543B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1744916490397.png" alt="jthi_0-1744916490397.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Use First Word (and Last Word) quick formulas with slight modifications to create new columns&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1744916531687.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74980i414D7A81CEA3EEAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1744916531687.png" alt="jthi_1-1744916531687.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Modify Last Word to use "-" instead of default value which is " "&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1744916578594.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74981i3CD7288832939E5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1744916578594.png" alt="jthi_2-1744916578594.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can also add trim whitespace to clean the last word a bit&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Trim Whitespace(Word(-1, :Label, "-"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1744916615006.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74982iBCB26F049D9EAE65/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1744916615006.png" alt="jthi_3-1744916615006.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this what you are looking for? (also for the future, I would suggest sharing your data as JMP tables to avoid all sorts of issues excel files can potentially create)&lt;/P&gt;</description>
    <pubDate>Thu, 17 Apr 2025 19:05:25 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-04-17T19:05:25Z</dc:date>
    <item>
      <title>Stacking multiple columns, and adding repeating values to new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869029#M103190</link>
      <description>&lt;P&gt;Hello folks&lt;/P&gt;
&lt;P&gt;I have a original set of data with first row as sample/location, and next rows shows values corresponding to specific iterations.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdgeMarmoset719_1-1744915552905.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74976i93D730C267FABCD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdgeMarmoset719_1-1744915552905.png" alt="EdgeMarmoset719_1-1744915552905.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to change this data, stacking the values and creating the new column showing Sample/Location separately.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I'd like to have: repeating iteration/sample/location for each values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdgeMarmoset719_2-1744915743465.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74977i803B04C7177F8486/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdgeMarmoset719_2-1744915743465.png" alt="EdgeMarmoset719_2-1744915743465.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, I'd like to have this; if separating the Sample/Location is difficult:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdgeMarmoset719_3-1744915817399.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74978i4E3511C57CA487F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdgeMarmoset719_3-1744915817399.png" alt="EdgeMarmoset719_3-1744915817399.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I' tried to find a way with summary table from UI, but nothing seems to be working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attaching the excel data file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 18:55:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869029#M103190</guid>
      <dc:creator>EdgeMarmoset719</dc:creator>
      <dc:date>2025-04-17T18:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking multiple columns, and adding repeating values to new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869043#M103191</link>
      <description>&lt;P&gt;Stack your data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1744916490397.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74979iAF690763977D543B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1744916490397.png" alt="jthi_0-1744916490397.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Use First Word (and Last Word) quick formulas with slight modifications to create new columns&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1744916531687.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74980i414D7A81CEA3EEAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1744916531687.png" alt="jthi_1-1744916531687.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Modify Last Word to use "-" instead of default value which is " "&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1744916578594.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74981i3CD7288832939E5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1744916578594.png" alt="jthi_2-1744916578594.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can also add trim whitespace to clean the last word a bit&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Trim Whitespace(Word(-1, :Label, "-"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1744916615006.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74982iBCB26F049D9EAE65/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1744916615006.png" alt="jthi_3-1744916615006.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this what you are looking for? (also for the future, I would suggest sharing your data as JMP tables to avoid all sorts of issues excel files can potentially create)&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 19:05:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869043#M103191</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-17T19:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking multiple columns, and adding repeating values to new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869049#M103192</link>
      <description>&lt;P&gt;And for modifying the data, you can also take a look at Recode platform (&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/18.1/#page/jmp/recode-data-in-a-column.shtml" target="_self"&gt; Using JMP &amp;gt; Enter and Edit Your Data &amp;gt; Restructure Data &amp;gt; Recode Data in a Column&lt;/A&gt; ). And in some cases you can also just use Text to Columns&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1744918086975.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74986iDCE37D2648E10329/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1744918086975.png" alt="jthi_0-1744918086975.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and of course you can combine it with Recode if necessary. JMP is also able to write script for you for this whole process either as a workflow or as a script in enhanced log&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 19:29:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869049#M103192</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-17T19:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking multiple columns, and adding repeating values to new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869051#M103193</link>
      <description>&lt;P&gt;prepare some data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//prepare: 
Names Default to Here(1);
dt0 = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt = dt0 &amp;lt;&amp;lt; Split(
	Split By( :age, :sex ),
	Split( :height ),
	Remaining Columns( Drop All )
);
dt &amp;lt;&amp;lt; new column ("sample", set each value(row()));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, let's stack it:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1744918073692.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74985i9AB6A7D500EA6C0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1744918073692.png" alt="hogi_0-1744918073692.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- use&amp;nbsp;&lt;CODE class=" language-jsl"&gt;Eliminate missing rows( 1 )&lt;/CODE&gt;&amp;nbsp;to get rid of empty entries&lt;/P&gt;
&lt;P&gt;- use text to column to split the 2 grouping variables:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1744918215977.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74987iBA11A78139ECC26B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1744918215977.png" alt="hogi_1-1744918215977.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you prefer JSL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// create stacked table
stacked = dt  &amp;lt;&amp;lt;
Stack(
	columns(
		:"12 F"n, :"12 M"n, :"13 F"n, :"13 M"n, :"14 F"n, :"14 M"n, :"15 F"n,
		:"15 M"n, :"16 F"n, :"16 M"n, :"17 F"n, :"17 M"n
	),
	Stack By Row( 0 ),
	Eliminate missing rows( 1 )
);
stacked &amp;lt;&amp;lt; Text to Columns( columns( :Label ), Delimiters( " " ) );

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Apr 2025 19:31:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-multiple-columns-and-adding-repeating-values-to-new/m-p/869051#M103193</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-04-17T19:31:06Z</dc:date>
    </item>
  </channel>
</rss>

