別の行にあるセルへの値の検索/コピーフォーラムおよびJMPヘルプファイルで何度か検索しても、特定の問題に対する適切な解決策を見つけることができません。
私は患者のデータセットを持っています。各患者は連続した行に複数のフェーズの研究を持っています(各患者はフェーズ数が異なります)。 列の1つはフェーズであり、各患者のこれらの行の1つには、「ベース」と呼ばれるフェーズがあります。「Base」のYy値を患者IDと同じ行に配置するための新しい変数を定義しようとしています。 下記参照:
患者番号患者名段階 Yy =対象となる変数 New Column = "Base" [患者別]
1患者XYZ abc 4 // 2が欲しい
1 def 8
1 ベース 2
1ギー10
2患者MNO abc 45 //ここで54が欲しい
2 def 36
2ギー24
2 ベース 54
3
3
3
3
任意の助けは大歓迎です!
ありがとう、
描いた
再:別の行のセルに値を見つける/コピーするこれを行うには複数の方法があります。 @ron_horne の方法はポイントアンドクリックでできます。以下のスクリプトは、他のソフトウェアでは辞書または検索と呼ばれる連想配列を使用しています。
私は逃した @ron_horne のテーブルなので、私は違うものを持っています。ここにスクリプトがあり、添付されているのはこのスクリプトをテーブルスクリプトとして埋め込んだテーブルです。クリックして実行してください。
Names default to here(1);
dt = current data table();
brows = dt << get rows where(:Phase == "Base");
aa = Associative Array( Column("Patient #")[brows], Column("Yy = Variable of interest")[brows]);
// patient numbers are the keys and the Base values, the values
nc = dt << New Column("New Column = \!"Base\!" [by patient]", numeric, Continuous);
nc << set each value(If(length(:Patient Name) > 0, aa[Column("Patient #")[]] ) );再:別の行のセルに値を見つける/コピーするこんにちは @ drmn43 、
添付のテーブルで次のスクリプトを試してください。
それ以外の場合は、同じ手順に従って手動で実行する方がはるかに簡単です。
dt = Current Data Table();
dt << select where( :Phase == "Base" );
subdt = dt << Subset( Selected Rows( 1 ) );
dt << clear select;
// make a sleek change of names
subdt << delete columns( "Base by Patient" );
subdt:Name( "Yy = Variable of interest" ) << Set Name( "Base by Patient" );
// Before updating the it is useful to delete columns that we do not want to updat
keep = {"Patient #", "Base by Patient"};
todelete = subdt << get column names( "string" );
For( icol = 1, icol <= N Items( keep ), icol++,
Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )
);
subdt << delete columns( todelete );
dt << Update( With( Data Table( "Subset of Database" ) ), Match Columns( :Patient # = :Patient # ) );
Close( subdt, no save );
あなたが他の行を空にする必要があるならば、私はそれを成し遂げるために別のステップまたは2つを追加することができます。
ロン