<?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 getting max and min value by group using PROC IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274336#M2834</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am trying to obtain the min, max values within a group (in this instance, "SITE") for a dataset.&lt;/P&gt;
&lt;P&gt;I am new to proc iml, so please forgive me for my mistakes.&lt;/P&gt;
&lt;P&gt;I have provided the datalines below for your perusal, along with my code (which does not work) and end solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pottery;
        input Site X Fe Mg Ca Na;
        datalines;
      1 14.4 7.00 4.30 0.15 0.51
      1 13.8 7.08 3.43 0.12 0.17
      1 14.6 7.09 3.88 0.13 0.20
      1 11.5 6.37 5.64 0.16 0.14
      1 13.8 7.06 5.34 0.20 0.20
      1 10.9 6.26 3.47 0.17 0.22
      1 10.1 4.26 4.26 0.20 0.18
      1 11.6 5.78 5.91 0.18 0.16
      1 11.1 5.49 4.52 0.29 0.30
      1 13.4 6.92 7.23 0.28 0.20
      1 12.4 6.13 5.69 0.22 0.54
      1 13.1 6.64 5.51 0.31 0.24
      1 12.7 6.69 4.45 0.20 0.22
      1 12.5 6.44 3.94 0.22 0.23
      2 11.8 5.44 3.94 0.30 0.04
      2 11.6 5.39 3.77 0.29 0.06
      3 18.3 1.28 0.67 0.03 0.03
      3 15.8 2.39 0.63 0.01 0.04
      3 18.0 1.50 0.67 0.01 0.06
      3 18.0 1.88 0.68 0.01 0.04
      3 20.8 1.51 0.72 0.07 0.10
      4 17.7 1.12 0.56 0.06 0.06
      4 18.3 1.14 0.67 0.06 0.05
      4 16.7 0.92 0.53 0.01 0.05
      4 14.8 2.74 0.67 0.03 0.05
      4 19.1 1.64 0.60 0.10 0.03
      ;


	  proc iml;
        use pottery;
        read all var{site x Fe} into a;
		call sortndx(ndx,a,1);
       unique_rows=uniqueby(a,1,1:nrow(a)); 
	   unique_vals=a[ndx[unique_rows],1:3];
	   minC=a[&amp;gt;&amp;lt;,];
	   maxC=a[&amp;lt;&amp;gt;,];
print unique_rows, unique_vals, minC, maxC;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The end solution needs to look somewhat like this:&lt;/P&gt;
&lt;TABLE width="384" style="width: 288pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="6" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="64" height="17" style="border: 0px black; border-image: none; width: 48pt; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;site&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Fe&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Mg&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Ca&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Na&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;10,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;4,26&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,43&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,12&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,14&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;11,6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;5,39&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,77&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,29&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,04&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;15,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;1,28&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,63&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,01&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,03&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;4&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;14,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,92&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,53&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,01&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,03&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="384" style="width: 288pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="6" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="64" height="17" style="border: 0px black; border-image: none; width: 48pt; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;site&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Fe&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Mg&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Ca&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Na&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;14,6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;7,09&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;7,23&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,31&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,54&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;11,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;5,44&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,94&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,06&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;20,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2,39&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,72&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,07&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;4&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;19,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2,74&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,67&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,06&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;I want to avoid using the datastep and Proc Sql option.&lt;/P&gt;
&lt;P&gt;Please do let me know.&lt;/P&gt;
&lt;P&gt;many thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2016 12:27:44 GMT</pubDate>
    <dc:creator>sebster24</dc:creator>
    <dc:date>2016-06-01T12:27:44Z</dc:date>
    <item>
      <title>Re: getting max and min value by group using PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274698#M2833</link>
      <description>&lt;P&gt;Ksharp = SAS Super Guru. Thank you.&lt;/P&gt;
&lt;P&gt;Is there anything you cannot solve in SAS? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 14:42:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274698#M2833</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2016-06-02T14:42:17Z</dc:date>
    </item>
    <item>
      <title>getting max and min value by group using PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274336#M2834</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am trying to obtain the min, max values within a group (in this instance, "SITE") for a dataset.&lt;/P&gt;
&lt;P&gt;I am new to proc iml, so please forgive me for my mistakes.&lt;/P&gt;
&lt;P&gt;I have provided the datalines below for your perusal, along with my code (which does not work) and end solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pottery;
        input Site X Fe Mg Ca Na;
        datalines;
      1 14.4 7.00 4.30 0.15 0.51
      1 13.8 7.08 3.43 0.12 0.17
      1 14.6 7.09 3.88 0.13 0.20
      1 11.5 6.37 5.64 0.16 0.14
      1 13.8 7.06 5.34 0.20 0.20
      1 10.9 6.26 3.47 0.17 0.22
      1 10.1 4.26 4.26 0.20 0.18
      1 11.6 5.78 5.91 0.18 0.16
      1 11.1 5.49 4.52 0.29 0.30
      1 13.4 6.92 7.23 0.28 0.20
      1 12.4 6.13 5.69 0.22 0.54
      1 13.1 6.64 5.51 0.31 0.24
      1 12.7 6.69 4.45 0.20 0.22
      1 12.5 6.44 3.94 0.22 0.23
      2 11.8 5.44 3.94 0.30 0.04
      2 11.6 5.39 3.77 0.29 0.06
      3 18.3 1.28 0.67 0.03 0.03
      3 15.8 2.39 0.63 0.01 0.04
      3 18.0 1.50 0.67 0.01 0.06
      3 18.0 1.88 0.68 0.01 0.04
      3 20.8 1.51 0.72 0.07 0.10
      4 17.7 1.12 0.56 0.06 0.06
      4 18.3 1.14 0.67 0.06 0.05
      4 16.7 0.92 0.53 0.01 0.05
      4 14.8 2.74 0.67 0.03 0.05
      4 19.1 1.64 0.60 0.10 0.03
      ;


	  proc iml;
        use pottery;
        read all var{site x Fe} into a;
		call sortndx(ndx,a,1);
       unique_rows=uniqueby(a,1,1:nrow(a)); 
	   unique_vals=a[ndx[unique_rows],1:3];
	   minC=a[&amp;gt;&amp;lt;,];
	   maxC=a[&amp;lt;&amp;gt;,];
print unique_rows, unique_vals, minC, maxC;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The end solution needs to look somewhat like this:&lt;/P&gt;
&lt;TABLE width="384" style="width: 288pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="6" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="64" height="17" style="border: 0px black; border-image: none; width: 48pt; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;site&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Fe&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Mg&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Ca&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Min_Na&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;10,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;4,26&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,43&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,12&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,14&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;11,6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;5,39&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,77&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,29&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,04&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;15,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;1,28&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,63&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,01&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,03&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;4&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;14,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,92&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,53&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,01&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,03&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="384" style="width: 288pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="6" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="64" height="17" style="border: 0px black; border-image: none; width: 48pt; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;site&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Fe&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Mg&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Ca&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Max_Na&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;14,6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;7,09&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;7,23&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,31&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,54&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;11,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;5,44&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,94&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,06&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;20,8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2,39&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,72&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,07&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD height="17" align="right" style="border: 0px black; border-image: none; height: 12.75pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;4&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;19,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;2,74&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,67&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;0,06&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;I want to avoid using the datastep and Proc Sql option.&lt;/P&gt;
&lt;P&gt;Please do let me know.&lt;/P&gt;
&lt;P&gt;many thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2016 12:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274336#M2834</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2016-06-01T12:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: getting max and min value by group using PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274347#M2835</link>
      <description>&lt;P&gt;The question really, is why do you want to avoid using datastep, proc, and SQL? &amp;nbsp;Proc means/summary/freq are coded specifically for these types of process, they are optimised for it, and so not using them doesn't make much sense?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2016 13:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274347#M2835</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-01T13:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: getting max and min value by group using PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274537#M2836</link>
      <description>&lt;P&gt;It is indeed more suitable for IML.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pottery;
        input Site X Fe Mg Ca Na;
        datalines;
      1 14.4 7.00 4.30 0.15 0.51
      1 13.8 7.08 3.43 0.12 0.17
      1 14.6 7.09 3.88 0.13 0.20
      1 11.5 6.37 5.64 0.16 0.14
      1 13.8 7.06 5.34 0.20 0.20
      1 10.9 6.26 3.47 0.17 0.22
      1 10.1 4.26 4.26 0.20 0.18
      1 11.6 5.78 5.91 0.18 0.16
      1 11.1 5.49 4.52 0.29 0.30
      1 13.4 6.92 7.23 0.28 0.20
      1 12.4 6.13 5.69 0.22 0.54
      1 13.1 6.64 5.51 0.31 0.24
      1 12.7 6.69 4.45 0.20 0.22
      1 12.5 6.44 3.94 0.22 0.23
      2 11.8 5.44 3.94 0.30 0.04
      2 11.6 5.39 3.77 0.29 0.06
      3 18.3 1.28 0.67 0.03 0.03
      3 15.8 2.39 0.63 0.01 0.04
      3 18.0 1.50 0.67 0.01 0.06
      3 18.0 1.88 0.68 0.01 0.04
      3 20.8 1.51 0.72 0.07 0.10
      4 17.7 1.12 0.56 0.06 0.06
      4 18.3 1.14 0.67 0.06 0.05
      4 16.7 0.92 0.53 0.01 0.05
      4 14.8 2.74 0.67 0.03 0.05
      4 19.1 1.64 0.60 0.10 0.03
      ;
run;
proc iml;
use pottery nobs nobs;
read all var {Site};
read all var {X Fe Mg Ca Na} into x[c=vnames];
close;

start_end=t(loc(t(Site)^={.}||remove(Site,nobs)))||
          t(loc(t(Site)^=remove(Site,1)||{.}));
          
nrow=nrow(start_end);  
ncol=ncol(x);  
sites=site[start_end[,1]];  
minC=j(nrow,ncol,.);
maxC=j(nrow,ncol,.);

do i=1 to nrow;
 minC[i,]=x[start_end[i,1]:start_end[i,2],][&amp;gt;&amp;lt;,];
 maxC[i,]=x[start_end[i,1]:start_end[i,2],][&amp;lt;&amp;gt;,];
end;
print sites minC[c=vnames],sites maxC[c=vnames];
quit;
          &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 02:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274537#M2836</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-02T02:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: getting max and min value by group using PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274573#M2837</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just wondering why IML is the better option than:&lt;/P&gt;
&lt;PRE&gt;proc summary data=work.pottery;
  class site;
  var x fe mg ca na;
  output out=work.results min=min_x min_fe min_mg min_ca min_na max=max_x max_fe max_mg max_ca max_na;
run;&lt;/PRE&gt;
&lt;P&gt;Seems to be&amp;nbsp;simpler coding to do the above, and only requires Base SAS?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 09:12:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274573#M2837</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-02T09:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: getting max and min value by group using PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274697#M2838</link>
      <description>&lt;P&gt;Hello RW9,&lt;/P&gt;
&lt;P&gt;i was insisting on proc iml, because i wanted to dig deeper into statistical programming. It looks fun.&lt;/P&gt;
&lt;P&gt;On another note, i wanted to see the difference myself, and found the following. Proc Iml is much efficient in resource usage and slightly quicker.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;PROCEDURE IML used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 0.07 seconds&lt;/P&gt;
&lt;P&gt;user cpu time 0.04 seconds&lt;/P&gt;
&lt;P&gt;system cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;Memory 822k&lt;/P&gt;
&lt;P&gt;OS Memory 11816k&lt;/P&gt;
&lt;P&gt;Timestamp 02.06.2016 16:37:09&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;NOTE: There were 26 observations read from the data set WORK.POTTERY.&lt;/P&gt;
&lt;P&gt;NOTE: The data set WORK.RESULTS has 5 observations and 13 variables.&lt;/P&gt;
&lt;P&gt;NOTE: PROCEDURE SUMMARY used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 0.04 seconds&lt;/P&gt;
&lt;P&gt;user cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;system cpu time 0.04 seconds&lt;/P&gt;
&lt;P&gt;Memory 7980k&lt;/P&gt;
&lt;P&gt;OS Memory 20044k&lt;/P&gt;
&lt;P&gt;Timestamp 02.06.2016 16:37:09&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;THank you&amp;nbsp;for your help RW9. Much appreciated. You guys are just&amp;nbsp;SAS&amp;nbsp;Super-Gurus &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 14:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-getting-max-and-min-value-by-group-using-PROC-IML/m-p/274697#M2838</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2016-06-02T14:41:29Z</dc:date>
    </item>
  </channel>
</rss>

