<?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: Column formula: How to correctly combine character columns that have missing entries? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683874#M86953</link>
    <description>&lt;P&gt;I'm not sure how fast it would be, but you could use Associative Array to get rid of all the duplicates. This isn't the cleanest solution but it might work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Set Values({"A", "B", "C", ""})),
	New Column("Column 2", Character, "Nominal", Set Values({"A", "", "", ""})),
	New Column("Column 3", Character, "Nominal", Set Values({"A", "", "C", ""}))
);

dt &amp;lt;&amp;lt; New Column("Col", Character, Nominal, Formula(
	aa = Associative Array(Eval List({:Column 1, :Column 2, :Column 3}));
	(aa &amp;lt;&amp;lt; get keys)[N Items(aa)];
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other option which should work fairly nicely is to find first value which isn't missing and then use that (build a list, use loc to find non-missing index, if one is found use it to get value from list and if not set it as missing)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column("Col2", Character, Nominal, Formula(
	l = Eval List({:Column 1, :Column 2, :Column 3});
	ok_idx = Loc(!Matrix(IsMissing(l)));
	If(N Items(ok_idx) &amp;gt; 0,
		l[ok_idx][1];
	,
		""
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also Concatenate With Space&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1696445571614.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57216i091FE86E5C3CF3CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1696445571614.png" alt="jthi_0-1696445571614.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And then create other column which is First Word&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1696445594387.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57217i41C6517C54EA3C6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1696445594387.png" alt="jthi_1-1696445594387.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1696445608263.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57218i3558AB35AE3333E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1696445608263.png" alt="jthi_2-1696445608263.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Similar thing can be done with Cols/Utilities/Combine Columns and First Word column formula&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2023 18:54:45 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2023-10-04T18:54:45Z</dc:date>
    <item>
      <title>Column formula: How to correctly combine character columns that have missing entries?</title>
      <link>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683857#M86951</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Not sure why I'm having a hard time getting the correct solution to this, but I'm having a hard time combining columns of text when each column has missing entries that are not on the same row -- but all rows are aligned. See the screenshot below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SDF1_0-1696443774209.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57214iC1C930F868118019/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SDF1_0-1696443774209.png" alt="SDF1_0-1696443774209.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; For example, if a row has an entry A or B or C, then if it's within a column, say :C1 or :C2, then the row is the same for both columns. For my data table, I&amp;nbsp;have many text columns, each of them has some missing row entries, see above example. I am trying to use a column formula that uses all the different text entries of :C1 or :C2, to :CN.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I tried using the following column formula, but it doesn't fill in the column when :C1 Is Empty&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SDF1_1-1696443998886.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57215iD06708E2C2101BA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SDF1_1-1696443998886.png" alt="SDF1_1-1696443998886.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I thought the solution would be pretty straightforward, but I'm not finding one, and drawing a blank on how to fix this. The nice thing about this is that for columns :C1 to :CN that I have in my data table, if a row is not empty, then all columns will have the same character for that row. For example, all columns have The entry D for row 4 (unless it's missing). I'd like to end up with a column that has no missing values by using the non-missing entries for each of my :CN columns, like the column above :Correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Hope this makes sense. Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 18:30:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683857#M86951</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2023-10-04T18:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Column formula: How to correctly combine character columns that have missing entries?</title>
      <link>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683873#M86952</link>
      <description>&lt;P&gt;Is Empty() checks to see if the cell exists.&amp;nbsp; You need to to Is Missing()&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 18:53:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683873#M86952</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-04T18:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Column formula: How to correctly combine character columns that have missing entries?</title>
      <link>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683874#M86953</link>
      <description>&lt;P&gt;I'm not sure how fast it would be, but you could use Associative Array to get rid of all the duplicates. This isn't the cleanest solution but it might work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Set Values({"A", "B", "C", ""})),
	New Column("Column 2", Character, "Nominal", Set Values({"A", "", "", ""})),
	New Column("Column 3", Character, "Nominal", Set Values({"A", "", "C", ""}))
);

dt &amp;lt;&amp;lt; New Column("Col", Character, Nominal, Formula(
	aa = Associative Array(Eval List({:Column 1, :Column 2, :Column 3}));
	(aa &amp;lt;&amp;lt; get keys)[N Items(aa)];
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other option which should work fairly nicely is to find first value which isn't missing and then use that (build a list, use loc to find non-missing index, if one is found use it to get value from list and if not set it as missing)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column("Col2", Character, Nominal, Formula(
	l = Eval List({:Column 1, :Column 2, :Column 3});
	ok_idx = Loc(!Matrix(IsMissing(l)));
	If(N Items(ok_idx) &amp;gt; 0,
		l[ok_idx][1];
	,
		""
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also Concatenate With Space&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1696445571614.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57216i091FE86E5C3CF3CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1696445571614.png" alt="jthi_0-1696445571614.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And then create other column which is First Word&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1696445594387.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57217i41C6517C54EA3C6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1696445594387.png" alt="jthi_1-1696445594387.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1696445608263.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57218i3558AB35AE3333E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1696445608263.png" alt="jthi_2-1696445608263.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Similar thing can be done with Cols/Utilities/Combine Columns and First Word column formula&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 18:54:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683874#M86953</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-04T18:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Column formula: How to correctly combine character columns that have missing entries?</title>
      <link>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683885#M86954</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thanks for your quick responses. I decided to go with&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;'s solution -- it was nice and easy. I had it in my head that the conditional Is Missing() only worked on numbers, so I didn't even try that. I knew it should have been relatively simple.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 19:06:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683885#M86954</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2023-10-04T19:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Column formula: How to correctly combine character columns that have missing entries?</title>
      <link>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683910#M86957</link>
      <description>&lt;P&gt;There is a wish to add some aggregation functions for Summary:&lt;/P&gt;&lt;P&gt;&lt;LI-MESSAGE title="Summary and Tabulate: add aggregation option for Character columns" uid="659314" url="https://community.jmp.com/t5/JMP-Wish-List/Summary-and-Tabulate-add-aggregation-option-for-Character/m-p/659314#U659314" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, aggregation over many rows, grouped by other columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps it's worth to add such a character aggregation functionality as well as formula column for multiple columns?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 19:29:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-formula-How-to-correctly-combine-character-columns-that/m-p/683910#M86957</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-05T19:29:11Z</dc:date>
    </item>
  </channel>
</rss>

