<?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: Need to fill up a matrix with character and numeric values in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470658#M4207</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;M1={A,B,C};
M2={1 2 3};
xy = expandgrid(M1, char(M2) ); /* 2 columns */
G = rowcatc(xy);   /* concatenate and get rid of blanks */
M = shape(G, nrow(M1)); /* shape into matrix */

nNames="B1":"B3";
cNames="A1":"A3";
print M[r=nNames c=cNames];&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 15 Jun 2018 17:16:52 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2018-06-15T17:16:52Z</dc:date>
    <item>
      <title>Need to fill up a matrix with character and numeric values</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470647#M4206</link>
      <description>&lt;P&gt;I have two matrices [A ]&amp;nbsp; &amp;nbsp;and {1,2,3} basically I need to combine the matrix that looks like {A1 A2 A3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B1 B2 B3&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[C]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C1 C2 C3}&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first matrix is for treatments(A,B,C) and the second matrix is for the age factor(1,2,3).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting matrix will be used to check for imbalance between the treatments and age factor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the code below where basically tired to merge the two matrices:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;M1={A,&lt;BR /&gt;B,&lt;BR /&gt;C};&lt;BR /&gt;M2={1 2 3};&lt;BR /&gt;nNames="B1":"B3";&lt;BR /&gt;cNames="A1":"A3";&lt;BR /&gt;create ndat from M1[colname=nNames];&lt;BR /&gt;append from M1;&lt;BR /&gt;create cdat from M2[colname=cNames];&lt;BR /&gt;append from M2;&lt;BR /&gt;quit;&lt;BR /&gt;data dat;&lt;BR /&gt;merge ndat cdat;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This didn't really work as I still need to form a combination of two matrices. Any help will be appreciated. Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470647#M4206</guid>
      <dc:creator>azt5173</dc:creator>
      <dc:date>2018-06-15T16:25:39Z</dc:date>
    </item>
    <item>
      <title>Need to fill up a matrix with character and numeric values</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470632#M4208</link>
      <description>&lt;P&gt;I have two matrices [A ]&amp;nbsp; &amp;nbsp;and {1,2,3} basically I need to combine the matrix that looks like {A1 A2 A3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B1 B2 B3&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[C]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C1 C2 C3}&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first matrix is for treatments(A,B,C) and the second matrix is for the age factor(1,2,3).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting matrix will be used to check for imbalance between the treatments and age factor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the code below where basically tired to merge the two matrices:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;M1={A,&lt;BR /&gt;B,&lt;BR /&gt;C};&lt;BR /&gt;M2={1 2 3};&lt;BR /&gt;nNames="B1":"B3";&lt;BR /&gt;cNames="A1":"A3";&lt;BR /&gt;create ndat from M1[colname=nNames];&lt;BR /&gt;append from M1;&lt;BR /&gt;create cdat from M2[colname=cNames];&lt;BR /&gt;append from M2;&lt;BR /&gt;quit;&lt;BR /&gt;data dat;&lt;BR /&gt;merge ndat cdat;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This didn't really work as I still need to form a combination of two matrices. Any help will be appreciated. Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 15:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470632#M4208</guid>
      <dc:creator>azt5173</dc:creator>
      <dc:date>2018-06-15T15:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need to fill up a matrix with character and numeric values</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470643#M4209</link>
      <description>Hi:&lt;BR /&gt;  You'll probably get more answers if you post this in the forum for IML questions:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/bd-p/sas_iml" target="_blank"&gt;https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/bd-p/sas_iml&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Fri, 15 Jun 2018 16:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470643#M4209</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-06-15T16:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need to fill up a matrix with character and numeric values</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470658#M4207</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;M1={A,B,C};
M2={1 2 3};
xy = expandgrid(M1, char(M2) ); /* 2 columns */
G = rowcatc(xy);   /* concatenate and get rid of blanks */
M = shape(G, nrow(M1)); /* shape into matrix */

nNames="B1":"B3";
cNames="A1":"A3";
print M[r=nNames c=cNames];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Jun 2018 17:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470658#M4207</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-06-15T17:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need to fill up a matrix with character and numeric values</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470778#M4210</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
M1={A,
B,
C};
M2={1 2 3};
want=cats(repeat(m1,1,3),repeat(m2,3,1));
print want;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Jun 2018 11:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Need-to-fill-up-a-matrix-with-character-and-numeric-values/m-p/470778#M4210</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-16T11:03:33Z</dc:date>
    </item>
  </channel>
</rss>

