我對調查問題進行了 LCA 分析。在產生的報告的“參數估計”部分中,有一個表格。當我導出它時,它不會導出頂部的合併單元格。例如:
第 1 組:[上欄:州]
[AZ] [VA]、[DC]、[TX]
它僅導出群集以及 [AZ] [VA]、[DC]、[TX] 的參數估計。我想匯出所有可見的內容,包括帶有合併儲存格的頂列。
我希望社區中有人能提供比我提出的更好的解決方案。我不知道將跨越標題添加到輸出資料表中的列標題的直接方法。不過,我已經編寫了一個範例腳本,可以執行您想要的操作。
它需要 LCA 分析輸出

並輸出參數估計表,每列都帶有 Spanning Headers 前綴

這是一個範例腳本
Names Default To Here( 1 );
// Run a LCA
dt = Open( "$SAMPLE_DATA/Car Poll.jmp" );
dt << Latent Class Analysis(
Y( :sex, :marital status, :country, :size, :type ),
Set Random Seed( 12345 ),
Number of Clusters( 3 ),
);
// Create an output table will all header names in each column's name
obj = current report()[OutlineBox(1)];
// Get the number of tiles that span across columns
numSpans = Length( (obj << xpath( "//ColSpanBox" )) );
// Loop across the spanning titles and add the title as a prefix to the column name
For( span = 1, span <= numSpans, span++,
// Get the header
theHeading = obj["Parameter Estimates"][Col Span Box( span )] << get heading;
// Get the column names for the current spanning header
theCols = obj["Parameter Estimates"][Col Span Box( span )] << get text;
// Loop across each column name in the span
subColNum = 1;
While( Try( Word( subColNum, theCols, "\!n\!t\!r" ), "" ) != "",
targetCol = Word( subColNum, theCols, "\!n\!t\!r" );
// Loop across all numeric column and when a match is found change the column name
numCol = 2;
While(
Try( obj["Parameter Estimates"][Number Col Box( numCol )] << get heading, "" )
!= "",
theNumberColBoxHeader = obj["Parameter Estimates"][Number Col Box( numCol )]
<< get heading;
If( targetCol == theNumberColBoxHeader,
obj["Parameter Estimates"][Number Col Box( numCol )] <<
set heading( theHeading || " " || targetCol )
);
numCol++;
);
subColNum++;
);
);
// Create the output data table
obj["Parameter Estimates", Table Box( 1 )] << Make into data table;
這令人印象深刻@txnelson,你不知道你幫我省了多少時間。向您致敬,先生!