如何在腳本中使用具有不同列的公式你好。
我有一個包含數字列的資料表,我打算建立新列,其結果是第 1 列除以第 2 列,第 3 列除以第 4 列,依此類推。
我有這個腳本,但我的問題是我不知道如何指示股息中的第 2 列。
numericColNames = dt << get column names( string, numeric );
For( i = 1, i <= N Items( numericColNames ) - 1, i += 2,
Eval(
Substitute(
Expr(
New Column( Char( numericColNames[i] ) || "_Stand",
Numeric,
Continuous,
Formula( (__col__) / (__col__) )
)
),
Expr( __col__ ), Parse( ":" || numericColNames[i] )
)
)
);自動化和腳本編寫大規模客製化分享和交流成果回覆:如何在腳本中使用具有不同列的公式非常感謝尼爾森老先生。 Es lo quebuscaba。回覆:如何在腳本中使用具有不同列的公式你們非常接近。您需要做的就是建立第二個要替換的值,並引用 i+1 欄位進行替換
names default to here(2);
dt=open("$SAMPLE_DATA/blood pressure.jmp");
numericColNames = dt << get column names( string, numeric );
For( i = 1, i <= N Items( numericColNames ) - 1, i += 2,
Eval(
Substitute(
Expr(
New Column( Char( numericColNames[i] ) || "_Stand",
Numeric,
Continuous,
Formula( (__col1__) / (__col2__) )
)
),
Expr( __col1__ ), Parse( ":" || numericColNames[i] ),
Expr( __col2__ ), Parse( ":" || numericColNames[i+1] )
)
)
);