<?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: Working on big matrix with proc iml in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425649#M3973</link>
    <description>&lt;P&gt;Two good references for computing with big matrices are&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/04/28/how-much-ram-do-i-need-to-store-that-matrix.html" target="_self"&gt;&amp;nbsp;How much RAM do I need to store that matrix?&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/07/31/large-matrices.html" target="_self"&gt;&amp;nbsp;Large matrices in SAS/IML 14.1&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2013/01/21/reading-big-data.html" target="_self"&gt;Reading big data in the SAS/IML language&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The first reference tells you that a 60 million x 5 matrix requires about 2.2 GB of RAM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second tells you that on Windows PCs, SAS/IML 14.1 (shipped with SAS 9.4M3) supports matrices up to 2^31 elements (about 2&amp;nbsp; billion elements or 16GB). However, you are running SAS 9.4M1.&amp;nbsp; On that release (for Windows), any one matrix is limited to 2GB. Your matrix exceeds 2 GB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your computation is only using one row at a time (and a LAG value) so you can easily do this computation in the DATA step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to stay in in SAS/IML, you can read the data in chunks (for example, 30 million at a time), as shown in the third reference.&lt;/P&gt;
&lt;P&gt;HOWEVER, THE EASIEST way to proceed is to&amp;nbsp;let z = j(xrow, 1, .), rather tha&amp;nbsp;embed x into the first 4 columns of z. You can then compute the elements of z (formerly the 5th column) as a vector. Write z to a data set and then merge it with the original data.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2018 00:19:50 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2018-01-08T00:19:50Z</dc:date>
    <item>
      <title>Working on big matrix with proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425621#M3972</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running into a problem when manipulating an enormous matrix with proc iml. I am on SAS 9.4 TS 1M1. My codes are as followed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;use dnet_new_1;&lt;BR /&gt;read all var{director_id connected_director_id yearb yeare} into x;&lt;BR /&gt;close dnet_new_1;&lt;/P&gt;&lt;P&gt;xrow=nrow(x);&lt;/P&gt;&lt;P&gt;z=shape({.},xrow,5);&lt;BR /&gt;z[,1:4]=x;&lt;BR /&gt;z[1,5]=1;&lt;/P&gt;&lt;P&gt;do i=2 to xrow;&lt;BR /&gt;if x[i,1]^=x[i-1,1] | x[i,2]^=x[i-1,2] then z[i,5]=1;&lt;BR /&gt;else if x[i,3]-x[i-1,4]&amp;lt;=1 then z[i,5]=z[i-1,5];&lt;BR /&gt;else z[i,5]=z[i-1,5]+1;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;create dnet_new2_1 from z;&lt;BR /&gt;append from z;&lt;BR /&gt;close dnet_new2_1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The matrix has&amp;nbsp;59,248,496 rows and 5 columns. I've already used the MEMSIZE option to allocate all possible system memory. It reads the following after I run "proc options option=memsize value;":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Option Value Information For SAS Option MEMSIZE&lt;BR /&gt;Value: 33523975680&lt;BR /&gt;Scope: SAS Session&lt;BR /&gt;How option value set: SAS Session Startup Command Line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nevertheless, I receive the following error message: "ERROR: (execution) Unable to allocate sufficient memory. At least 2147483647 more bytes&amp;nbsp;required. ".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice will be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 20:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425621#M3972</guid>
      <dc:creator>fengyibj</dc:creator>
      <dc:date>2018-01-07T20:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Working on big matrix with proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425649#M3973</link>
      <description>&lt;P&gt;Two good references for computing with big matrices are&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/04/28/how-much-ram-do-i-need-to-store-that-matrix.html" target="_self"&gt;&amp;nbsp;How much RAM do I need to store that matrix?&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/07/31/large-matrices.html" target="_self"&gt;&amp;nbsp;Large matrices in SAS/IML 14.1&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2013/01/21/reading-big-data.html" target="_self"&gt;Reading big data in the SAS/IML language&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The first reference tells you that a 60 million x 5 matrix requires about 2.2 GB of RAM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second tells you that on Windows PCs, SAS/IML 14.1 (shipped with SAS 9.4M3) supports matrices up to 2^31 elements (about 2&amp;nbsp; billion elements or 16GB). However, you are running SAS 9.4M1.&amp;nbsp; On that release (for Windows), any one matrix is limited to 2GB. Your matrix exceeds 2 GB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your computation is only using one row at a time (and a LAG value) so you can easily do this computation in the DATA step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to stay in in SAS/IML, you can read the data in chunks (for example, 30 million at a time), as shown in the third reference.&lt;/P&gt;
&lt;P&gt;HOWEVER, THE EASIEST way to proceed is to&amp;nbsp;let z = j(xrow, 1, .), rather tha&amp;nbsp;embed x into the first 4 columns of z. You can then compute the elements of z (formerly the 5th column) as a vector. Write z to a data set and then merge it with the original data.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 00:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425649#M3973</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-01-08T00:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Working on big matrix with proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425672#M3974</link>
      <description>&lt;P&gt;Thank you Rick for responding to my very first post to the SAS community. Your advice and blogs are so helpful. I really appreciate that.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 03:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Working-on-big-matrix-with-proc-iml/m-p/425672#M3974</guid>
      <dc:creator>fengyibj</dc:creator>
      <dc:date>2018-01-08T03:14:31Z</dc:date>
    </item>
  </channel>
</rss>

