<?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: Matrix reshaping in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229528#M2383</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why does Outputx not contain the square matrix Vec2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you are using the VAR clause in the CREATE statement. Use the FROM clause to write a matrix, as discussed in the article &lt;A href="http://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set.html" target="_self"&gt;"Writing data from a matrix to a SAS data set."&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Oct 2015 12:15:26 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-10-12T12:15:26Z</dc:date>
    <item>
      <title>Matrix reshaping</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229247#M2377</link>
      <description>&lt;P&gt;I have a matrix, &lt;EM&gt;x&lt;/EM&gt;, that is numeric and 49X47. The second row contains all missing values. I would like to reshape it to a square matrix that is 47x47 by eliminating the first and second rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SHAPE function isn't working:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x2=shape(x,3:49,47);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting execution errors telling me that the "&lt;EM&gt;argument should be a scalar.&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I resolve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 10:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229247#M2377</guid>
      <dc:creator>xtc283x</dc:creator>
      <dc:date>2015-10-09T10:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix reshaping</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229257#M2378</link>
      <description>&lt;P&gt;The &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/68150/HTML/default/viewer.htm#imlug_langref_sect436.htm" target="_self"&gt;documentation for the SHAPE function&lt;/A&gt;&amp;nbsp;specifies that the second argument should be the number of columns in the result matrix. You are sending in a vector, which is why you are getting an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First use the subscript operator to &amp;nbsp;extract the nonmissing rows, then reshape:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x2 = shape( x[3:49, ], 47 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Oct 2015 12:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229257#M2378</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-10-09T12:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix reshaping</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229264#M2379</link>
      <description>&lt;P&gt;I think the subscript operator alone is suficient here.&amp;nbsp; The shape function does nothing as the reduced&amp;nbsp;matrix already has 47 rows and 47 columns.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 12:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229264#M2379</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2015-10-09T12:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix reshaping</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229527#M2382</link>
      <description>&lt;P&gt;That specification of the &lt;EM&gt;Shape&lt;/EM&gt; function worked. When I print the resulting matrix within IML, it is square. However, when I create output containing that matrix, the output resolves to a vector:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vec2 = the resulting square matrix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;create Outputx var {Vec2};&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;append;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;close Outputx;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;run;*end Proc IML;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Outputx contains a single column with nxn rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why does Outputx not contain the square matrix Vec2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 12:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229527#M2382</guid>
      <dc:creator>xtc283x</dc:creator>
      <dc:date>2015-10-12T12:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix reshaping</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229528#M2383</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why does Outputx not contain the square matrix Vec2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you are using the VAR clause in the CREATE statement. Use the FROM clause to write a matrix, as discussed in the article &lt;A href="http://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set.html" target="_self"&gt;"Writing data from a matrix to a SAS data set."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 12:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-reshaping/m-p/229528#M2383</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-10-12T12:15:26Z</dc:date>
    </item>
  </channel>
</rss>

