Here is another way using expressions. There are more solutions based on expressions than just this example.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Dogs.jmp" );
predictor = { :drug, :dep1 };
n = N Items( predictor );
effectExpr = Expr( Effects() );
For( x1 = 1, x1 < n, x1++,
Insert Into( effectExpr, predictor[x1] );
For( x2 = 2, x2 <= n, x2++,
Eval(
Substitute(
Expr( Insert Into( effectExpr, Expr( xxx1 * xxx2 ) ) ),
Expr( xxx1 ), predictor[x1],
Expr( xxx2 ), predictor[x2]
)
)
);
);
Show( Name Expr( effectExpr) );
Eval(
Substitute(
Expr(
obj = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
eee,
Personality( Manova ),
Run( Response Function( Sum ) )
);
),
Expr( eee ), Name Expr( effectExpr )
)
);