如何根據列引用的變量列表編寫聚合列腳本我有一個需要自動聚合的列列表。 目前,我正在嘗試的是這樣的事情,但沒有產生任何結果。
cols = {:col1, :col2, :col3}
Eval(Eval Expr(
dt << New Column(
Formula(Minimum(Expr(cols))
)
)我還嘗試過交互式生成並保存列公式。 它有效,但給了我
Minimum(:col1, :col2, :col3)
我不知道如何在 JSL 中重新創建。
分享和交流結果回复:如何從列引用的變量列表編寫聚合列腳本您可以嘗試以下兩種方法:
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
cols = dt << Get Column Names( "String" );
col list = {};
For Each( {col}, cols,
If( Ends With( col, "t" ), Insert Into( col list, As Name( col ) ) )
);
Eval( Eval Expr(
dt << New Column( "NEW_COL", "Numeric", <<SET formula=""></SET>Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
cols = dt << Get Column Names( "String" );
col list = Expr( Min() );
For Each( {col}, cols,
If( Ends With( col, "t" ), Insert Into( col list, As Name( col ) ) )
);
Eval( Eval Expr(
dt << New Column( "NEW_COL", "Numeric", <<SET formula=""></SET>回复:如何從列引用的變量列表編寫聚合列腳本我猜測您的初始列名稱列表是什麼樣子,但如果它只是一個不帶引號的列名稱列表,下面的腳本是處理它的唯一方法的示例
Names Default To Here( 1 );
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "/C:/Program Files/SAS/JMPPRO/15/Samples/Data/Big Class.jmp" );
colNames = dt << get column names;
theList = {};
For Each( {col}, colNames,
Show( col );
If( As Column( col ) << get data type == "Numeric",
Insert Into( theList, As Column( col ) << get name )
);
);
theString = Concat Items( theList, ",:" );
Eval( Parse( "dt << new column(\!"test\!",formula(minimum(:" || thestring || ")));" ) );回复:如何從列引用的變量列表編寫聚合列腳本我的實際列表是通過基於用戶輸入的正則表達式匹配來定義的。 該腳本循環訪問數據表的列名列表,並將匹配的列插入到列表中。
For Each ({col}, colNames,
If (condition... Insert Into(list, :Column(col))
)我嘗試將語法更改為:(列(列))但這導致了一份缺失物品的清單,而不是我之前得到的物品( {列(col1),列(col2),...} )。 同樣適用於作為列(col) 。
我正在使用 JMP 16。
回复:如何從列引用的變量列表編寫聚合列腳本請檢查您的列表定義並確保在每個列名稱前面指定“:”。
您使用什麼版本的 JMP?
回复:如何從列引用的變量列表編寫聚合列腳本感謝您及時的回复! 我嘗試了這個,但似乎沒有解決列公式(如 Maximum(Eval(cols)) )。
回复:如何從列引用的變量列表編寫聚合列腳本你好,
試試這個語法:
Names default to Here (1);
dt = Current Data Table ();
cols = {:col1, :col2, :col3};
dt << New Column("TEST", numerical, continuous, << Formula(Minimum(Eval(cols))));
最好的,
TS
回复:如何從列引用的變量列表編寫聚合列腳本這可能會給一些想法在公式中使用列列表
查看更多...