<?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 insert new rows into vectors or matrix in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70947#M445</link>
    <description>Thanks Rick!</description>
    <pubDate>Thu, 09 Sep 2010 16:37:55 GMT</pubDate>
    <dc:creator>trekvana</dc:creator>
    <dc:date>2010-09-09T16:37:55Z</dc:date>
    <item>
      <title>how to insert new rows into vectors or matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70945#M443</link>
      <description>hello all,&lt;BR /&gt;
&lt;BR /&gt;
how can I augment a vector or matrix with proc iml?&lt;BR /&gt;
&lt;BR /&gt;
for example, lets say i have a vector x={1,2} and I want to augment x to a 4x1 vector with missing value indictor (.) in positions 2 and 3. in other words i want x=(1, . , . , 2}. is this possible to do??&lt;BR /&gt;
&lt;BR /&gt;
pretty much i have an x vector and i also have an index vector (i={2,3} in this example) with the positions i want to include the (.) character.</description>
      <pubDate>Thu, 09 Sep 2010 01:55:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70945#M443</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-09T01:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to insert new rows into vectors or matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70946#M444</link>
      <description>The easiest way is to allocate a matrix of missing values and then fill in the nonmissing values by using subscripts.  Suppose your data look like this:&lt;BR /&gt;
&lt;BR /&gt;
N = 4; /** number of rows after including missing values **/&lt;BR /&gt;
MissingIdx = {2, 3}; /** indices of rows that contain missing **/&lt;BR /&gt;
x = {1,2}; /** data values **/&lt;BR /&gt;
&lt;BR /&gt;
The hard part is that you need to know the indices of the NONmissing observations, which you can find by using the SETDIF function. The function is explained at&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/langref_sect241.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/langref_sect241.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
NMidx = setdif(1:N, MissingIdx); /** find the indices for nonmissing values **/&lt;BR /&gt;
newX = repeat(., N);  /** create answer vector with all missings **/&lt;BR /&gt;
newX[NMidx] = x;  /** assign nonmissing values in the specified locations **/&lt;BR /&gt;
print newX;</description>
      <pubDate>Thu, 09 Sep 2010 10:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70946#M444</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2010-09-09T10:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to insert new rows into vectors or matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70947#M445</link>
      <description>Thanks Rick!</description>
      <pubDate>Thu, 09 Sep 2010 16:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-insert-new-rows-into-vectors-or-matrix/m-p/70947#M445</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-09T16:37:55Z</dc:date>
    </item>
  </channel>
</rss>

