<?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 stack a variable number of series? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-stack-a-variable-number-of-series/m-p/889366#M105148</link>
    <description>&lt;P&gt;In this case you can try using Eval()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

n_series = 3;

dt = Open("$SAMPLE_DATA/Blood Pressure.jmp");

dt_stacked = dt &amp;lt;&amp;lt; Stack(
	columns(:BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F),
	Number of Series(Eval(n_series)),
	Contiguous,
	Source Label Column("Day"),
	Stacked Data Column("BP")
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;More general solution is to evaluate the value inside the expression&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

n_series = 3;

dt = Open("$SAMPLE_DATA/Blood Pressure.jmp");

dt_stacked = Eval(EvalExpr(dt &amp;lt;&amp;lt; Stack(
	columns(:BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F),
	Number of Series(Expr(n_series)),
	Contiguous,
	Source Label Column("Day"),
	Stacked Data Column("BP")
)));

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jul 2025 10:56:43 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-07-25T10:56:43Z</dc:date>
    <item>
      <title>How to stack a variable number of series?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-stack-a-variable-number-of-series/m-p/889355#M105147</link>
      <description>&lt;P&gt;The following code does not work, but it does when replacing "n_series" with 3 in the Stack command.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Blood Pressure.jmp" );
n_series = 3;
dt &amp;lt;&amp;lt; Stack(
	columns(:BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F),
	Number of Series( n_series ),
	Contiguous,
	Source Label Column( "Day" ),
	Stacked Data Column( "BP" )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I need to have this value variable. How to get Stack() running with a variable number of series?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2025 10:03:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-stack-a-variable-number-of-series/m-p/889355#M105147</guid>
      <dc:creator>Robbb</dc:creator>
      <dc:date>2025-07-25T10:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to stack a variable number of series?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-stack-a-variable-number-of-series/m-p/889366#M105148</link>
      <description>&lt;P&gt;In this case you can try using Eval()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

n_series = 3;

dt = Open("$SAMPLE_DATA/Blood Pressure.jmp");

dt_stacked = dt &amp;lt;&amp;lt; Stack(
	columns(:BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F),
	Number of Series(Eval(n_series)),
	Contiguous,
	Source Label Column("Day"),
	Stacked Data Column("BP")
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;More general solution is to evaluate the value inside the expression&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

n_series = 3;

dt = Open("$SAMPLE_DATA/Blood Pressure.jmp");

dt_stacked = Eval(EvalExpr(dt &amp;lt;&amp;lt; Stack(
	columns(:BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F),
	Number of Series(Expr(n_series)),
	Contiguous,
	Source Label Column("Day"),
	Stacked Data Column("BP")
)));

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2025 10:56:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-stack-a-variable-number-of-series/m-p/889366#M105148</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-25T10:56:43Z</dc:date>
    </item>
  </channel>
</rss>

