Subscribe Bookmark RSS Feed

JMP Scripting

baba

Community Member

Joined:

May 30, 2013

Hello I am new to JMP Scripting and wandering if there is way to use regular expressions ?

I have huge tables and trying to stack them with JMP.

So any help on how would i ...

Data Table( "temp" ) << Stack(

columns(

  :Name( "ABC0(1)" ),

  :Name( "ABC0(2)" ),

  :Name( "ABC0(128)" )

),

Source Label Column( "Label" ),

Stacked Data Column( "Data" ),

output table("npt")

);

I have DATA = ABC0 to 127 and (1 to 128)... writing :Name takes too many lines...

Thanks,

Nevil

1 REPLY
pmroz

Super User

Joined:

Jun 23, 2011

Here's one way to do it.  Basically you build a string and then execute it.

stack_expr = "\[Data Table( "temp" ) << Stack( columns(]\";

nc = 128;    // Set for your table

for (i = 1, i <= nc, i++,

    k = char(i);

    stack_expr = stack_expr || evalinsert("\[ :Name( "ABC0(^k^)" ) ]\");

// Add the comma between columns, except for the last one

    if (i < nc,

        stack_expr = stack_expr || ", ";

    );

);

stack_expr = stack_expr ||

"\[Source Label Column( "Label" ),

   Stacked Data Column( "Data" ),

   output table("npt"))]\";

eval(parse(stack_expr));