<?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: Conditionally Delete Columns or Rows from Matrix in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Conditionally-Delete-Columns-or-Rows-from-Matrix/m-p/145942#M1244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suggest modifying the technique in the article &lt;A href="http://blogs.sas.com/content/iml/2010/09/15/removing-observations-with-missing-values/" title="http://blogs.sas.com/content/iml/2010/09/15/removing-observations-with-missing-values/"&gt; Removing Observations with Missing Values - The DO Loop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C = (A&amp;lt;0 | A&amp;gt;1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* matrix of zeros and ones */&lt;/P&gt;&lt;P&gt;count = c[,+];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* add across rows */&lt;/P&gt;&lt;P&gt;keepIdx = loc(count=0);&amp;nbsp; /* rows where all elements are in [0,1] */&lt;/P&gt;&lt;P&gt;if ncol(keepIdx)&amp;gt;0 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; B = A[keepIdx,];&lt;/P&gt;&lt;P&gt;else print "All rows of A are invalid";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Jan 2015 19:16:31 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-01-30T19:16:31Z</dc:date>
    <item>
      <title>Conditionally Delete Columns or Rows from Matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Conditionally-Delete-Columns-or-Rows-from-Matrix/m-p/145941#M1243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking for a way to delete all observations from a matrix based on conditions.&amp;nbsp; For example, if I produced a simulation but subsequently wanted to delete all resulting rows that are less than 0 or greater than 1, how would I do that in IML?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is easy to do in a DATA step, so I can do that, but I was curious regarding an IML approach.&amp;nbsp; (It is probably discussed in Dr. Wicklin's text "Statistical Programming with SAS/IML Software," which I have and will examine, but I thought I would post the question here as it may be a more efficient way to find the answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;A = {0.50 0.50 0.50, -1 0.50 0.50, 2 0.50 0.50|;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B = matrix with rows that contain negative entries or entries greater than 1 removed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The resulting matrix B should consist of {0.50 0.50 0.50} only.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 14:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Conditionally-Delete-Columns-or-Rows-from-Matrix/m-p/145941#M1243</guid>
      <dc:creator>bhfield</dc:creator>
      <dc:date>2015-01-30T14:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally Delete Columns or Rows from Matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Conditionally-Delete-Columns-or-Rows-from-Matrix/m-p/145942#M1244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suggest modifying the technique in the article &lt;A href="http://blogs.sas.com/content/iml/2010/09/15/removing-observations-with-missing-values/" title="http://blogs.sas.com/content/iml/2010/09/15/removing-observations-with-missing-values/"&gt; Removing Observations with Missing Values - The DO Loop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C = (A&amp;lt;0 | A&amp;gt;1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* matrix of zeros and ones */&lt;/P&gt;&lt;P&gt;count = c[,+];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* add across rows */&lt;/P&gt;&lt;P&gt;keepIdx = loc(count=0);&amp;nbsp; /* rows where all elements are in [0,1] */&lt;/P&gt;&lt;P&gt;if ncol(keepIdx)&amp;gt;0 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; B = A[keepIdx,];&lt;/P&gt;&lt;P&gt;else print "All rows of A are invalid";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 19:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Conditionally-Delete-Columns-or-Rows-from-Matrix/m-p/145942#M1244</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-01-30T19:16:31Z</dc:date>
    </item>
  </channel>
</rss>

