<?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 with arbitrary (open) dimension in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131530#M1037</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right. An example of this situation is in this article:&lt;A href="http://blogs.sas.com/content/iml/2012/11/14/efficient-acceptance-rejection-simulation-in-a-vector-language/" title="http://blogs.sas.com/content/iml/2012/11/14/efficient-acceptance-rejection-simulation-in-a-vector-language/"&gt;&amp;nbsp; Efficient acceptance-rejection simulation - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Some people append to a matrix within a loop (see &lt;A href="http://blogs.sas.com/content/iml/2011/06/20/pre-allocate-arrays-to-improve-efficiency/" title="http://blogs.sas.com/content/iml/2011/06/20/pre-allocate-arrays-to-improve-efficiency/"&gt; Pre-allocate arrays to improve efficiency - The DO Loop&lt;/A&gt;), but that is inefficient so I try to allocate the matrix as large as it might be, and then fill only the rows that are actually used. As you say, trim the rest, like this:&lt;/P&gt;&lt;P&gt;x = j(100, 1, .); /* use missing values to mark unused rows */&lt;/P&gt;&lt;P&gt;do i = 1 to 10;&lt;/P&gt;&lt;P&gt;/* do something that fills 85% of the rows */&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;x = remove(x, loc(x=.));&amp;nbsp; /* remove and missing values */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Sep 2013 09:36:16 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2013-09-07T09:36:16Z</dc:date>
    <item>
      <title>Matrix with arbitrary (open) dimension</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131529#M1036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt;"&gt;I might create a matrix through a process, but I don't know its dimension beforehand. As far as I know, you can't define a matrix with some temporarily open size, right?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt;"&gt;If so, what are some ideas to adjust for this issue?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt;"&gt;One way is to define a matrix with sufficiently big size. Then afterwards trim by missing values or reduce the size based on some counter. For example, if you work out a matrix from other one, you allow the size based on the original matrix.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Sep 2013 05:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131529#M1036</guid>
      <dc:creator>Bogdan</dc:creator>
      <dc:date>2013-09-07T05:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with arbitrary (open) dimension</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131530#M1037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right. An example of this situation is in this article:&lt;A href="http://blogs.sas.com/content/iml/2012/11/14/efficient-acceptance-rejection-simulation-in-a-vector-language/" title="http://blogs.sas.com/content/iml/2012/11/14/efficient-acceptance-rejection-simulation-in-a-vector-language/"&gt;&amp;nbsp; Efficient acceptance-rejection simulation - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Some people append to a matrix within a loop (see &lt;A href="http://blogs.sas.com/content/iml/2011/06/20/pre-allocate-arrays-to-improve-efficiency/" title="http://blogs.sas.com/content/iml/2011/06/20/pre-allocate-arrays-to-improve-efficiency/"&gt; Pre-allocate arrays to improve efficiency - The DO Loop&lt;/A&gt;), but that is inefficient so I try to allocate the matrix as large as it might be, and then fill only the rows that are actually used. As you say, trim the rest, like this:&lt;/P&gt;&lt;P&gt;x = j(100, 1, .); /* use missing values to mark unused rows */&lt;/P&gt;&lt;P&gt;do i = 1 to 10;&lt;/P&gt;&lt;P&gt;/* do something that fills 85% of the rows */&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;x = remove(x, loc(x=.));&amp;nbsp; /* remove and missing values */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Sep 2013 09:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131530#M1037</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-09-07T09:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with arbitrary (open) dimension</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131531#M1038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;About your program mr. Wicklin, how can you remove rows based on the missing values occurring in a column?&lt;/P&gt;&lt;P&gt;The program you showed works for vectors, i.e. matrices of dimension&amp;nbsp; n x 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Oct 2013 04:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131531#M1038</guid>
      <dc:creator>Bogdan</dc:creator>
      <dc:date>2013-10-06T04:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with arbitrary (open) dimension</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131532#M1039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See this article on how to remove rows that have a missing values in any variable:&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2012/04/02/count-missing-values-in-observations/" title="http://blogs.sas.com/content/iml/2012/04/02/count-missing-values-in-observations/"&gt; Count missing values in observations - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Oct 2013 09:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-with-arbitrary-open-dimension/m-p/131532#M1039</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-10-06T09:45:41Z</dc:date>
    </item>
  </channel>
</rss>

