Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Controlling ANOVA report output via dispatch with a string variable

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Dec 14, 2017 12:51 AM
(798 views)

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Revtal

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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 )}
)
)
)
) );
);
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Revtal