<?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: Error: Number of columns in X does not match with the number of variables in the data set in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489508#M4330</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22174"&gt;@dustychair&lt;/a&gt;. Glad to hear that the community has taught you some &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My guess is that you do not want to create another matrix from X, rather a data set, correct? If so then change this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create matrix from X [colname=Cand rowname=Cand];
append from X;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create data MyData from X[colname=Cand];
   append from X;
close MyData;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Aug 2018 07:21:23 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-08-24T07:21:23Z</dc:date>
    <item>
      <title>Error: Number of columns in X does not match with the number of variables in the data set</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489507#M4329</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have been working on a code. This community helped me and taught me a lot. I have a question which may be very simple for you. In the below code when I use rowname statement I get this error 'Number of columns in X does not match with the number of variables in the data set'. Although rows and columns have the same&amp;nbsp;candidates in the matrix, I don't understand why I get this error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tr;&lt;BR /&gt;infile 'C:\coll_gen\N100\GROUP10\COMP40\PHI25\gbt\RESULTS-SIG1.OUT';&lt;BR /&gt;input CAND_1$ CAND_2$ ID_1 ID_2 THETA_1 THETA_2 MATCHES RT_PROB FLAG ;&lt;BR /&gt;run;&lt;BR /&gt; &lt;BR /&gt;proc iml;&lt;/P&gt;
&lt;P&gt;use tr;&lt;BR /&gt; read all var _ALL_; &lt;BR /&gt;close tr;&lt;/P&gt;
&lt;P&gt;Cand=unique(Cand_1//Cand_2);&lt;BR /&gt;call sort(Cand);&lt;/P&gt;
&lt;P&gt;X=j(ncol(Cand), ncol(Cand), .);&lt;/P&gt;
&lt;P&gt;do i=1 to nrow(RT_PROB);&lt;BR /&gt; X[loc(Cand=Cand_1[i]),loc(Cand=Cand_2[i])]=RT_PROB[i];&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;print X[colName=((Cand)) rowName=((Cand))];&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;create matrix from X [colname=Cand rowname=Cand];&lt;/FONT&gt;&lt;BR /&gt;append from X;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 07:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489507#M4329</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2018-08-24T07:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Number of columns in X does not match with the number of variables in the data set</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489508#M4330</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22174"&gt;@dustychair&lt;/a&gt;. Glad to hear that the community has taught you some &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My guess is that you do not want to create another matrix from X, rather a data set, correct? If so then change this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create matrix from X [colname=Cand rowname=Cand];
append from X;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create data MyData from X[colname=Cand];
   append from X;
close MyData;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2018 07:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489508#M4330</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-24T07:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Number of columns in X does not match with the number of variables in the data set</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489509#M4331</link>
      <description>&lt;P&gt;I moved this to the SAS/IML community.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 07:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489509#M4331</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-24T07:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Number of columns in X does not match with the number of variables in the data set</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489516#M4332</link>
      <description>&lt;P&gt;Hi Draycut,&lt;/P&gt;
&lt;P&gt;Actually my main purpose is&amp;nbsp;to use X matrix (or should I say data set?) in cluster analysis. In cluster analysis I need to define variables.Candidates will be clustered based on RT_PROB. So, I have to define both variables. Maybe there is an easy way to do that but I tried proc transpose&amp;nbsp; to get cand variable in the rows. Here is my whole code for my purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tr;&lt;BR /&gt;infile 'C:\coll_gen\N100\GROUP10\COMP40\PHI25\gbt\RESULTS-SIG1.OUT';&lt;BR /&gt;input CAND_1$ CAND_2$ ID_1 ID_2 THETA_1 THETA_2 MATCHES RT_PROB FLAG ;&lt;BR /&gt;run;&lt;BR /&gt; &lt;BR /&gt;proc iml;&lt;/P&gt;
&lt;P&gt;use tr;&lt;BR /&gt; read all var _ALL_; &lt;BR /&gt;close tr;&lt;/P&gt;
&lt;P&gt;Cand=unique(Cand_1//Cand_2);&lt;BR /&gt;call sort(Cand);&lt;/P&gt;
&lt;P&gt;X=j(ncol(Cand), ncol(Cand), .);&lt;/P&gt;
&lt;P&gt;do i=1 to nrow(RT_PROB);&lt;BR /&gt; X[loc(Cand=Cand_1[i]),loc(Cand=Cand_2[i])]=RT_PROB[i];&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;print X[colName=((Cand)) rowName=((Cand))];&lt;BR /&gt;create matrix from X [colname=Cand rowname=Cand];&lt;BR /&gt;append from X;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data matrix;&lt;BR /&gt;set matrix;&lt;BR /&gt;array change _numeric_;&lt;BR /&gt;do over change;&lt;BR /&gt;if change=. then change=0;&lt;BR /&gt;end;&lt;BR /&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc transpose data=matrix&lt;BR /&gt;out=matrix1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ods graphics on;&lt;/P&gt;
&lt;P&gt;proc cluster data=matrix1 method=ward ccc pseudo out=tree;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;var RT_PROB;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;id cand;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;ods graphics off;&lt;/P&gt;
&lt;P&gt;proc tree data=matrix1 out=New nclusters=5 noprint ;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; run;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 07:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489516#M4332</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2018-08-24T07:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Number of columns in X does not match with the number of variables in the data set</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489533#M4333</link>
      <description>&lt;P&gt;Because you are writing an extra column (the ROWNAME= variable), you need to include that information on the APPEND statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create matrix from X [colname=Cand rowname=Cand];&lt;BR /&gt;append from X[rowname=Cand];&lt;BR /&gt;close;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 09:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-Number-of-columns-in-X-does-not-match-with-the-number-of/m-p/489533#M4333</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-08-24T09:45:44Z</dc:date>
    </item>
  </channel>
</rss>

