<?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: Help with an if statement in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409291#M65906</link>
    <description>&lt;P&gt;Thanks for the answer! As the various scripting guides show, it should be the right thing yet it did not work here. I assume something was wrong with the data table and all the processing I already did on these variables. Eventually, the workaround was to concatenate the two nominal columns to one and then recode the expressions I got there to the desired outcomes. Thanks again.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Aug 2021 19:18:31 GMT</pubDate>
    <dc:creator>mrosenthal</dc:creator>
    <dc:date>2021-08-12T19:18:31Z</dc:date>
    <item>
      <title>Help with an if statement</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/408329#M65825</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am probably missing something basic here. I am trying to change a column's values by using a combination of two other column values. I type in the following if statement and the column values do not change. What am I missing here? Thanks for any tips and advice.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "20210811Miflezet_CAPCMP.jmp" );
dt &amp;lt;&amp;lt; Begin Data Update;
If( :justice_decision_REC_RILE2 == "reject" &amp;amp; :RILE_Calc2a == "center"
,
	 :Rile_Calc3 == "center"
	 ,
	:justice_decision_REC_RILE2 == "accept" &amp;amp; :RILE_Calc2a == "center"
	,
	 :Rile_Calc3 == "center"
	 ,
	:justice_decision_REC_RILE2 == "reject" &amp;amp; :RILE_Calc2a == "left"
	,
	 :Rile_Calc3 == "right"
	 ,
	:justice_decision_REC_RILE2 == "accept" &amp;amp; :RILE_Calc2a == "left"
	,
	:Rile_Calc3 == "left"
	,
	:justice_decision_REC_RILE2 == "reject" &amp;amp; :RILE_Calc2a == "right"
	,
	:Rile_Calc3 == "left"
	,
	:justice_decision_REC_RILE2 == "accept" &amp;amp; :RILE_Calc2a == "right"
	,
	:Rile_Calc3 == "right"
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:35:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/408329#M65825</guid>
      <dc:creator>mrosenthal</dc:creator>
      <dc:date>2023-06-10T23:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help with an if statement</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/408335#M65827</link>
      <description>&lt;P&gt;You could use either For Each Row or Set Each Value. Below is an example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
For Each Row(
	If(:sex == "F",
		:age = .
	);
);

dt:weight &amp;lt;&amp;lt; Set Each Value(
	If(:sex == "M",
		.,
		:height
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Aug 2021 16:13:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/408335#M65827</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-08-10T16:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with an if statement</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409291#M65906</link>
      <description>&lt;P&gt;Thanks for the answer! As the various scripting guides show, it should be the right thing yet it did not work here. I assume something was wrong with the data table and all the processing I already did on these variables. Eventually, the workaround was to concatenate the two nominal columns to one and then recode the expressions I got there to the desired outcomes. Thanks again.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 19:18:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409291#M65906</guid>
      <dc:creator>mrosenthal</dc:creator>
      <dc:date>2021-08-12T19:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with an if statement</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409321#M65909</link>
      <description>&lt;P&gt;In your original JSL you probably ( edit: also ) want to change&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Rile_Calc3 == "center"&amp;nbsp;//&amp;nbsp;compare.&amp;nbsp;the&amp;nbsp;result&amp;nbsp;of&amp;nbsp;the&amp;nbsp;compare (0 or 1)&amp;nbsp;will&amp;nbsp;be&amp;nbsp;the&amp;nbsp;result&amp;nbsp;of&amp;nbsp;the&amp;nbsp;if(),&amp;nbsp;see&amp;nbsp;below&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Rile_Calc3 = "center"&amp;nbsp;//&amp;nbsp;assign&amp;nbsp;value&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;JSL if statements return a value; you could write it as&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Rile_Calc3 = If( 
   :justice_decision_REC_RILE2 == "reject" &amp;amp; :RILE_Calc2a == "center",  "center",
   :justice_decision_REC_RILE2 == "accept" &amp;amp; :RILE_Calc2a == "center",  "center",
   :justice_decision_REC_RILE2 == "reject" &amp;amp; :RILE_Calc2a == "left",  "right",
   :justice_decision_REC_RILE2 == "accept" &amp;amp; :RILE_Calc2a == "left", "left",
   :justice_decision_REC_RILE2 == "reject" &amp;amp; :RILE_Calc2a == "right", "left",
   :justice_decision_REC_RILE2 == "accept" &amp;amp; :RILE_Calc2a == "right", "right",
   :Rile_Calc3 // or "Unknown" ? depends how you want to handle the unexpected case.
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you know there are no unexpected cases, you can omit the final otherwise clause. But the nature of unexpected cases is to show up when least expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;LI-MESSAGE title="If Secrets" uid="39558" url="https://community.jmp.com/t5/Uncharted/If-Secrets/m-p/39558#U39558" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 02:01:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409321#M65909</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-08-13T02:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with an if statement</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409343#M65912</link>
      <description>&lt;P&gt;That actually worked. I did one small tweak using&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;'s post and did small changes in &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;'s code. The final format that worked for me was this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Data Table( "20210812Miflezet_CAPCMP.jmp" );
For Each Row(
 If( 
  :just_dec_rec == "reject" &amp;amp; :RILE_Rec == "center",  :RILE4="center",
   :just_dec_rec == "accept" &amp;amp; :RILE_Rec == "center", :RILE4= "center",
   :just_dec_rec == "reject" &amp;amp; :RILE_Rec == "left", :RILE4= "right",
   :just_dec_rec == "accept" &amp;amp; :RILE_Rec == "left", :RILE4="left",
   :just_dec_rec == "reject" &amp;amp; :RILE_Rec == "right", :RILE4="left",
   :just_dec_rec == "accept" &amp;amp; :RILE_Rec == "right", :RILE4="right"
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Aug 2021 06:05:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-an-if-statement/m-p/409343#M65912</guid>
      <dc:creator>mrosenthal</dc:creator>
      <dc:date>2021-08-13T06:05:09Z</dc:date>
    </item>
  </channel>
</rss>

