<?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: Fill column once per group without repeating values with JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737538#M91868</link>
    <description>&lt;P&gt;Additional option (I usually do these type of "shifts" using Row() == Col Min(Row()) or Row() == Col Max(Row())).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("example 4",
	Add Rows(9),
	Compress File When Saved(1),
	New Column("Y", Character, "Nominal", Set Values({"var1", "var1", "var1", "var2", "var2", "var2", "var3", "var3", "var3"})),
	New Column("test", Character, "Nominal", Set Values({"a", "b", "c", "a", "b", "c", "a", "b", "c"})),
	New Column("test result", Character, "Nominal", Set Values({"pass", "pass", "fail", "fail", "pass", "fail", "pass", "pass", "pass"}))
);

dt &amp;lt;&amp;lt; New Column("Res",	Character, Nominal, Formula(
	If(Row() != Col Min(Row(), :Y),
		"" // not first row fir Y group
	, Col Sum(:test result == "pass", :Y) &amp;gt;= 2,
		"pass"
	, // else
		"fail"
	)
));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Mar 2024 05:52:17 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-03-22T05:52:17Z</dc:date>
    <item>
      <title>Fill column once per group without repeating values with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737440#M91857</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;So I have the below data table.&amp;nbsp; The individual test results are in the "test result" column and indicate if the respective y passes test a,b, and c.&amp;nbsp;The "overall result" column indicates a "pass" if 2 or more of the tests (a,b,c) pass.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able compute the overall result with a formula, but what I would like to do is get a list that says the result once per Y variable-- i.e. overall result = "pass, fail, pass" like the &lt;STRONG&gt;ideal overall result&lt;/STRONG&gt; has. Any ideas??&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abby_Collins14_0-1711058765076.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62500i540A46C29C88BEF2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Abby_Collins14_0-1711058765076.png" alt="Abby_Collins14_0-1711058765076.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;code for dt:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "example",
	Add Rows( 0 ),
	New Column( "Y", character ),
	New Column( "test",character ),
	New Column( "test result",character )
	
)

:Y &amp;lt;&amp;lt; set values( {var1,var1,var1,var2,var2,var2,var3,var3,var3});

:test &amp;lt;&amp;lt; set values( {a,b,c,a,b,c,a,b,c});

:test result&amp;lt;&amp;lt; set values( {pass,pass,fail,fail,pass,fail,pass,pass,pass});

new column("overall result",Formula(if(col sum(test result=="pass",Y)&amp;gt;=2, "Pass", "Fail")));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Mar 2024 22:07:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737440#M91857</guid>
      <dc:creator>Abby_Collins14</dc:creator>
      <dc:date>2024-03-21T22:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fill column once per group without repeating values with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737453#M91858</link>
      <description>&lt;P&gt;Just need a small change to your formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "overall result",
	Formula(
		If(
			Col Cumulative Sum( 1, :Y ) &amp;gt; 1, "",
			Col Sum( test result == "pass", :Y ) &amp;gt;= 2, "Pass",
			"Fail"
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mmarchandTSI_0-1711060120886.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62501i850453544CFDBFC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mmarchandTSI_0-1711060120886.png" alt="mmarchandTSI_0-1711060120886.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 22:28:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737453#M91858</guid>
      <dc:creator>mmarchandTSI</dc:creator>
      <dc:date>2024-03-21T22:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Fill column once per group without repeating values with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737538#M91868</link>
      <description>&lt;P&gt;Additional option (I usually do these type of "shifts" using Row() == Col Min(Row()) or Row() == Col Max(Row())).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("example 4",
	Add Rows(9),
	Compress File When Saved(1),
	New Column("Y", Character, "Nominal", Set Values({"var1", "var1", "var1", "var2", "var2", "var2", "var3", "var3", "var3"})),
	New Column("test", Character, "Nominal", Set Values({"a", "b", "c", "a", "b", "c", "a", "b", "c"})),
	New Column("test result", Character, "Nominal", Set Values({"pass", "pass", "fail", "fail", "pass", "fail", "pass", "pass", "pass"}))
);

dt &amp;lt;&amp;lt; New Column("Res",	Character, Nominal, Formula(
	If(Row() != Col Min(Row(), :Y),
		"" // not first row fir Y group
	, Col Sum(:test result == "pass", :Y) &amp;gt;= 2,
		"pass"
	, // else
		"fail"
	)
));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 05:52:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Fill-column-once-per-group-without-repeating-values-with-JSL/m-p/737538#M91868</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-22T05:52:17Z</dc:date>
    </item>
  </channel>
</rss>

