<?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: JSL Compare value in row to the next row. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351041#M60071</link>
    <description>&lt;P&gt;Thanks, this could work but it will mark as "Yes" the row 3 (James) and i am trying to mark row 2 (Bari) with a "Yes"&lt;BR /&gt;Any other solution?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2021 11:21:36 GMT</pubDate>
    <dc:creator>ileshem</dc:creator>
    <dc:date>2021-01-20T11:21:36Z</dc:date>
    <item>
      <title>JSL Compare value in row to the next row.</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351000#M60068</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to use "FOR" and "IF" to create a condition column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this table and I want the "Con" column to indicate if the age in the row after is lower then the current row. if yes "1" if not "0"&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;TD&gt;Con&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;David&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bari&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;James&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Lora&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have: (doesn't work)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt&amp;lt;&amp;lt; New Column( "Con", Formula( For( i = 1,i &amp;lt;= N Row( dt ), i++, If(:Age[i] &amp;gt;= :Age[i+1] , "0", "1", ))));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help will be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:03:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351000#M60068</guid>
      <dc:creator>ileshem</dc:creator>
      <dc:date>2023-06-09T22:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Compare value in row to the next row.</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351020#M60069</link>
      <description>&lt;P&gt;Is this what you are after?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Ages",
	Add Rows( 4 ),
	New Column( "Age",
		Numeric,
		"Ordinal",
		Format( "Best", 12 ),
		Set Values( [23, 26, 12, 14] )
	),
	New Column( "Younger than Previous",
		Numeric,
		"Nominal",
		Format( "Best", 12 ),
		Formula( If( :Age &amp;lt; Lag( :Age, 1 ), 1, 0 ) ),
		Value Labels( {0 = "No", 1 = "Yes"} ),
		Use Value Labels( 1 ),
		Set Display Width( 125 )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2021 10:20:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351020#M60069</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-01-20T10:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Compare value in row to the next row.</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351041#M60071</link>
      <description>&lt;P&gt;Thanks, this could work but it will mark as "Yes" the row 3 (James) and i am trying to mark row 2 (Bari) with a "Yes"&lt;BR /&gt;Any other solution?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 11:21:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351041#M60071</guid>
      <dc:creator>ileshem</dc:creator>
      <dc:date>2021-01-20T11:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Compare value in row to the next row.</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351092#M60078</link>
      <description>&lt;P&gt;Here is two ways to do this (Row() and Lag():&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(4),
	Compress File When Saved(1),
	New Column("Name", Character, "Nominal", Set Values({"David", "Bari", "James", "Lora"})),
	New Column("Age", Numeric, "Continuous", Format("Best", 12), Set Values([23, 26, 12, 14])),
	New Column("Con", Numeric, "Continuous", Format("Best", 12), Set Values([0, 1, 0, 0]))
);

dt &amp;lt;&amp;lt; New Column("Younger than Next_Row", Character, "Nominal", 
Formula(If(:Age &amp;gt; :Age[Row() + 1], "Yes", "No")));


dt &amp;lt;&amp;lt; New Column("Younger than Next_Lag", Character, "Nominal", 
	Formula(If(:Age &amp;gt; Lag(:Age, -1), "Yes", "No"))
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2021 16:06:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Compare-value-in-row-to-the-next-row/m-p/351092#M60078</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-01-20T16:06:34Z</dc:date>
    </item>
  </channel>
</rss>

