我对调查问题进行了 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,你不知道你帮我节省了多少时间。向您致敬,先生!