<?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: matrix cells calculation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672083#M201916</link>
    <description>&lt;P&gt;Does this have to be done in a matrix, or can it be done in a SAS data step? Is it always columns 3 and 4 that is of interest, or can that change depending on various different circumstances?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't say "I think I have...", please say either: you have it or you do not have it.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jul 2020 12:57:32 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-07-24T12:57:32Z</dc:date>
    <item>
      <title>matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672074#M201910</link>
      <description>&lt;P&gt;Hello, expert, I have a matrix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;ID&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;col2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;col3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;col4&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.2543&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.376363&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.306857&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.010651&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.259333&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.073882&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.371874&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.258592&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.634631&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;-0.22921&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.084731&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;-0.39482&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.520023&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.553674&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="Calibri" color="#000000"&gt;0.360524&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please suggest how to do calculation for a set of cells in the table.&lt;/P&gt;&lt;P&gt;For example, calculate the average and std of row 2 and column&amp;nbsp; 3 and 4, e.g. [2, 3:4].&lt;/P&gt;&lt;P&gt;Many thanks, is there any procedure would have such function?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 12:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672074#M201910</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-24T12:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672078#M201912</link>
      <description>&lt;P&gt;Do you have SAS/IML?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 12:39:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672078#M201912</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-07-24T12:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672080#M201914</link>
      <description>Thanks, I think I have the SAS/IML.&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Jul 2020 12:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672080#M201914</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-24T12:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672083#M201916</link>
      <description>&lt;P&gt;Does this have to be done in a matrix, or can it be done in a SAS data step? Is it always columns 3 and 4 that is of interest, or can that change depending on various different circumstances?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't say "I think I have...", please say either: you have it or you do not have it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 12:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672083#M201916</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-24T12:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672085#M201918</link>
      <description>&lt;P&gt;would you please show me some example of using IML to do calculation? not familiar the syntax,&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;</description>
      <pubDate>Fri, 24 Jul 2020 13:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672085#M201918</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-24T13:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672086#M201919</link>
      <description>&lt;P&gt;the column number is fixed always ID, x,x1-x7,&lt;/P&gt;&lt;P&gt;but the row number will change, due the updating database on daily basis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 13:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672086#M201919</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-24T13:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672300#M202038</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 set sashelp.class;
 a=1;b=2;c=3;
run;

%let row=2;
%let col=2:5 ;
proc iml;
use have;
read all var _num_ into x;
close; 	

avg=mean(colvec(x[&amp;amp;row,&amp;amp;col]));
std=std(colvec(x[&amp;amp;row,&amp;amp;col]));

print avg,std;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Jul 2020 12:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672300#M202038</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-07-25T12:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672391#M202075</link>
      <description>&lt;P&gt;Do you have a "matrix" or a dataset?&amp;nbsp; Assuming you have a dataset then you are asking for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  where id = 2 ;
  avg = mean(of col3 col4);
  std = std(of col3 col4);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jul 2020 13:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672391#M202075</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-26T13:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672399#M202081</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/277798"&gt;@Jonison&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;the column number is fixed always ID, x,x1-x7,&lt;/P&gt;
&lt;P&gt;but the row number will change, due the updating database on daily basis.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How does the programmer know which columns and rows to use for computing the mean?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jul 2020 15:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672399#M202081</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-26T15:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: matrix cells calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672404#M202086</link>
      <description>&lt;P&gt;Thanks for your kind help, it is really useful and works perfectly.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jul 2020 16:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matrix-cells-calculation/m-p/672404#M202086</guid>
      <dc:creator>Jonison</dc:creator>
      <dc:date>2020-07-26T16:47:38Z</dc:date>
    </item>
  </channel>
</rss>

