<?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 Re: Consolidating Rows and Deleting Blank Data in JMP13 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83568#M37608</link>
    <description>&lt;P&gt;If the data are numeric, excluding the first column, then you can just use&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Tables==&amp;gt;Summary&lt;/P&gt;
&lt;P&gt;and specify to generate a mean or a sum for the columns in question&lt;/P&gt;</description>
    <pubDate>Fri, 16 Nov 2018 15:55:47 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-11-16T15:55:47Z</dc:date>
    <item>
      <title>Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83560#M37603</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is twofold. My data appear something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1-A&lt;/TD&gt;&lt;TD&gt;x&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-A&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;z&lt;/TD&gt;&lt;TD&gt;q&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-A&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-B&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-B&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;t&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-B&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;q&lt;/TD&gt;&lt;TD&gt;p&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to A) delete the empty data points and B) consildate the rows according to the identifier in the first column that each row has in common (i.e. 1-A and 2-B).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like my end result to look like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1-A&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;z&lt;/TD&gt;&lt;TD&gt;q&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-B&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;t&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;q&lt;/TD&gt;&lt;TD&gt;p&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions about approaching this issue for a large table with hundreds of values?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Charlie&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 15:09:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83560#M37603</guid>
      <dc:creator>cfsaylor</dc:creator>
      <dc:date>2018-11-16T15:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83562#M37605</link>
      <description>&lt;P&gt;The most painless way to do this would be to:&lt;BR /&gt;&lt;BR /&gt;1. Stack all those columns except for the ID column so that they are all consolidated into a single data column (resulting Label column maintains traceability).&lt;BR /&gt;&lt;BR /&gt;2. Delete all rows with missing values in the new data column. Easy way: select a missing value &amp;gt; right-click on it &amp;gt; select matching cells &amp;gt; right-click &amp;gt; delete rows.&lt;BR /&gt;&lt;BR /&gt;3. Do a table split to return to original shape of the data table. Split column is the new data column. Split By is the new label column, and you can group by the ID column.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 15:58:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83562#M37605</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-11-16T15:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83564#M37607</link>
      <description>&lt;P&gt;Thank you for the prompt reply. I should add that I've glossed over much of the detail in my actual table -- for example, when I attempt Step #1, JMP tells me "Cannot stack. Stacked columns are of different data type".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to stack columns of a various data type?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 15:37:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83564#M37607</guid>
      <dc:creator>cfsaylor</dc:creator>
      <dc:date>2018-11-16T15:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83568#M37608</link>
      <description>&lt;P&gt;If the data are numeric, excluding the first column, then you can just use&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Tables==&amp;gt;Summary&lt;/P&gt;
&lt;P&gt;and specify to generate a mean or a sum for the columns in question&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 15:55:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83568#M37608</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-11-16T15:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83571#M37610</link>
      <description>&lt;P&gt;Unfortunately the data are mixed: categorical, binary, numeric, free text. I am looking to simplify the database and remove unnecessary blank entries. Thank you for the suggestion, but I don't believe that it will work for this scenario.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:02:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83571#M37610</guid>
      <dc:creator>cfsaylor</dc:creator>
      <dc:date>2018-11-16T16:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83576#M37612</link>
      <description>&lt;P&gt;If you don't have too many columns, you could make them all character first, use the steps I recommended, and then convert the numeric columns back.&amp;nbsp;&amp;nbsp;If your table is much wider than your example, this may not be very feasible.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:07:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83576#M37612</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-11-16T16:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83578#M37614</link>
      <description>&lt;P&gt;Unfortunately this table has &amp;gt;1000 columns. Thank you for the suggestion, but that does not seem feasible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, suppose I wanted to ignore the blank data and attend to them at a later date. How would I consolidate the rows?&amp;nbsp;Hopefully that step is more feasible.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:11:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83578#M37614</guid>
      <dc:creator>cfsaylor</dc:creator>
      <dc:date>2018-11-16T16:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating Rows and Deleting Blank Data in JMP13</title>
      <link>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83587#M37623</link>
      <description>&lt;P&gt;Time for the big guns.&amp;nbsp; Here's a script that should work.&amp;nbsp; Basically the way it works is by iterating through all the rows and columns.&amp;nbsp; If the next row has the same ID, it passes down the non-missing values to the next row.&amp;nbsp; By the last row for a given ID, all non-missing values should be in that row.&amp;nbsp; In the last step, you delete all the extra rows.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column( "Delete Later", character, formula( If( :ID[Row()] == :ID[Row() + 1], "Yes", "No" ) ) );
for(i=1,i&amp;lt;=N Row(dt),i++, //iterate through each row
	//If next row has same ID, pass non-missing values down to next row
	If(:Delete Later[i] == "Yes",
		for(j=2,j&amp;lt;= (N Col(dt) - 1),j++, //iterate through each column (except ID and Delete Later)
			//pass non-missing data down to next row
			if(!isMissing(Column(dt,j)[i]), Column(dt,j)[i+1] = Column(dt,j)[i])
		)
	)
);

//Collapse all the extra rows
dt &amp;lt;&amp;lt; Select Where(:Delete Later == "Yes") &amp;lt;&amp;lt; Delete Rows();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This worked perfectly for your example.&amp;nbsp; It should work for your table, though if you have millions of rows, it could take a good long while to finish.&amp;nbsp; This script also assumes the column is named "ID" and all other columns should have non-missing values for only 1 row for each ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting table I used to test the script:&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="StartingTable.PNG" style="width: 915px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14376i529896BC39111850/image-size/large?v=v2&amp;amp;px=999" role="button" title="StartingTable.PNG" alt="StartingTable.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final Table:&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Collapsed Table.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14377i4F81BD9FD8189659/image-size/large?v=v2&amp;amp;px=999" role="button" title="Collapsed Table.PNG" alt="Collapsed Table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script to recreate my starting table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "ConsolidateTable",
	Add Rows( 6 ),
	New Column( "ID",
		Character( 3 ),
		"Nominal",
		Set Values( {"1-A", "1-A", "1-A", "2-B", "2-B", "2-B"} ),
		Set Display Width( 87 )
	),
	New Column( "Column 2",
		Character( 16 ),
		"Nominal",
		Set Values( {"x", "", "", "y", "", ""} ),
		Set Display Width( 87 )
	),
	New Column( "Column 3",
		Character( 16 ),
		"Nominal",
		Set Values( {"y", "", "", "w", "", ""} ),
		Set Display Width( 87 )
	),
	New Column( "Column 4",
		Character( 16 ),
		"Nominal",
		Set Values( {"", "z", "", "", "t", ""} ),
		Set Display Width( 87 )
	),
	New Column( "Column 5",
		Character( 16 ),
		"Nominal",
		Set Values( {"", "q", "", "", "y", ""} ),
		Set Display Width( 87 )
	),
	New Column( "Column 6",
		Character( 16 ),
		"Nominal",
		Set Values( {"", "", "w", "", "", "q"} ),
		Set Display Width( 87 )
	),
	New Column( "Column 7",
		Character( 16 ),
		"Nominal",
		Set Values( {"", "", "w", "", "", "p"} ),
		Set Display Width( 87 )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:58:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Consolidating-Rows-and-Deleting-Blank-Data-in-JMP13/m-p/83587#M37623</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-11-16T16:58:39Z</dc:date>
    </item>
  </channel>
</rss>

