我試圖從一個jmp表中讀取目標和重要性,並將它們設置為不同表中的列。我無法理解如何循環列名稱以從其他限製表中讀取數據。這是我的腳本:
Names Default To Here( 1 );
// Select the data table and open it
path = Pick File( "Select Data Table" );
dt = Open( path );
// Select the limits table and open it
path = Pick File( "Select Limits Table" );
dt2 = Open( path );
Current Data Table( dt );
x = dt << Get Column Names(string,numeric);
y = dt2:ColumnName << Get Column Names();
show(x);
show(y);
ncols = N Items(x);
for (i=1, i<=ncols, i++,
a = Column(i) << Get Name;
show(a);
dt << current data table ();
Eval(
Eval Expr(
Column(dt,Expr(x)) << Set Property(
"Response Limits",
{Goal(Expr(Goal)), Lower(a,b), Middle(c,d), Upper(e,f)});
)
)
);
如果有人能向我解釋循環和匹配部分,我將不勝感激。謝謝
@powerpuff
請不要停止提問!事實上,如果它能幫助您理解腳本等問題,可以提出更多問題。社區成員在回答您的問題時已包含這些內容。 我希望社區可以幫助您進入JMP之旅,以便在不久的將來您可以通過將其轉發給未來的新JMP成員來回報您的好處。
@txnelson 非常感謝您的幫助 。我很抱歉經常發布問題。JMP對我來說真的很新。非常感謝您的幫助。
@powerpuff ,
您在初始描述中列出的腳本似乎是您從其他來源看到的一組代碼,而不是基於處理問題的腳本。
JMP討論社區不是代碼生成器池。 也就是說,下面是您正在處理的問題的工作腳本。
Names Default To Here( 1 );
// Assign pointers to the data table, and limits table,
// using the sample tables you supplied
dt1 = Data Table( "example_limits" );
dt2 = Data Table( "res" );
// Loop through the table with the limits, and add them to the
// data table
For(i=1,i<=n rows(dt2),i++,
eval(
substitute(
expr(
__col__ << set property("Response Limits",
{Goal( __Goal__ ), Importance( __Imp__ ),
Lower( __LVal__, __LDes__ ),
Middle( __MVal__, __MDes__ ),
Upper( __UVal__, __UDes__ ),
Show Limits( 1 )
}
);
),
Expr( __col__ ), Parse( "dt1:" || dt2:ColumnName[i]),
Expr( __Goal__ ), Parse( dt2:Goal[i] ),
Expr( __Imp__ ), dt2:Importance[i],
Expr( __LVal__ ), dt2:Lower[i],
Expr( __LDes__ ), .,
Expr( __MVal__ ), dt2:Middle[i],
Expr( __MDes__ ), .,
Expr( __UVal__ ), dt2:Upper[i],
Expr( __UDes__ ), .,
)
)
);
我再次強烈建議您閱讀“腳本編寫指南”。