我想將儲存在變數中的清單定義為要讀入控製圖產生器的 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()...))視為:
請搜尋Expr()和Eval Expr() .... 在Eval()整件事情之前。
不幸的是,這三個詞都以E...開頭,所以記住它們的正確含義有點困難。
第 4 個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)
)
));