我想将存储在变量中的列表定义为要读入控制图生成器的 Y 列的多个列名称。我正在考虑如何编写JSL脚本来实现标题。
使用的JMP版本是18。
dt02=current data table();
//列名を変数に
columnNames = dt02 << Get Column Names;
//3列目以降の列はすべてトレンドを確認するために必要
columnNames2={};
For( j = 3, j <= N Items( columnNames ), j++,
Insert Into( columnNames2, Column( columnNames[j] ) );
);
//X-bar_and_S_chart作成
grp01=dt02<<CONTROL chart="" builder=""></CONTROL><LINGO-LABS id="lingo-labs-825157" slang="ja-JP" mode="CREATE"><LINGO-LABEL>自动化和脚本</LINGO-LABEL><LINGO-LABEL>视窗</LINGO-LABEL></LINGO-LABS>回复:我想将存储在变量中的列表定义为要读入控制图生成器的 Y 列的多个列名称。控制图生成器似乎想成为 JMP 中较难使用的平台之一。有了这样的东西,你应该能够让所有(甚至是困难/烦人的)工作
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cont_cols = dt << Get Column Names("Continuous", String);
ys = Expr(Y());
For Each({colname}, cont_cols,
Insert Into(ys, Name Expr(AsColumn(dt, colname)));
);
Eval(Substitute(
Expr(ccb = dt << Control Chart Builder(
Variables(Subgroup(:age), _ycols_),
Show Control Panel(0),
Chart(Position(1), Limits(Sigma("Standard Deviation"), Spec Limits(1))),
Chart(Position(2), Points(Statistic("Standard Deviation")), Limits(Sigma("Standard Deviation"))),
Show Control Panel(0)
)),
Expr(_ycols_), Name Expr(ys)
));回复:我想将存储在变量中的列表定义为要读入控制图生成器的 Y 列的多个列名称。非常感谢您提供的好代码!
问题已经彻底解决了,非常感谢。
说实话,我对代码还是不太理解。 。 。
我想形象的是,每次对ys中存储的数组进行替换,结果存储在控制图中。正确吗?
回复:我想将存储在变量中的列表定义为要读入控制图生成器的 Y 列的多个列名称。In most of the platforms you could use Eval() with list of columns but in case of control chart builder it doesn't work and you have to have very specific format to make it work Y(:col, :col2). I build the correct format into ys, Y(:height, :weight) and then use Substitute to add to the Control Chart Builder message so it will be "forced" to evaluate correctly. You can see this if you remove Eval() outside of the Substitute() and run that

您还可以使用 Show(NameExpr(ys)) 检查 ys
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cont_cols = dt << Get Column Names("Continuous", String);
ys = Expr(Y());
For Each({colname}, cont_cols,
Insert Into(ys, Name Expr(AsColumn(dt, colname)));
);
Show(Name Expr(ys)); // Name Expr(ys) = Y(:height, :weight);
回复:我想将存储在变量中的列表定义为要读入控制图生成器的 Y 列的多个列名称。Eval(Substitute(Expr(...)))
... 或Eval(Eval Expr( Expr()...))
技巧和窍门 - JMP/JSL 的最佳实践
将Eval (Eval Expr( Expr()...))视为:
在对整个内容进行 Eval()之前,请搜索Expr()和Eval Expr() ....
不幸的是,这三个词都以E...开头,因此要记住它们的正确含义有点棘手。
第四个E...是Name Expr() - @jthi在 for 循环中使用它来将字符串转换为列 (:column) *)
... 我们需要它来获取Y(...)而不是错误消息:)
*) Fortunately, Control Chart Builder accepts strings as alternative to columns.
因此,可以通过以下方式替换头部,直接将列名列表转换为列名的Y()
代入:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tmp = dt << Get Column Names("Continuous", String);
Substitute Into(tmp, Expr(List()), Expr(Y()));
Eval(Eval Expr(
ccb = dt << Control Chart Builder(
Variables(Subgroup(:age), Expr(Name Expr(tmp))),
Show Control Panel(0),
Chart(Position(1), Limits(Sigma("Standard Deviation"), Spec Limits(1))),
Chart(Position(2), Points(Statistic("Standard Deviation")), Limits(Sigma("Standard Deviation"))),
Show Control Panel(0)
)
));