I want to define the list stored in a variable as multiple column names to be loaded into the Y column of the Control Chart Builder.I am thinking about how to write a JSL script to realize the title.
The version of JMP used is 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>Automation and Scripting</LINGO-LABEL><LINGO-LABEL>Windows</LINGO-LABEL></LINGO-LABS>Re: 変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。Seems like control chart builder wants to be one of the difficult platforms in JMP. With something like this, you should be able to get all (even the difficult/annoying ones) to work
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)
));Re: I want to define a list stored in a variable as multiple column names to be loaded into the Y column of the Control Chart Builder.Thanks so much for the nice code!
The problem has been completely solved, thank you very much.
To be honest, I still don't understand the code very well...
I think the idea is to substitute the array stored in ys each time, and then store the results in the control chart. Is that correct?
Re: 変数に格納されたリストを、Control Chart Builderの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

You can also check what ys by using Show(NameExpr(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);
Re: 変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。either Eval(Substitute(Expr(...)))
... or Eval(Eval Expr( Expr()...))
Tips and Tricks - best practice with JMP/JSL
Think of Eval (Eval Expr( Expr()...))as :
please search for Expr() and Eval Expr() .... before you Eval() the whole thing.
Unfortunately, all 3 of them start with E... , so it's a bit tricky to remember them with the correct meaning.
The 4th E... is Name Expr() - @jthi used it in the for loop to convert the Strings into columns (:column) *)
... and we need it to get Y(...) instead of an error message : )
*) Fortunately, Control Chart Builder accepts strings as alternative to columns.
So one can directly convert the list of column names to a Y() of column names by replacing the head via
Substitute Into:
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)
)
));