如何將變數值與表列值進行比較我有一個應該是一個簡單的問題,但我不知道正確的表達方式。
我有一些變數;
A1=“44”;
A2=“47”;
A3=“50”;
//數字故意採用字串格式
還有一個資料表 dt,其中這些變數與許多其他變數一起包含在一列“LOT”列中。如果我建立一個 for 循環,在表中尋找這些變量,並在找到它們時標記行,我將無法找到它們。
For( i = 1, i <= 3, i++,
foundlot = "A" || Char( i );
Show( foundlot );
dt << Select Where( :LOT = foundlot ) << Colors = (5);
);
我意識到問題在於,foundlot 是字串「A1」、「A2」、「A3」...並且不會替換 A1、A2 和 A3 的值以允許將 A1 的值與列值進行比較在表中。
我需要做什麼才能讓它替換該值,而不是將列值與始終不匹配的字串“A1”進行比較?
感謝您的幫忙!
資料混合與清理大規模客製化回覆:如何將變數值與表列值進行比較這非常有效。 謝謝你!
回覆:如何將變數值與表列值進行比較謝謝你! 我會嘗試!回覆:如何將變數值與表列值進行比較我相信下面這兩個簡單的腳本可以滿足您的需求。您遇到的問題是需要指示 A1、A2 和 A3 不是變數值,而是變數的名稱。腳本 1 將為您完成此操作。第二個腳本可能是考慮您的問題的更好方法。透過使用 JMP 列表,您可以使用下標引用變數值
names default to here(1);
dt=current data table();
A1 = "44";
A2 = "47";
A3 = "50";
For( i=1, i<=3, i++,
foundlot = "A" || char(i); Show (foundlot);
Eval(Parse(EvalInsert("\[dt << Select Where(:LOT == ^foundlot^, current selection("extend") ) ;]\")));
);
dt << colors( "red");
// or
names default to here(1);
dt=current data table();
aList = {"44", "47", "50" };
For( i=1, i<=3, i++,
dt << Select Where( :Lot == aList[i], current selection("extend"));
);
dt << colors( "red");