cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
Katz0801
Level II

Profiler: Using variables in term value script not working

Hello I have a JMP script for creating a profiler and saving some settings.

dt = Current Data Table();

pCPP1 = Column("Load Challenge");
pCPP1Target = 10;

ColNames = dt << Get Column Names("String");

Preds = Filter Each ({ColName}, ColNames, Starts With(ColName, "Pred"));

For (i = 1, i <= N Items(Preds), i++,
	PF = Profiler(
		Y(Preds[i]),
		:Preds[i] << Response Limits
		);
	PF << Term Value(pCPP1( pCPP1Target, Lock( 0 ), Show( 1 ) ));
Wait( 1 );	
PF << Factor Settings << Remember Settings( "Target" );
Wait( 1 );	
); 

The issue I have is that the pCPP1 variable in the Term Value section isn't working. The script functions correctly if I have the :Load challenge column here instead so I know the issue isn't somewhere else in the JSL. However, the plan is the have multiple saved settings and for someone to be able to easily change which column is being used just by changing the variable at the top (not all users will be very experienced with JMP). I've tried calling the variable :Load Challenge and :"Load Challenge"n instead of using the column function but that also didn't work. I also tried using column(pCPP1) in the term value section.

Is there a way to do this? Or will people just have to copy the column name into every term value setting I have in this loop. (It's just odd that it works for the pCPP1Target value and not for the column).

1 REPLY 1

Re: Profiler: Using variables in term value script not working

Hi @Katz0801 ,

 

It's because the PCPP is a column reference, whereas

dt = Current Data Table();

pCPP1 = Column("X1");
pcpp1name=pcpp1<<get name;
pCPP1Target = 10;

term_expr=expr(PF << Term Value(pcpp_placeholder( pCPP1Target, Lock( 0 ), Show( 1 ) )););

substitute into (term_expr, expr(pcpp_placeholder), pcpp1name);

ColNames = dt << Get Column Names("String");

Preds = Filter Each ({ColName}, ColNames, Starts With(ColName, "Pred"));

For (i = 1, i <= N Items(Preds), i++,
		PF = Profiler(
		Y(Preds[i]),
		:Preds[i] << Response Limits
		);
		term_Expr;
		PF << Factor Settings << Remember Settings( "Target" );
		);
	

the term value is looking for the text name of the X1 value, you can use 'Substitute Into' with an expression to get that in place.

 

 

“All models are wrong, but some are useful”

Recommended Articles