<?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 extract the lower-triangular of a matrix (not in row or column major order) in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493637#M4362</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22174"&gt;@dustychair&lt;/a&gt;. I'm glad to hear it worked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't understand what you mean by "&lt;SPAN&gt;I don't get my matrix's column and rows". Can you be more specific?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Sep 2018 20:49:23 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-09-07T20:49:23Z</dc:date>
    <item>
      <title>How to extract the lower-triangular of a matrix (not in row or column major order)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493267#M4359</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How can I extract lower triangular of a matrix? VECH or SYMSQR functions&amp;nbsp;exports elements in column order but I want exactly the triangular shape.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 04:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493267#M4359</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2018-09-07T04:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the lower-triangular of a matrix (not in row or column major order)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493282#M4360</link>
      <description>&lt;P&gt;Do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;

A={1 2 3 4 7,
   4 5 6 5 3,
   7 8 9 2 5,
   2 5 8 6 1,
   7 9 4 2 9};

UpperIdx = loc(row(A) &amp;lt; col(A));

LowerTr=A;
LowerTr[UpperIdx]=0;

print LowerTr;

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Sep 2018 06:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493282#M4360</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-07T06:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the lower-triangular of a matrix (not in row or column major order)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493635#M4361</link>
      <description>&lt;P&gt;Hi Draycut,&lt;/P&gt;
&lt;P&gt;It worked. When I modify it to my matrix I don't get my matrix's column and rows.What am I missing here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc iml;&lt;BR /&gt;use my_matrix;&lt;/P&gt;
&lt;P&gt;read all var _NUM_ into my_matrix;&lt;BR /&gt;close;&lt;BR /&gt;y=my_matrix;&lt;BR /&gt;UpperIdx = loc(row(my_matrix) &amp;lt; col(my_matrix));&lt;/P&gt;
&lt;P&gt;LowerTr=my_matrix;&lt;BR /&gt;LowerTr[UpperIdx]=0;&lt;/P&gt;
&lt;P&gt;print LowerTr;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 20:47:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493635#M4361</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2018-09-07T20:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the lower-triangular of a matrix (not in row or column major order)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493637#M4362</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22174"&gt;@dustychair&lt;/a&gt;. I'm glad to hear it worked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't understand what you mean by "&lt;SPAN&gt;I don't get my matrix's column and rows". Can you be more specific?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 20:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493637#M4362</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-07T20:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the lower-triangular of a matrix (not in row or column major order)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493643#M4363</link>
      <description>&lt;P&gt;Actually, I'm working on the code you wrote. I have candidates id's in the columns and rows. I want to have candidates id's in the triangular matrix. there is output of results in the attachment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc iml;&lt;BR /&gt;use tr; read all var _ALL_; close tr;&lt;/P&gt;
&lt;P&gt;Cand=unique(Cand_1//Cand_2);&lt;BR /&gt;call sort(Cand);&lt;/P&gt;
&lt;P&gt;X=j(ncol(Cand), ncol(Cand), .);&lt;BR /&gt;do i=1 to nrow(rt);&lt;BR /&gt; X[loc(Cand=Cand_1[i]),loc(Cand=Cand_2[i])]=rt[i];&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;/* replace missing values with 0 */&lt;BR /&gt;missIdx = loc(X=.); /* locations of missing values */&lt;BR /&gt;nonmissIdx = loc(X^= ); /* locations of nonmissing values */&lt;BR /&gt;X[missIdx] = 0.5; /* replace missing with 0 */&lt;BR /&gt;Z = X; /* make a copy */&lt;BR /&gt;Z[nonmissIdx] = .; /* replace orig probs with missing */&lt;BR /&gt;X = X + Z`; /* use missing values for lower triangular probabilities */&lt;/P&gt;
&lt;P&gt;print X[colName=((Cand)) rowName=((Cand))];&lt;/P&gt;
&lt;P&gt;create matrix from X [colname=Cand rowname=Cand];&lt;BR /&gt;append from X[rowname=Cand];&lt;BR /&gt;close;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc iml;&lt;BR /&gt;use matrix;&lt;/P&gt;
&lt;P&gt;read all var _NUM_ into matrix;&lt;BR /&gt;close;&lt;BR /&gt;y=matrix;&lt;BR /&gt;UpperIdx = loc(row(matrix) &amp;lt; col(matrix));&lt;/P&gt;
&lt;P&gt;LowerTr=matrix;&lt;BR /&gt;LowerTr[UpperIdx]=0;&lt;/P&gt;
&lt;P&gt;print LowerTr;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493643#M4363</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2018-09-07T21:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the lower-triangular of a matrix (not in row or column major order)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493741#M4364</link>
      <description>&lt;P&gt;On the READ statement, use the ROWNAME= option to also read the IDs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use matrix;
read all var _NUM_ into matrix[rowname=Cand];
close;

UpperIdx = loc(row(matrix) &amp;lt; col(matrix));
LowerTr=matrix;
LowerTr[UpperIdx]=0;
print LowerTr[rowname=Cand colname=Cand];

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Sep 2018 11:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-extract-the-lower-triangular-of-a-matrix-not-in-row-or/m-p/493741#M4364</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-09-08T11:47:01Z</dc:date>
    </item>
  </channel>
</rss>

