<?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: How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end; in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7150#M7144</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use a format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;/P&gt;&lt;P&gt;DO A = 1 TO 10;&lt;/P&gt;&lt;P&gt;OUTPUT;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC FORMAT ;&lt;/P&gt;&lt;P&gt;VALUE RATING&lt;/P&gt;&lt;P&gt;LOW - 3&amp;nbsp; = "LOW"&lt;/P&gt;&lt;P&gt;4-6&amp;nbsp; = "MEDIUM"&lt;/P&gt;&lt;P&gt;7 - HIGH = "HIGH";&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET HAVE;&lt;/P&gt;&lt;P&gt;&amp;nbsp; B = PUT(A,RATING.);&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or Using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ATTRIB C LENGTH = $6;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET HAVE;&lt;/P&gt;&lt;P&gt;/* B = PUT(A,RATING.);*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF A &amp;lt;= 3 THEN C = "LOW";&lt;/P&gt;&lt;P&gt;&amp;nbsp; ELSE IF 4 &amp;lt;= A &amp;lt;= 6 THEN C = "MEDIUM";&lt;/P&gt;&lt;P&gt;&amp;nbsp; ELSE C = "HIGH";&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jul 2013 08:53:02 GMT</pubDate>
    <dc:creator>scott_mitchell</dc:creator>
    <dc:date>2013-07-22T08:53:02Z</dc:date>
    <item>
      <title>How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end;</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7149#M7143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to be able, in a scripted formula, to assign a text string to column depending onthe values of another column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; B&lt;/P&gt;&lt;P&gt;1&amp;nbsp; Low&lt;/P&gt;&lt;P&gt;2&amp;nbsp; Low&lt;/P&gt;&lt;P&gt;3&amp;nbsp; Low&lt;/P&gt;&lt;P&gt;4&amp;nbsp; Medium&lt;/P&gt;&lt;P&gt;5&amp;nbsp; Medium&lt;/P&gt;&lt;P&gt;6&amp;nbsp; Medium&lt;/P&gt;&lt;P&gt;7&amp;nbsp; High&lt;/P&gt;&lt;P&gt;8&amp;nbsp; High&lt;/P&gt;&lt;P&gt;9&amp;nbsp; High&lt;/P&gt;&lt;P&gt;10 High&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How does the formula lok for this?&amp;nbsp; If(:A&amp;lt;=3,"Low",:A&amp;gt;=3 and :A&amp;lt;7,"Medium",:A&amp;gt;=7,"High") does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Base SAS there is a command, &lt;EM&gt;select(); when();when(); ; ; otherwise;end;&lt;/EM&gt; It is the equivalent of this I am looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Poul Ravn Sørensen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 08:24:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7149#M7143</guid>
      <dc:creator>poulravn</dc:creator>
      <dc:date>2013-07-22T08:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end;</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7150#M7144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use a format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;/P&gt;&lt;P&gt;DO A = 1 TO 10;&lt;/P&gt;&lt;P&gt;OUTPUT;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC FORMAT ;&lt;/P&gt;&lt;P&gt;VALUE RATING&lt;/P&gt;&lt;P&gt;LOW - 3&amp;nbsp; = "LOW"&lt;/P&gt;&lt;P&gt;4-6&amp;nbsp; = "MEDIUM"&lt;/P&gt;&lt;P&gt;7 - HIGH = "HIGH";&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET HAVE;&lt;/P&gt;&lt;P&gt;&amp;nbsp; B = PUT(A,RATING.);&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or Using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ATTRIB C LENGTH = $6;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET HAVE;&lt;/P&gt;&lt;P&gt;/* B = PUT(A,RATING.);*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF A &amp;lt;= 3 THEN C = "LOW";&lt;/P&gt;&lt;P&gt;&amp;nbsp; ELSE IF 4 &amp;lt;= A &amp;lt;= 6 THEN C = "MEDIUM";&lt;/P&gt;&lt;P&gt;&amp;nbsp; ELSE C = "HIGH";&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 08:53:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7150#M7144</guid>
      <dc:creator>scott_mitchell</dc:creator>
      <dc:date>2013-07-22T08:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end;</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7151#M7145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if A &amp;lt;= 3 then B="Low";&lt;/P&gt;&lt;P&gt;else if A &amp;gt; 3 and A &amp;lt;= 6 then B="Medium";&lt;/P&gt;&lt;P&gt;else B="High";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 08:56:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7151#M7145</guid>
      <dc:creator>djchavda</dc:creator>
      <dc:date>2013-07-22T08:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end;</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7152#M7146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sorry. This is the SAS program version, but I was trying to find the JMP Script formula for the same. Should have been more precise. Exactly this example shows how you would sometimes prefer to have a more comprehensive Scripting Guide. I found nothing to help me in the guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Poul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 08:59:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7152#M7146</guid>
      <dc:creator>poulravn</dc:creator>
      <dc:date>2013-07-22T08:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end;</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7153#M7147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Again I am sorry; this works fine in SAS but I am looking for the JMP Formula (based on IF, MATCH or CHOOSE?) that does the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Poul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 09:01:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7153#M7147</guid>
      <dc:creator>poulravn</dc:creator>
      <dc:date>2013-07-22T09:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend the IF command in a formula? Equivalent of select;when;when;otherwise;end;</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7154#M7148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Poul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You've got the right idea, just the wrong logical operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In JSL the AND operator is &amp;amp;. So, your formula should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(:A &amp;lt;= 3, "Low", &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :A &amp;gt;= 3 &amp;amp; :A &amp;lt; 7, "Medium",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :A &amp;gt;= 7, "High")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 13:49:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extend-the-IF-command-in-a-formula-Equivalent-of-select/m-p/7154#M7148</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2013-07-22T13:49:15Z</dc:date>
    </item>
  </channel>
</rss>

