Choose Language Hide Translation Bar
Highlighted
wencun6
Level II

JMP JSL Stack operation does not allow citing predefined variable?

I was writing a script to stack bunch of columns togthers using JSL script like below. However, I am keeps getting error message that "Number of series should be a positive integer". I need the N to be variable depending on how many columns need to be stacked for different tables. I have other script to identify the number of column which works perfectly fine. Just the stack function somehow does not work.

 

 

dt_join2=current data table();
N=49
Data Table( dt_join2 ) << Stack(
columns(Lstcols ),
Source Label Column( lstCols3 ),
Stacked Data Column( lstCols2 ),
Number of Series(N)
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: JMP JSL Stack operation does not allow citing predefined variable?

You can dynamically code the Stack Platform.  Below is a simple example:

Names Default to Here(1);
dt=open("$SAMPLE_DATA/Semiconductor Capability.jmp");

Listcols={:NPN1, :PNP1, :PNP2, :NPN2};
lstCos3="Discriptors";
lstCos2="Values";
n=2;

Data Table( "semiconductor capability" ) << Stack(
	columns( Listcols ),
	Source Label Column( lstCos3 ),
	Stacked Data Column( lstCos2 ),
	Drop All Other Columns( 1 ),
	Number of Series( eval(N) )
);

However, what I am picking up from your discussion is that you are thinking that Source Label Column, and Stacked Data Column, can be a list of names.  The documentation below shows, that only a single name can be provided

Stacked Data Column

Assigns a name to the column that will contain the data for the stacked columns. The default name is Data. Leave the box empty if you do not want this column to appear in the new table.

Source Label Column

Assigns a name to the column that will contain the original table’s column names. The default name is Label. Leave the box empty if you do not want this column to appear in the new table.

 

If you need to have specific names for the Data and Label columns produced in the Stack Platform, you can simply change the names in the new table that is produced.

Jim

View solution in original post

3 REPLIES 3
Highlighted
wencun6
Level II

Re: JMP JSL Stack operation does not allow citing predefined variable?

Just found out that the citing of  lstCols3 or  lstCols2 as list of column names does not work either.

Highlighted
txnelson
Super User

Re: JMP JSL Stack operation does not allow citing predefined variable?

You can dynamically code the Stack Platform.  Below is a simple example:

Names Default to Here(1);
dt=open("$SAMPLE_DATA/Semiconductor Capability.jmp");

Listcols={:NPN1, :PNP1, :PNP2, :NPN2};
lstCos3="Discriptors";
lstCos2="Values";
n=2;

Data Table( "semiconductor capability" ) << Stack(
	columns( Listcols ),
	Source Label Column( lstCos3 ),
	Stacked Data Column( lstCos2 ),
	Drop All Other Columns( 1 ),
	Number of Series( eval(N) )
);

However, what I am picking up from your discussion is that you are thinking that Source Label Column, and Stacked Data Column, can be a list of names.  The documentation below shows, that only a single name can be provided

Stacked Data Column

Assigns a name to the column that will contain the data for the stacked columns. The default name is Data. Leave the box empty if you do not want this column to appear in the new table.

Source Label Column

Assigns a name to the column that will contain the original table’s column names. The default name is Label. Leave the box empty if you do not want this column to appear in the new table.

 

If you need to have specific names for the Data and Label columns produced in the Stack Platform, you can simply change the names in the new table that is produced.

Jim

View solution in original post

Highlighted
wencun6
Level II

Re: JMP JSL Stack operation does not allow citing predefined variable?

@txnelson Many thanks the Eval() function make it work.

Article Labels

    There are no labels assigned to this post.