<?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: A problem on vector manipulation in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90500#M569</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the CUSUM function to get the indexes into a long vector that has sum(b) elements. Loop over the categories and use the REPEAT functions to fill up the vector:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;a = {2 3 5};&lt;/P&gt;&lt;P&gt;b = {1 2 3};&lt;/P&gt;&lt;P&gt;cumFreq = 0 || cusum(b);&lt;/P&gt;&lt;P&gt;N = ncol(a);&lt;/P&gt;&lt;P&gt;v = j(sum(b), 1); &lt;/P&gt;&lt;P&gt;do i = 1 to N;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; bIdx = 1 + cumFreq&lt;I&gt;; /* begin index */&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eIdx = cumFreq[i+1];&amp;nbsp;&amp;nbsp; /* end index */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; print i bIdx eIdx;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; v[bIdx:eIdx] = repeat(a&lt;I&gt;, b&lt;I&gt;);&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;print v;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Apr 2012 14:01:59 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2012-04-20T14:01:59Z</dc:date>
    <item>
      <title>A problem on vector manipulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90499#M568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;Hi all&lt;/P&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;&lt;/P&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;I have a quick question and I have been struggling for several days. I hope you could help me. Many thanks.&lt;/P&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;I hope to design a vector as follows: suppose there are two given vector a=[2 3 5], b=[1 2 3]&lt;BR /&gt;Here b indicates the frequency vector. I hope to generate a vector c=[2 3 3 5 5 5]. I am trying to use the repeat function in IML, but there is always something wrong&lt;/P&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;&lt;/P&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;&lt;/P&gt;&lt;P style="padding-right: 15px; padding-left: 15px; background-color: #f6f7f7; color: #333333; font-family: Arial, sans-serif; text-align: -webkit-auto;"&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 13:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90499#M568</guid>
      <dc:creator>milanxiaoyao</dc:creator>
      <dc:date>2012-04-20T13:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: A problem on vector manipulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90500#M569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the CUSUM function to get the indexes into a long vector that has sum(b) elements. Loop over the categories and use the REPEAT functions to fill up the vector:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;a = {2 3 5};&lt;/P&gt;&lt;P&gt;b = {1 2 3};&lt;/P&gt;&lt;P&gt;cumFreq = 0 || cusum(b);&lt;/P&gt;&lt;P&gt;N = ncol(a);&lt;/P&gt;&lt;P&gt;v = j(sum(b), 1); &lt;/P&gt;&lt;P&gt;do i = 1 to N;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; bIdx = 1 + cumFreq&lt;I&gt;; /* begin index */&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eIdx = cumFreq[i+1];&amp;nbsp;&amp;nbsp; /* end index */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; print i bIdx eIdx;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; v[bIdx:eIdx] = repeat(a&lt;I&gt;, b&lt;I&gt;);&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;print v;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 14:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90500#M569</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-04-20T14:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: A problem on vector manipulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90501#M570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Many thanks.&amp;nbsp;&amp;nbsp; This is great !&amp;nbsp;&amp;nbsp;&amp;nbsp; And the function cusum( ) is extremely helpful !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 15:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-problem-on-vector-manipulation/m-p/90501#M570</guid>
      <dc:creator>milanxiaoyao</dc:creator>
      <dc:date>2012-04-20T15:02:07Z</dc:date>
    </item>
  </channel>
</rss>

