<?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 How do I Compare Matrices in Proc IML in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614329#M179552</link>
    <description>&lt;P&gt;I would like to compare every row of matrix x (let's say 200 by 29) with each row of matrix y (150,29) one at a time.&lt;/P&gt;&lt;P&gt;So for example row 1 in X compared to rows 1 to 150 in y&amp;nbsp; to see if they both elements equal 1. If yes, set new matrix to 1.&lt;/P&gt;&lt;P&gt;Something like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to 200;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do j=1 to 150;&lt;/P&gt;&lt;P&gt;does x[i,]=y[j,] ? if yes new matrix say z[i,}=1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;z would have 200 rows and 29 columns.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Dec 2019 23:41:44 GMT</pubDate>
    <dc:creator>Sanscrit_2prov</dc:creator>
    <dc:date>2019-12-29T23:41:44Z</dc:date>
    <item>
      <title>How do I Compare Matrices in Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614329#M179552</link>
      <description>&lt;P&gt;I would like to compare every row of matrix x (let's say 200 by 29) with each row of matrix y (150,29) one at a time.&lt;/P&gt;&lt;P&gt;So for example row 1 in X compared to rows 1 to 150 in y&amp;nbsp; to see if they both elements equal 1. If yes, set new matrix to 1.&lt;/P&gt;&lt;P&gt;Something like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to 200;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do j=1 to 150;&lt;/P&gt;&lt;P&gt;does x[i,]=y[j,] ? if yes new matrix say z[i,}=1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;z would have 200 rows and 29 columns.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2019 23:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614329#M179552</guid>
      <dc:creator>Sanscrit_2prov</dc:creator>
      <dc:date>2019-12-29T23:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Compare Matrices in Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614330#M179553</link>
      <description>&lt;P&gt;The question isn't clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;So for example row 1 in X compared to rows 1 to 150 in y to see if they both elements equal 1.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does "if they both elements equal 1" mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;z would have 200 rows and 29 columns.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wouldn't the result be (150*200)x1?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 00:32:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614330#M179553</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-30T00:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Compare Matrices in Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614372#M179572</link>
      <description>&lt;P&gt;Post some data and output you want could better explain your question !!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
x={1 0,
   0 1,
   1 1};
y={1 1,
   1 1};

z=j(nrow(x),1,.);
do i=1 to nrow(x);
  if all(x[i,]=y) then z[i]=1;
end;
print z;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Dec 2019 11:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Compare-Matrices-in-Proc-IML/m-p/614372#M179572</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-30T11:36:47Z</dc:date>
    </item>
  </channel>
</rss>

