新增一個列名,其中最後的資料可用。
如何新增失敗列,其列名從測試資料開始遺失的位置開始?
基礎資料分析與建模回覆:新增一個列名,其中最後的資料可用。這是我提出的公式
As Constant(
firstCol = 3;
nTests = 5;
lastCol = (firstCol + nTests) - 1;
dt = Current Data Table();
);
nPass = Length( Loc( dt[Row(), Index( firstCol, lastCol )] ) );
If( nPass == 5,
x = "Pass",
x = Column( (firstCol + nPass) - 1 ) << get name
);
x;

回覆:新增一個列名,其中最後的資料可用。其他選擇
Names Default To Here(1);
dt = Data Table("Untitled");
dt << New Column("Col", Character, Nominal);
test_cols = Filter Each({colname}, dt << Get Column Names("Continuous", "String"), Starts With(colname, "Test "));
For Each Row(dt,
idx = Max(Loc(dt[Row(), test_cols]));
If(idx >= N Items(test_cols),
:Col = "Pass"
,
:Col = test_cols[idx];
);
);