<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Exporting full LCA dataset to CSV/Excel in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/721893#M90376</link>
    <description>&lt;P&gt;I conducted an LCA analysis on survey questions. In the "parameter estimates" section of the generated report, there is a table. When I export it, it doesn't export the merged cells on top. For example:&lt;BR /&gt;&lt;BR /&gt;Cluster 1:&amp;nbsp; [Top Column: State]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[AZ] [VA], [DC], [TX]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It only exports the cluster, and the parameter estimates for&amp;nbsp;[AZ] [VA], [DC], [TX]. I want to export every visible thing, including the top column with merged cells.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 04 Feb 2024 21:54:35 GMT</pubDate>
    <dc:creator>WeightedColt463</dc:creator>
    <dc:date>2024-02-04T21:54:35Z</dc:date>
    <item>
      <title>Exporting full LCA dataset to CSV/Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/721893#M90376</link>
      <description>&lt;P&gt;I conducted an LCA analysis on survey questions. In the "parameter estimates" section of the generated report, there is a table. When I export it, it doesn't export the merged cells on top. For example:&lt;BR /&gt;&lt;BR /&gt;Cluster 1:&amp;nbsp; [Top Column: State]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[AZ] [VA], [DC], [TX]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It only exports the cluster, and the parameter estimates for&amp;nbsp;[AZ] [VA], [DC], [TX]. I want to export every visible thing, including the top column with merged cells.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 21:54:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/721893#M90376</guid>
      <dc:creator>WeightedColt463</dc:creator>
      <dc:date>2024-02-04T21:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting full LCA dataset to CSV/Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/721949#M90380</link>
      <description>&lt;P&gt;I hope someone in the Community has a better solution than what I have come up with.&amp;nbsp; I am not aware of a direct way to add the spanning headers to the column headers in an output data table.&amp;nbsp; However I have written an example script that can do what you want.&lt;/P&gt;
&lt;P&gt;It takes an LCA analysis output&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1707103154843.png" style="width: 644px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60852iD4BFB70BBF9D5E2A/image-dimensions/644x413?v=v2" width="644" height="413" role="button" title="txnelson_0-1707103154843.png" alt="txnelson_0-1707103154843.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and output the Parameter Estimates table with the Spanning Headers prefixed to each column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_2-1707103752206.png" style="width: 851px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60854i9A0B109DEE6437DB/image-dimensions/851x120?v=v2" width="851" height="120" role="button" title="txnelson_2-1707103752206.png" alt="txnelson_2-1707103752206.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the example script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Run a LCA
dt = Open( "$SAMPLE_DATA/Car Poll.jmp" );
dt &amp;lt;&amp;lt; 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  &amp;lt;&amp;lt; xpath( "//ColSpanBox" )) );

// Loop across the spanning titles and add the title as a prefix to the column name
For( span = 1, span &amp;lt;= numSpans, span++,
	// Get the header
	theHeading = obj["Parameter Estimates"][Col Span Box( span )] &amp;lt;&amp;lt; get heading;
	// Get the column names for the current spanning header
	theCols = obj["Parameter Estimates"][Col Span Box( span )] &amp;lt;&amp;lt; 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 )] &amp;lt;&amp;lt; get heading, "" )
			 != "",
			theNumberColBoxHeader = obj["Parameter Estimates"][Number Col Box( numCol )]
			 &amp;lt;&amp;lt; get heading;
			If( targetCol == theNumberColBoxHeader,
				obj["Parameter Estimates"][Number Col Box( numCol )] &amp;lt;&amp;lt;
				set heading( theHeading || " " || targetCol )
			);
			numCol++;
		);
		subColNum++;
	);
);

// Create the output data table
obj["Parameter Estimates", Table Box( 1 )] &amp;lt;&amp;lt; Make into data table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 03:30:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/721949#M90380</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-02-05T03:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting full LCA dataset to CSV/Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/722171#M90416</link>
      <description>&lt;P&gt;That is impressive&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;you have no idea how much time you have helped me save. Kudos to you, sir!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 20:18:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Exporting-full-LCA-dataset-to-CSV-Excel/m-p/722171#M90416</guid>
      <dc:creator>WeightedColt463</dc:creator>
      <dc:date>2024-02-05T20:18:24Z</dc:date>
    </item>
  </channel>
</rss>

