<?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: proc iml issue with concatenation in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422529#M3939</link>
    <description>&lt;P&gt;Got it. The reason was actually the fact that I didn't do &lt;STRONG&gt;num&lt;/STRONG&gt;(scan(compress(vn,'S'),2,'t_')) so b was character matrix in disguise of numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following code works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
  use test(keep = TR_:);
  read all var _num_ into x [colname=vn];
  b = t(num(scan(compress(vn,'S'),2,'t_')) // num(scan(compress(vn,'S'),3,'t_')));
  a = t(x);
  c = a||b;
  d = full(c);
  print x, a, b, c, d;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2017 23:05:48 GMT</pubDate>
    <dc:creator>ss59</dc:creator>
    <dc:date>2017-12-19T23:05:48Z</dc:date>
    <item>
      <title>proc iml issue with concatenation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422521#M3937</link>
      <description>&lt;P&gt;I have the following code that perfectly works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
a = {1,2,3,4,0};
b = {1 1, 1 2, 2 3,3 1, 2 2};
c = a||b;
d = full(c);
print a,b,c,d;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, I'm trying to the same thing with one row of my data but getting errors. My code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
  use test(keep = TR_:);
  read all var _num_ into x [colname=vn];
  b = t(scan(compress(vn,'S'),2,'t_') // scan(compress(vn,'S'),3,'t_'));
  a = t(x);
  c = a||b;
  d = full(c);
  print x, a, b, c, d;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can't somehow get&amp;nbsp;the matrix 'c' correctly, it is throwing some error. Can anyone please point out where I'm going wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The test file is following:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;Year&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;Segment1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S6_S5&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S7_S5&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S6_S7&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S7_S6&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S7_S8&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S6_S8&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S3_S1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S2_S1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S2_S3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S3_S2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S3_S4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S2_S4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S6_S2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S7_S3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S5_S1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S8_S4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S2_S6&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;TR_S3_S7&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;2017&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS"&gt;ABC&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0.001&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0.3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0.02&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Trebuchet MS" color="#000000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 19 Dec 2017 22:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422521#M3937</guid>
      <dc:creator>ss59</dc:creator>
      <dc:date>2017-12-19T22:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml issue with concatenation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422525#M3938</link>
      <description>&lt;P&gt;Paste the code and messages from the Log into a code box opened with the forum {I} menu icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 22:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422525#M3938</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-19T22:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml issue with concatenation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422529#M3939</link>
      <description>&lt;P&gt;Got it. The reason was actually the fact that I didn't do &lt;STRONG&gt;num&lt;/STRONG&gt;(scan(compress(vn,'S'),2,'t_')) so b was character matrix in disguise of numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following code works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
  use test(keep = TR_:);
  read all var _num_ into x [colname=vn];
  b = t(num(scan(compress(vn,'S'),2,'t_')) // num(scan(compress(vn,'S'),3,'t_')));
  a = t(x);
  c = a||b;
  d = full(c);
  print x, a, b, c, d;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 23:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/422529#M3939</guid>
      <dc:creator>ss59</dc:creator>
      <dc:date>2017-12-19T23:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml issue with concatenation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/423284#M3941</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182781"&gt;@ss59&lt;/a&gt;&amp;nbsp;glad you found your answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 small thing that itches every IML programmer about this code is that you should always remember to close your data sets when you are done reading from them. So add a&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;close test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;statement after your read statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a (5) reason(s) why, read &lt;A href="https://blogs.sas.com/content/iml/2010/09/20/five-reasons-to-close-your-data-sets.html" target="_self"&gt;Five Reasons to CLOSE Your Data Sets&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 09:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml-issue-with-concatenation/m-p/423284#M3941</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-22T09:11:00Z</dc:date>
    </item>
  </channel>
</rss>

