Creating Fit Group Bivariate Charts with For LoopInstead of using hardcoded column names as input, I'd like a simple for loop to create the same charts as without the for loop.
dt = Open("C:\Program Files\SAS\JMP\15\Samples\Data\semiconductor capability.jmp");
Y_parameters = {"NPN1", "NPN2", "NPN3"};
X_parameters = {"PNP1", "PNP2", "PNP3"};
Fit Group(
//For i:
//For j:
Bivariate( Y( As Column(dt, Y_parameters[i]) ), X( As Column(dt, X_parameters[j])) ),
//end For j:
//end For i
//Want to replace the hard coded Y and X parameters with above for loop
Bivariate( Y( :NPN1 ), X( :PNP1 ) ),
Bivariate( Y( :NPN1 ), X( :PNP2 ) ),
Bivariate( Y( :NPN1 ), X( :PNP3 ) ),
Bivariate( Y( :NPN2 ), X( :PNP1 ) ),
Bivariate( Y( :NPN2 ), X( :PNP2 ) ),
Bivariate( Y( :NPN2 ), X( :PNP3 ) ),
Bivariate( Y( :NPN3 ), X( :PNP1 ) ),
Bivariate( Y( :NPN3 ), X( :PNP2 ) ),
Bivariate( Y( :NPN3 ), X( :PNP3 ) ),
<<{Arrange in Rows( 3 )}
);ScriptingRe: Creating Fit Group Bivariate Charts with For LoopIf you want to get all combinations, I think you can just use
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
Y_parameters = {"NPN1", "NPN2", "NPN3"};
X_parameters = {"PNP1", "PNP2", "PNP3"};
Fit Group(
Bivariate( Y(Eval(Y_parameters)), X(Eval(x_parameters))),
<<{Arrange in Rows( 3 )}
);
Re: Creating Fit Group Bivariate Charts with For LoopI would most likely do it with two lists (or associative array) and then looping. I think I wouldn't even use Fit Group unless I really had to and just create them with display boxes.
You can also try to use expressions, but this gets messy and complicated quickly (and at least this solution isn't as robust as I would like to use, I just tried different things and got it working):
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
Y_parameters = {"NPN1", "NPN2", "NPN3"};
X_parameters = {"PNP1", "PNP2", "PNP3"};
fg_expr = Expr(
dt << Fit Group(test, <<{Arrange in Rows(3)})
);
biv_expr = Expr({});
For(i = 1, i <= N Items(Y_parameters),i++,
next_biv = Eval Expr(Bivariate(Y(Column(Expr(Y_parameters[i]))), X(Column(Expr(X_parameters[i])))));
Insert Into(biv_expr, Name Expr(next_biv));
);
Substitute Into(fg_expr, Expr(test), Expr(EvalList(NameExpr(biv_expr))));
Show(Name Expr(fg_expr));
fg_expr;
Re: Creating Fit Group Bivariate Charts with For Loop@jthi @Wendy_Murphrey I was following this solution on this. Not exactly sure how to use the eval expr. I am trying to loop parameter column with semiconductor wafers. For some reason associated array wasn't working for me ( I am using JMP pro 18), so chose a list approach. Appreciate your help on this! Thank you
startcol = 37;
endCol = N Cols(dt);
For(t = startCol, t <= endCol, t++,
Insert Into(targetList, AllColList[t])
);
Summarize(dt, newlist = by(:waferno));
fg_expr = Expr(
dt << Fit Group(test, <<{Arrange in Rows(1)}, Order by Goodness of Fit)
);
ow_expr = Expr({});
currentlabel = targetList[1];
currentwafer = newlist[1];
For(ilabel = 1, ilabel <= 2, ilabel++,
nextlabel = targetList[ilabel + 1];
Show(nextlabel);
For(iwfr = 1, iwfr <= 2, iwfr++,
nextwafer = newlist[iwfr + 1];
Show(nextwafer);
//nw2=vl<<APPEND></APPEND>