多個可變列的最大值到特定行大家好,
如何創建公式列以查找特定行的幾個變量列的最大值
colList = dt << get column names;<BR />colList = remove( colList, 1,2);
Show( colList );
New Column( "Column 15",
Numeric,
Continuous,
Format( "Best", 8 ),
Formula( Maximum(colList[1]), colList[2],colList[3] ) ),
Set Selected
);
回复:幾個變量列的最大值到特定行請參閱以下討論這裡。
回复:幾個變量列的最大值到特定行@txnelson我遇到了類似的問題,但不知道我的列長度,就像 op 知道他的長度 3 一樣。 我該如何修改它才能達到 n 長度的最大值?
回复:幾個變量列的最大值到特定行我提供的示例代碼是否與我提供的一樣有效?它應該無需更改即可工作。
錯誤聲明表明您在識別單詞“Name”時遇到了問題。 您能否提供數據樣本以及失敗的腳本?
回复:幾個變量列的最大值到特定行抱歉,它仍然無法正常工作(解決方案 2)。
我的名字 - 日期,格式 -01/30/2019 。
謝謝。


回复:幾個變量列的最大值到特定行這是我的腳本,唯一的變化是它指向 SAMPLE 數據表“Blood Presure”。

Names Default To Here( 1 );
dt = Open("$SAMPLE_DATA/Blood Pressure.jmp");
colList = dt << get column names;
colList = Remove( colList, 1, 2 );
Show( colList );
New Column( "Column 15",
Numeric,
Continuous,
Format( "Best", 8 ),
Formula(
Max(
As Column( colList[1] ),
As Column( colList[2] ),
As Column( colList[3] )
),
Set Selected
)
);
Eval(
Substitute(
Expr(
New Column( "Column 16",
Numeric,
Continuous,
Format( "Best", 8 ),
Formula(
Max( __col1__, __col2__, __col3__ ),
Set Selected
)
)
),
Expr( __col1__ ), Parse( ":" || Char( colList[1] ) ),
Expr( __col2__ ), Parse( ":" || Char( colList[2] ) ),
Expr( __col3__ ), Parse( ":" || Char( colList[3] ) )
)
);
問題可能是您有復雜的列名稱,其中包含 JMP 嘗試對其進行計算的字符。如果是這種情況,您需要將替換更改為:
Expr( __col1__ ), Parse( ":Name\!"(" || Char( colList[1] ) || "\!")" )
當然,改變 if 對於所有 3 個替換
回复:幾個變量列的最大值到特定行感謝您的快速回答。
請看下面的答案
* 第一個解決方案(Colmun 15)運行良好
* 第二個 (Colmun 16) 效果不佳

回复:幾個變量列的最大值到特定行下面是一個腳本,可以通過兩種不同的方式計算您想要的內容。首先,是對您的代碼的更正。一些“(”必須移動,因為它們不在正確的位置,而且,必須添加 As Column() 函數以告訴 JMP 將 colList[] 值視為列。雖然此代碼有效,但如果您退出 JMP 然後再返回 JMP,則該公式將無效,因為公式中沒有可使用的名為“colList”的列表。因此,您真正需要使用的是我作為新專欄“第 16 欄”放入的內容。對您的數據運行腳本,然後查看兩列的實際公式,您會發現差異。
Names Default To Here( 1 );
dt = Current Data Table();
colList = dt << get column names;
colList = Remove( colList, 1, 2 );
Show( colList );
New Column( "Column 15",
Numeric,
Continuous,
Format( "Best", 8 ),
Formula(
Max(
As Column( colList[1] ),
As Column( colList[2] ),
As Column( colList[3] )
),
Set Selected
)
);
Eval(
Substitute(
Expr(
New Column( "Column 16",
Numeric,
Continuous,
Format( "Best", 8 ),
Formula(
Max( __col1__, __col2__, __col3__ ),
Set Selected
)
)
),
Expr( __col1__ ), Parse( ":" || Char( colList[1] ) ),
Expr( __col2__ ), Parse( ":" || Char( colList[2] ) ),
Expr( __col3__ ), Parse( ":" || Char( colList[3] ) )
)
);回复:幾個變量列的最大值到特定行感謝您的反饋。