こんにちは
列「isrejects?」の値がYである行のすべてのデータを、rejectsという新しいテーブルにサブセット化しようとしています。
いくつかの方法を試しましたが、どれも機能せず、エラーが発生します:
「予期しない「Split_dt」。おそらく「;」または「,」が欠落しています。
行 77 列 1: ►Split_dt << Select Where( :is denys? == "Y" );"
このコードは、「拒否されますか?」という列を作成するより大きなスクリプトの一部です。
すべてのスクリプトを実行すると上記のエラーが発生しますが、個別に実行すると動作します。
それを修正するにはどうすればいいですか?
オプション1:
rejects = Split_dt << Subset(
Where(:is rejects? == "Y"),
Output Table Name("rejects"),
All Columns
);
オプション2:
Split_dt << Select Where(:is rejects? == "Y");
rejects = Split_dt << Subset(Output Table Name("rejects"), All Columns);
完全なスクリプト:
Split_dt = Current Data Table();
Split_dt << New Column("is rejects?", character, Formula("N"));
Column(Split_dt, "is rejects?") << Delete Formula;
// Get the number of columns in the data table
numCols = N Cols(Split_dt);
// Iterate over each row in the data table
For Each Row(
// Iterate over each column starting from column 6
For(colIndex = 6, colIndex <= numCols, colIndex++,
// Get the column reference
currentCol = Column(Split_dt, colIndex);
// Check if the value in the current cell is greater than 100 and "is rejects?" is "N"
If(
currentCol[] > 100 & :is rejects? == "N" & Contains(currentCol << Get Name, "BI")
== 0,
// Change the value in the "is rejects?" column to "Y"
:is rejects? = "Y";
// Exit the loop early since we only need one match
Break();
);
)
);
rejects = Split_dt << Subset(
Where(:is rejects? == "Y"),
Output Table Name("rejects"),
All Columns
);
特定の行をサブセット化するときには通常、Rows() を使用します (選択した行をサブセット化することもできますが、通常、これを行うとテーブル内で不要な選択を実行することになります)。
この例では、性別 == "F" であるすべての行をサブセット化します。
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
rows_to_subset = dt << get rows where(:sex == "F");
dt_subset = dt << Subset(Rows(rows_to_subset), Output Table("Subset F"));迅速な対応ありがとうございます。
あなたが提案した解決策でも同じエラーが発生します:(
どのバージョンの JMP を使用していますか? 私のサンプル スクリプトを試しましたか?
試す
rejects = Split_dt << Subset(
Filtered Rows(:is rejects? == "Y"),
Output Table Name("rejects"),
All Columns
);