<?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: input calculated result to new column of table. in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672749#M5218</link>
    <description>&lt;P&gt;Try replacing '&amp;amp;x' and '&amp;amp;row' with 'x' and 'row' respectively, as I believe these should be IML matrices, not references to macro variables. Syntax like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x[row, &amp;amp;col+1] = SE&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;could be used to write the result to the matrix x if the macro variable &amp;amp;col is defined correctly. You will get better help if you show us a small example of the data you are working on, and show us what warnings or errors occur when your code runs.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 07:45:11 GMT</pubDate>
    <dc:creator>IanWakeling</dc:creator>
    <dc:date>2020-07-28T07:45:11Z</dc:date>
    <item>
      <title>input calculated result to new column of table.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672697#M5216</link>
      <description>&lt;P&gt;Hello, experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about writing calculated results to the a new column at same row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I have is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use work.exp;&lt;BR /&gt;read all var _num_ into x;&lt;BR /&gt;close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do row=1 to 9;&lt;BR /&gt;Sum = ssq(colvec(&amp;amp;x[&amp;amp;row, &amp;amp;col]-&amp;amp;x[&amp;amp;row, &amp;amp;bcol]));&lt;BR /&gt;SE = &amp;amp;STD*(sqrt(6/7*Sum));&lt;BR /&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;how to write the SE to x[&amp;amp;row, &amp;amp;(col+1)]?&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 21:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672697#M5216</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-27T21:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: input calculated result to new column of table.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672749#M5218</link>
      <description>&lt;P&gt;Try replacing '&amp;amp;x' and '&amp;amp;row' with 'x' and 'row' respectively, as I believe these should be IML matrices, not references to macro variables. Syntax like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x[row, &amp;amp;col+1] = SE&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;could be used to write the result to the matrix x if the macro variable &amp;amp;col is defined correctly. You will get better help if you show us a small example of the data you are working on, and show us what warnings or errors occur when your code runs.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 07:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672749#M5218</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-07-28T07:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: input calculated result to new column of table.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672762#M5219</link>
      <description>&lt;P&gt;1. Write and debug a SAS/IML program before you try to put it into a macro.&lt;/P&gt;
&lt;P&gt;2. I'm guessing you want to store each value of SE into a column vector and then concatenate that vector as a new column for x:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use sashelp.class;
read all var _num_ into x[colname=varNames];
close;

COL = 3; BCOL=1; STD = 2;  /* make up values */

N = nrow(x);
SE = j(N, 1, .);          /* allocate vector for SE */
do row=1 to N;
   Sum = ssq(colvec(x[row, COL]-x[row, BCOL]));
   SE[row] = STD*(sqrt(6/7*Sum));
end;

*print SE;
/* if you want to add a new column to x, use concatenation */
newX = x || SE;
print newX[colname=(varNames || "SE")];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 10:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672762#M5219</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-07-28T10:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: input calculated result to new column of table.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672785#M5220</link>
      <description>&lt;P&gt;Super, thank you very much. It works, learned new skill!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 12:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/input-calculated-result-to-new-column-of-table/m-p/672785#M5220</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-28T12:00:32Z</dc:date>
    </item>
  </channel>
</rss>

