如何在脚本中使用具有不同列的公式你好。
我有一个包含数字列的数据表,我打算创建新列,结果是第 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] )
)
)
);脚本回复:如何在脚本中使用具有不同列的公式Muchas gracias Sr. Nelson。 Es lo que 布斯卡巴。回复:如何在脚本中使用具有不同列的公式你很亲密。您需要做的就是创建第二个要替换的值,并引用 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] )
)
)
);