<?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: Populating a new column using a conditional formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344465#M59422</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;First, make sure that the :Assign Month column is formatted as a Numerical, Continuous Date format; I'm guessing by your use of quotes in your formula indicates that it is not currently the case.&lt;BR /&gt;Second, you do not need to tell JMP to look at each row, it does it by default.&lt;BR /&gt;Third, the formula in the :Prog_ column should simply be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :Column 1 &amp;lt;= Date MDY( 16, 05, 2016 ),
    "A",
    "B"
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Of note, if this is part of a JSL script, the function should be included in the New Column statement (check the Scripting help for the exact syntax.&lt;BR /&gt;Best,&lt;BR /&gt;TS&lt;/P&gt;</description>
    <pubDate>Sun, 03 Jan 2021 22:10:37 GMT</pubDate>
    <dc:creator>Thierry_S</dc:creator>
    <dc:date>2021-01-03T22:10:37Z</dc:date>
    <item>
      <title>Populating a new column using a conditional formula</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344460#M59420</link>
      <description>&lt;P&gt;I am attempting to populate a new column ( :Prog_ ) with either "A" or "B" based upon the value of (:Assign Month).&amp;nbsp; :Assign Month is a numeric, continuous, m/d/y variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below script result in the :Prog_ column being populated but not with the values I am trying to populate the :Prog_ column with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to populate the :Prog_ column rows with an "A" if :Assign Month &amp;lt;= "06/15/2016"&lt;/P&gt;&lt;P&gt;I'd like to populate the :Prog_ column rows with a "B" if :Assign Month is &amp;gt;&amp;nbsp; 06/15/2016"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Here is the script I've tried to use (unsuccessfully) so far:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;DIV&gt;&lt;FONT&gt;CT &amp;lt;&amp;lt; New Column("Prog_", Character);&lt;BR /&gt;For each row(Prog_ = if( Char(Format(:Assign Month,"m/d/y")) &amp;lt;= "06/15/2016", "A", "B" ));&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT&gt;&lt;BR /&gt;CT &amp;lt;&amp;lt; New Column("Prog_", Character);&lt;BR /&gt;For each row(Prog_ = if( :Assign Month &amp;lt;= 06/15/2016, "A", "B" ));&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:01:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344460#M59420</guid>
      <dc:creator>dfusco923</dc:creator>
      <dc:date>2023-06-09T22:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Populating a new column using a conditional formula</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344465#M59422</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;First, make sure that the :Assign Month column is formatted as a Numerical, Continuous Date format; I'm guessing by your use of quotes in your formula indicates that it is not currently the case.&lt;BR /&gt;Second, you do not need to tell JMP to look at each row, it does it by default.&lt;BR /&gt;Third, the formula in the :Prog_ column should simply be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :Column 1 &amp;lt;= Date MDY( 16, 05, 2016 ),
    "A",
    "B"
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Of note, if this is part of a JSL script, the function should be included in the New Column statement (check the Scripting help for the exact syntax.&lt;BR /&gt;Best,&lt;BR /&gt;TS&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 22:10:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344465#M59422</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-01-03T22:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Populating a new column using a conditional formula</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344525#M59428</link>
      <description>&lt;P&gt;Here is how I typically handle this type of issue.&amp;nbsp; The Informat() function converts a a string into a numeric representation of the date, which then can easily be compared to JMP DateTime values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;CT = Current Data Table();
CT &amp;lt;&amp;lt; New Column( "Prog_", Character );
For Each Row( Prog_ = If( :Assign Month &amp;lt;= Informat( "06/15/2016", "mdy" ), "A", "B" ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And to add to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11634"&gt;@Thierry_S&lt;/a&gt;&amp;nbsp; you could avoid the For Each Row() if you created a formula column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;CT = Current Data Table();
CT &amp;lt;&amp;lt; New Column( "Prog_",
	Character,
	formula(
		If( :Assign Month &amp;lt;= Informat( "06/15/2016", "mdy" ),
			"A",
			"B"
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Dec 2020 10:31:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344525#M59428</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-28T10:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Populating a new column using a conditional formula</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344532#M59434</link>
      <description>&lt;P&gt;Your original variable is numeric and represents a JMP date and time value. There is no need to convert it to a formatted character string. You can specify the time threshold directly as a constant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;CT &amp;lt;&amp;lt; New Column( "Prog_", Character );
For Each Row( :Prog_ = If( :Assign Month &amp;lt;= 15Jun2016, "A", "B" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Dec 2020 15:15:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344532#M59434</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-12-28T15:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Populating a new column using a conditional formula</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344689#M59450</link>
      <description>&lt;P&gt;Hello Mark - Thanks for your help with this script!&lt;/P&gt;&lt;P&gt;Dan F.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 03:40:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344689#M59450</guid>
      <dc:creator>dfusco923</dc:creator>
      <dc:date>2020-12-29T03:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Populating a new column using a conditional formula</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344690#M59451</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;for your help with this script!&lt;/P&gt;&lt;P&gt;Dan F.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 03:43:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-a-new-column-using-a-conditional-formula/m-p/344690#M59451</guid>
      <dc:creator>dfusco923</dc:creator>
      <dc:date>2020-12-29T03:43:18Z</dc:date>
    </item>
  </channel>
</rss>

