您好,我在 Mac 上使用 JMP 15。 以下程式碼有效:
dt = current data table();
Current Data Table() << Row Selection(
Select where( (:Stat == "Max"), Current Selection( Extend ))
);
但這並沒有:
dt = current data table();
Current Data Table() << Row Selection(
var = "Max"
Select where( (:Stat == var), Current Selection( Extend ))
);
有人可以解釋第二個有什麼問題嗎?
似乎發生了一些奇怪的事情(在 Windows 10 上使用 JMP16.0 進行了測試)。 使用行選擇時請仔細查看括號
腳本索引的範例(工作正常):
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Row Selection(Select where(:age < 15));
Wait(2);
dt << Row Selection(
Select where(:age == 15),
current selection("extend")
);在第二行選擇之前新增變數並使用它(返回 Scriptable[]):
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Row Selection(Select where(:age < 15));
Wait(2);
ageVar = 15;
dt << Row Selection(
Select where(:age == ageVar),
current selection("extend")
);
將括號從 SelectWhere 的末尾移動到當前選擇之後(似乎工作正常,但對於基於腳本索引的行選擇,此語法似乎是錯誤的):
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Row Selection(Select where(:age < 15));
Wait(2);
ageVar = 15;
dt << Row Selection(
Select where(:age == ageVar,
current selection("extend"))
);
使用“選擇平台”時,生成的腳本似乎是:
Data Table("Big Class") << Row Selection(
Select where(:age == 15, Current Selection("Extend")),
Dialog(Edit(Equal(Source Column(:age))), Keep dialog open(1))
);
不使用行選擇時的選擇:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Row Selection(Select where(:age < 15));
Wait(2);
ageVar = 15;
dt << Select where(:age == ageVar, current selection("extend"));
如果不需要對話框,我很可能總是使用 << SelectWhere (沒有行選擇),因為語法更簡單,而且我不確定除了對話框之外,行選擇是否會為錶帶來任何額外的內容。
不確定在此處標記 JMP/SAS 的誰來查看此問題。
試著將 var = "Max" 移到 << Row Selection() 之外。 並加入缺失的;