Subscribe Bookmark RSS Feed

passing variables to variability chart

rahulsmils

Community Trekker

Joined:

Sep 23, 2016

Hi all,

I am new to jmp. So please overlook syntax.

I am trying to plot a variability chart as below:

Variability Chart(

       X( :age :height :gender ),

          ......

----------------

age, gender , height are data columns

I want to make arguments to X variable and store it separately.

Something like declaring first

Xarg_list=[:age :height :gender ]

and then using:

Variability Chart(

       X=Xargs_list;

          ......

----------------

So If I want to add new column of weight or delete any column in list of arguments I just need to change Xargs_list

Xarg_list=[:age :height :gender :weight];


Any help with forming correct syntax is welcome.


Thanks


1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Here is an example that provides the functionality you are seeking.

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

xlist = {"age", "sex"};

dt << Variability Chart(

       Y( :height, :weight ),

       X( Eval( xlist ) ),

       Max Iter( 100 ),

       Conv Limit( 0.00000001 ),

       Number Integration Abscissas( 128 ),

       Number Function Evals( 65536 ),

       Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

       Std Dev Chart( 1 )

);

It appears that you are not aware that you can get JMP to produce the scripts that you desire, by just interactively running the platform you want, and then clicking on the red triangle and go to "Script" and to request to save the script to the Script Window.  It gives you a leg up in creating your scripts.

Jim
7 REPLIES
Solution

Here is an example that provides the functionality you are seeking.

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

xlist = {"age", "sex"};

dt << Variability Chart(

       Y( :height, :weight ),

       X( Eval( xlist ) ),

       Max Iter( 100 ),

       Conv Limit( 0.00000001 ),

       Number Integration Abscissas( 128 ),

       Number Function Evals( 65536 ),

       Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

       Std Dev Chart( 1 )

);

It appears that you are not aware that you can get JMP to produce the scripts that you desire, by just interactively running the platform you want, and then clicking on the red triangle and go to "Script" and to request to save the script to the Script Window.  It gives you a leg up in creating your scripts.

Jim
rahulsmils

Community Trekker

Joined:

Sep 23, 2016

Thanks, actually i figured out a way to do this by grouping columns into a column group first and then using get column group command to get the items.

However there when doing get column groups the order of columns changed from my original assignment.

I will try this one to see if it retains order.

Thanks !

Trung

Occasional Contributor

Joined:

Oct 21, 2017

hi Jim,

can you help me to figure out the concern below?

I have 2 data table: table 1 and table 2

i want to run script variability chart for table 2, but need to have variable to get value from table 1, 

below is the example script detail, but it doest not work, please help to review and correct it

A={};

Open(table1);
A[i]=column name(i); // want to use A[i] as variable to get value from table 1 ( for for loop to get)

Open(table2);
Variability Chart(
Y(show(A)),    // this one does NOT work, please help
X( :Product, :Mequip, :Source_Lot, :lot_id ))

));

 

thanks,

regards,

Trung

txnelson

Super User

Joined:

Jun 22, 2012

Trung,

The Show() function displays values to the log window.  It does not place the values into the JSL code.  I believe what you want is to use the Eval() function to evaluate the elements in the list "A".

     Eval( A )

 

Jim
Trung

Occasional Contributor

Joined:

Oct 21, 2017

hi Jim,

 

thanks for your prompt feedback,

 

i try to take simple script as below but it still doest not work, please advise more

A=column name(13);
New window("my report", obj = context box(
Variability Chart(
Y(eval(A)),   // not come out with exact text "
X( :Product, :Mequip, :Source_Lot, :lot_id ))

));

 

 

//it is okay if i change as below

New window("my report", obj = context box(
Variability Chart(
Y(:column name(13)),   //  it is working
X( :Product, :Mequip, :Source_Lot, :lot_id ))

));

txnelson

Super User

Joined:

Jun 22, 2012

Trung,

The reason the Eval() did not work, is that you changed the structure of your code.  In your first example, you placed the column name into a list:

A = {};
A[i] = Column Name(i);

In your second version of the code, you changed the variable "A" to a scaler variable

A=column name(13);

Please take the time to read the Scripting Guide, so you can discover the different code structures within JSL, and how to implement them.  It will make your path into JSL much easier and faster.

     Help==>Books==>Scripting Guide

Jim
Trung

Occasional Contributor

Joined:

Oct 21, 2017

thanks Jim, i just figured out why it did work,

below is the mistake

Variability Chart(

Y(eval(A[i])),  // A[i] is not work

X( :Product, :Mequip, :Source_Lot, :lot_id ))

 

thank you for your advice, i am just new to JMP too, i will learn more on  Scripting Guide.

thank you very much.

Best regards,

Trung