BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted
revital

Community Trekker

Joined:

Jun 7, 2016

Controlling ANOVA report output via dispatch with a string variable

Hello,

I'm trying to refer to a string variable ( colname ) in dispatch, but it fails to obay the OutlineBox,{Close( 0 )} (or Close( 1 )) as opposed to when the string is explicitly written.

Would appreciate your help.

Revital

 

Here is the code:

For( i = 1, i <= N Items( ColumnNames ), i++,
colname = "Response " || char(colnameames[i]);
Cobj = dt << Fit Model(
Y( colnameames[i] ),
Effects( :Visit, :Group, :Group * :Visit ),
Random Effects( :SubjectNumber[:Group] ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
colnameames[i] << {Analysis of Variance( 0 ), Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ), {:Visit <<
{LSMeans Plot( 1 ), LSMeans Contrast( [1 0 0 -1] )}, :Group << {LSMeans Plot( 1 ),
LSMeans Contrast( [1 0 0 -1] )}, :Group * :Visit << {LSMeans Plot( 1 )}}
),
SendToReport(
Dispatch(
{colname , "Effect Details", "Visit", "Contrast"},
"Test Detail",
OutlineBox,
{Close( 0 )}
),
Dispatch(
{colname , "Effect Details", "Group", "Contrast"},
"Test Detail",
OutlineBox,
{Close( 0 )}
),
Dispatch(
{colname , "Effect Details"},
"SubjectNumber[Group]",
OutlineBox,
{Close( 1 )}
)
)
);
1 ACCEPTED SOLUTION

Accepted Solutions
revital

Community Trekker

Joined:

Jun 7, 2016

Solution

Re: Controlling ANOVA report output via dispatch with a string variable

Thanks so much for the help. I used the solution as in your example and it worked!!

Revtal 

 

2 REPLIES 2
ih

Community Trekker

Joined:

Sep 30, 2016

Re: Controlling ANOVA report output via dispatch with a string variable

You need to build the string containing the name of the outline box before evaluating the rest of the expression.  You can do this a few different ways using strings, check out Parse(Substitute()) and Eval Insert() as in some cases they might be better choices.  One way, though, is to use Eval Expr() as shown below:

 

Try replacing Eval( with Write( Char( and look in the log to see what code is actually evaluated. You can copy and paste from the log to a script window and then use the 'reformat script' button.

 

Names default to here( 1 );

dt = Open( "$Sample_data/Iris.jmp" );

targets = {"Sepal length", "Petal length"};

For( i = 1, i <= N Items( targets ), i++,

	//Here is a Fit Model expression with some parts contained in Expr()
	//First the Fit model 'code' goes to Eval Expr() to evalute only those parts
	//contained in Expr().  Then it goes to Eval() to actually run the code.
	Eval( Eval Expr(
		Fit Model(
			Y( targets[i] ),
			Effects( :Sepal width, :Petal width ),
			Random Effects( :Species ),
			NoBounds( 1 ),
			Personality( "Standard Least Squares" ),
			Method( "REML" ),
			Emphasis( "Minimal Report" ),
			Run(
				:Sepal length << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
				Parameter Estimates( 1 ), Lack of Fit( 0 ), Plot Actual by Predicted( 0 ),
				Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
				Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 )}
			),
			SendToReport(
				Dispatch(
					{ Expr( "Response" ||  targets[i] ) }, //This is evaluated first
					"Parameter Estimates",
					OutlineBox,
					{Close( 1 )}
				),
				Dispatch(
					{ Expr( "Response" ||  targets[i] ) }, //This is evaluated first
					"REML Variance Component Estimates",
					OutlineBox,
					{Close( 1 )}
				),
				Dispatch(
					{ Expr( "Response" ||  targets[i] ) }, //This is evaluated first
					"Fixed Effect Tests",
					OutlineBox,
					{Close( 1 )}
				)
			)
		)
	) );
);
revital

Community Trekker

Joined:

Jun 7, 2016

Solution

Re: Controlling ANOVA report output via dispatch with a string variable

Thanks so much for the help. I used the solution as in your example and it worked!!

Revtal