cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
uday_guntupalli
Level VIII

Save Analysis to Table Using Variable (in JSL)

All, 

    Trying to figure out how to save an analyses to a data table using a variable . I tried multiple options : 

1. Option 1 : Adding Col List to table as a variable 

 

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
myvar = dt << Get column Names("String");
dt << Set Table Variable("ColNames", myvar);
dt << New Script("Save Analyses Using Variable",
Bivariate(myvar[2],myvar[4],Fit Line)
);



2. Using the column name from a list 

BivAfter = Bivariate(
                           Y( Eval(TempCols[r])), // 
                           X( :age ),
                          Automatic Recalc( 1 ),
                           Fit Line( {Line Color( {213, 72, 87} )} )
                           );



Option 2 works when you are running the script and saves the analyses to the data table . But if I close the script and try to launch the analyses from the table - it fails . 
Can anybody help please ? 
Best 
Uday 


 

Best
Uday
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Save Analysis to Table Using Variable (in JSL)

You need to evaluate your column references before adding a new table script. See example below.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
myvar = dt << Get column Names();

Eval(
	Eval Expr(
		dt << New Script(
			"Save Analyses Using Variable",
			Names Default To Here( 1 );
			dt = current data table();
			biv = dt << Bivariate( Y( Expr( myvar[2] ) ), X( Expr( myvar[4] ) ), Fit Line );
		)
	)
);
Justin

View solution in original post

1 REPLY 1

Re: Save Analysis to Table Using Variable (in JSL)

You need to evaluate your column references before adding a new table script. See example below.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
myvar = dt << Get column Names();

Eval(
	Eval Expr(
		dt << New Script(
			"Save Analyses Using Variable",
			Names Default To Here( 1 );
			dt = current data table();
			biv = dt << Bivariate( Y( Expr( myvar[2] ) ), X( Expr( myvar[4] ) ), Fit Line );
		)
	)
);
Justin

Recommended Articles