データテーブルこんにちは、
JMPで2つ以上のテーブルを比較し、すべてのテーブルに共通する列を調べたいです。各テーブルに特定の列の値が存在する場合は1を、存在しない場合は0を返すようにしたいです。これは、いくつかの定義済みテーブルと、各テーブルに列を追加して0または1を返すJSLスクリプトを使用することで実現できます。
しかし、このスクリプトを汎用的にして、テーブル名を事前に定義する必要がないようにしたいのです。このスクリプトを実行するたびに、どのテーブルを比較したいのか尋ねてくるようにしたいのです。
その後、このスクリプトは、比較したい列を選択するオプションも提供できるように動作させたいと考えています。
現在、私はこのスクリプトを使用しています
// Get references to the three tables
dt1 = Data Table("Untitled 9");
dt2 = Data Table("Untitled 10");
dt3 = Data Table("Untitled 11");
// Extract ID values from each table
ids1 = dt1:ID << Get Values;
ids2 = dt2:ID << Get Values;
ids3 = dt3:ID << Get Values;
// Find common IDs manually
commonIDs = {};
For(i = 1, i <= N Items(ids1), i++,
If(Contains(ids2, ids1[i]) & Contains(ids3, ids1[i]),
Insert Into(commonIDs, ids1[i])
)
);
// Function to add indicator column
AddIndicatorColumn = Function({dt},
dt << New Column("PresentInAll",
Numeric,
Formula(If(Contains(commonIDs, :ID), 1, 0))
)
);
// Apply to all tables
AddIndicatorColumn(dt1);
AddIndicatorColumn(dt2);
AddIndicatorColumn(dt3);
編集 (jthi): jsl フォーマットを追加しました
3つのテーブルUntitled 9、Untitled 10、Untitled 11を選択し、比較する列は「ID」です
これについて助けてください、
ありがとう

自動化とスクリプトデータアクセスデータテーブルについてテーブルにはいくつの行があり、いくつの一意の値がありますか? これは、パフォーマンスの問題を回避するためにこれをどのように行うべきかに影響する可能性があります。
データテーブルについてとにかく、Get Data Table List + List Boxesを使ってUIを構築できます。以下は、始める際に役立つ簡単なバージョンです。
Names Default To Here(1);
dts = Get Data Table List();
If(N Items(dts) < 2,
Throw("Not enough tables open");
);
run_expr = Expr(
Show(lb_tables << get selected, lb_columns << get selected);
);
tables = dts << get name;
nw = New Window("",
H List Box(
Panel Box("Select tables",
lb_tables = List Box(tables,
<< Set Function(Function({this},
sel = this << get selected;
If(N Items(sel) < 1,
return(0);
);
cols = Datatable(sel[1]) << Get Column Names("String");
lb_columns << Set Items(cols);
))
),
),
Panel Box("Pick Column",
lb_columns = List Box({}, << Set Max Selected(1))
),
Panel Box("Actions",
Lineup Box(N Col(1),
Button Box("OK",
run_expr
),
Button Box("Cancel",
nw << close window;
)
)
)
)
);
Write();
データテーブルについてこれは、Jarmo の JSL を拡張して、最初の議論で示した結果を提供する、肉付けされた JSL です。
連想配列を使用して、3 つのテーブルすべてに表示される列名の交差と、選択した列に表示される値の交差を見つけます。
また、Update Platform を利用して結果を元の3つのテーブルに戻します。この手法は、非常に大きなデータテーブルでも非常に効率的です。

Names Default To Here( 1 );
dts = Get Data Table List();
If( N Items( dts ) < 2,
Throw( "Not enough tables open" )
);
tables = dts << get name;
// Create the table and column selection window
nw = New Window( "",
H List Box(
// Define the Table selection box
Panel Box( "Select tables",
lb_tables = List Box(
tables,
maxselected( 3 ),
<
<SET function="">
0, lb_columns << Set Items( cols ); pickPBox << visibility( "Visible" ); ); ); ) ) ), ), // Define the column selection box pickPBox = Panel Box( "Pick Column", lb_columns = List Box( {}, Max Selected( 1 ), <
<SET function=""></SET>
</SET>
<BR />