回复:JMP 16:使用相對引用使用公式添加列的腳本謝謝馬克! 工作起來很有魅力!
做了一些調整,把它留在這里以備將來參考。 多謝!
Names Default to Here( 1 );
// mock up user data table
dt = New Table( "Mock Up" );
For( c = 1, c < 6, c++,
col = dt << New Column( "My Column " || Char( c ), Numeric, Continuous );
col << Set Values( J( 25, 1, Random Normal( 80, 5 ) ) );
);
y = dt << Get As Matrix;
col = dt << New Column( "Total", Numeric, Continuous );
col << Set Values( y * J( 5, 1, 1 ) );
// solution
dt = Current Data Table();
total = Column( N Col( dt ) ) << Get As Matrix;
last c = N Col( dt );
For( c = 1, c < last c, c++,
dt << New Column( "Relative " || (Column( c ) << Get Name), Numeric, Continuous,
Formula( :As Column( c ) /:Total )
);
);
回复:JMP 16:使用相對引用使用公式添加列的腳本看這個例子:
Names Default to Here( 1 );
// mock up user data table
dt = New Table( "Mock Up" );
For( c = 1, c < 6, c++,
col = dt << New Column( "My Column " || Char( c ), Numeric, Continuous );
col << Set Values( J( 25, 1, Random Normal( 80, 5 ) ) );
);
y = dt << Get As Matrix;
col = dt << New Column( "Total", Numeric, Continuous );
col << Set Values( y * J( 5, 1, 1 ) );
// solution
dt = Current Data Table();
total = Column( N Col( dt ) ) << Get As Matrix;
last c = N Col( dt );
For( c = 1, c < last c, c++,
dt << New Column( "Relative " || (Column( c ) << Get Name), Numeric, Continuous,
Values( (Column( c ) << Get Values) :\</img> total )
);
);
JMP 16:使用相對引用添加帶有公式的列的腳本你好,
嘗試在 JMP 中編寫我的第一個腳本,非常感謝您的幫助。
我有 10 列(比如說一、二、三、四、五、六、七、八、九、十)和一個總計列。
我需要再添加十列來計算前十列的百分比。 我不能使用列名,因為我實際上有 150 列,並且列名都不同。
我如何添加一個新列並每次將公式中的列前進 1
例如 :
創建新列第 11 列
填寫公式“第 1 列/總計”
將列名稱設置為“pct_one”
創建新列第 12 列
填寫公式“第 2 列 / 總計”
將列名稱設置為“pct_two”
。
。
。
繼續 10 列。
提前致謝!
消費者和市場研究質量和工藝工程視窗