有沒有一種有效的方法來進行這種循環聚合?使用大類形式:
1. 從第 20 行開始,提取該行到前 19 行的數據子集。
2. 根據年齡對這個子集進行分類,並彙總身高和體重。並一一串聯匯總結果。
謝謝!
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
j = 1;
For( j = 20, j <= N Row( dt ), j++,
dt << Select Where( j - 20 < Row() <= j );
d3 = dt << Subset( Output Table( "tab" ), Selected Rows( 1 ), selected columns( 0 ) );
d1 = d3 << Summary(
Sum( height ),
Sum( weight ),
Subgroup( age ),
Freq( 0 ),
Weight( 0 ),
Link to original data table( 0 ),
statistics column name format( "column" )
);
If( j == 20,
d2 = d1;
d2 << setName( "tmp" );
,
Current Data Table( d2 );
d2 << Concatenate( Data Table( d1 ), Append to first table );
Close( d1, nosave );
);
Close( d3, nosave );
);
自動化和腳本編寫視窗回复:有沒有一種有效的方法來進行這種循環聚合?按照您現在的方式構建 JSL,您就可以利用一些不錯的 JMP 功能。編寫 JSL 來創建所需的輸出需要大量編碼。下面,我對您的腳本做了一些細微的調整,這可能會給您帶來更高效的腳本。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
d2 = New Table( "tmp" );
k = 1;
For( k = 20, k <= N Row( dt ), k++,
dt << Select Where( k - 20 < Row() <= k );
d3 = dt << Subset( Output Table( "tab" ), Selected Rows( 1 ), selected columns( 0 ), private );
d1 = d3 << Summary(
Sum( height ),
Sum( weight ),
Subgroup( age ),
Freq( 0 ),
Weight( 0 ),
Link to original data table( 0 ),
statistics column name format( "column" )
);
d2 << Concatenate( Data Table( d1 ), Append to first table );
Close( d1, nosave );
Close( d3, nosave );
);
我將索引變量的名稱更改為“j”。這是為了避免可能出現的混亂。JMP 有一個名為 j() 的函數。更好的做法是避免同時使用名為“j”的變量。
回复:有沒有一種有效的方法來進行這種循環聚合?謝謝吉姆!
我想用JMP快速計算出每隻股票在不同周期的籌碼峰值。計算量太大。
回复:有沒有一種有效的方法來進行這種循環聚合?ar=[];ar=J(r,c,0);