<?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: IF/THEN element wise logic in IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191802#M1990</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need the matrix B.&amp;nbsp; Use the CHOOSE function as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Arial',sans-serif; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 14pt; mso-fareast-font-family: 'Times New Roman';"&gt;C = choose(A&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 14pt; background: white; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 14pt; mso-fareast-font-family: 'Times New Roman';"&gt;, A, &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 14pt; background: white; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 14pt; mso-fareast-font-family: 'Times New Roman';"&gt;*A);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information about the CHOOSE function, see &lt;A href="http://blogs.sas.com/content/iml/2011/08/15/complex-assignment-statements-choose-wisely/" title="http://blogs.sas.com/content/iml/2011/08/15/complex-assignment-statements-choose-wisely/"&gt; Complex assignment statements: CHOOSE wisely - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jan 2015 15:13:00 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-01-21T15:13:00Z</dc:date>
    <item>
      <title>IF/THEN element wise logic in IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191801#M1989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Say I have the matrices: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A = { 1 -2 3,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1 1 5,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3 -2 -4};&lt;/P&gt;&lt;P&gt;B = &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; { 0 0 0,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0 0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0 0};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I would like to apply the following logic: If a value of A is less than zero (A&amp;lt;B), then keep the value. If not then double the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is the matrix&lt;/P&gt;&lt;P&gt;C = &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; { 2&amp;nbsp; -2 6,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1 2 10,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6 -2 -4};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can this be done in IML?&amp;nbsp; I am running into issues where the comparison is being treated as an ALL function.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, if I use a statement such as C=A&amp;gt;B then I am returned a matrix of binary values based on the comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 15:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191801#M1989</guid>
      <dc:creator>kellyhobson</dc:creator>
      <dc:date>2015-01-21T15:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: IF/THEN element wise logic in IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191802#M1990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need the matrix B.&amp;nbsp; Use the CHOOSE function as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Arial',sans-serif; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 14pt; mso-fareast-font-family: 'Times New Roman';"&gt;C = choose(A&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 14pt; background: white; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 14pt; mso-fareast-font-family: 'Times New Roman';"&gt;, A, &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 14pt; background: white; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 14pt; mso-fareast-font-family: 'Times New Roman';"&gt;*A);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information about the CHOOSE function, see &lt;A href="http://blogs.sas.com/content/iml/2011/08/15/complex-assignment-statements-choose-wisely/" title="http://blogs.sas.com/content/iml/2011/08/15/complex-assignment-statements-choose-wisely/"&gt; Complex assignment statements: CHOOSE wisely - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 15:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191802#M1990</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-01-21T15:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: IF/THEN element wise logic in IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191803#M1991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you do need to use IF-THEN/ELSE logic on matrices, read this article: &lt;A href="http://blogs.sas.com/content/iml/2015/01/26/if-then-matrix/" title="http://blogs.sas.com/content/iml/2015/01/26/if-then-matrix/"&gt; IF-THEN logic with matrix expressions - The DO Loop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 14:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IF-THEN-element-wise-logic-in-IML/m-p/191803#M1991</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-01-28T14:23:54Z</dc:date>
    </item>
  </channel>
</rss>

