<?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: Max and Min calculation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269071#M310522</link>
    <description>&lt;P&gt;Are you expecting to find the lowest value in the row or in the column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If row&amp;nbsp;the command can&amp;nbsp;be MIN/MAX as in your subject line.&lt;/P&gt;
&lt;P&gt;You can use the LARGEST function but the first parameter is what order your looking for, 1 is the maximum and 2 is the second highest. If you only have 2 values then that would correspond to max/min. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = min(q1, q2);
y = max(q1, q2);

x_large = Largest(1, q1, q2);
y_large = Largest(2, q1, q2);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See the doc for LARGEST()&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002154862.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002154862.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;STRONG&gt;
LARGEST (k, value-1&amp;lt;, value-2 ...&amp;gt;)&lt;/STRONG&gt;

Arguments
k
is a numeric constant, variable, or expression that specifies which value to return.

value
specifies the value of a numeric constant, variable, or expression to be processed.&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 08 May 2016 17:47:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-05-08T17:47:55Z</dc:date>
    <item>
      <title>Max and Min calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269068#M310520</link>
      <description>&lt;P&gt;Dear SAS Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is probably an easy question, however, I have trouble making it work. &amp;nbsp;I just want to find out either a maximum or minimum number from two numbers that have unique values. &amp;nbsp; For an example, I get errors when writing below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Test;&lt;BR /&gt;q1=5;&lt;BR /&gt;q2=10;&lt;BR /&gt;z=Largest(q1, q2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 May 2016 17:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269068#M310520</guid>
      <dc:creator>Learner25</dc:creator>
      <dc:date>2016-05-08T17:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Max and Min calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269069#M310521</link>
      <description>&lt;P&gt;data Test;&lt;BR /&gt;q1=5;&lt;BR /&gt;q2=10;&lt;BR /&gt;z=Largest(1,q1, q2);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 08 May 2016 17:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269069#M310521</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-05-08T17:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Max and Min calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269071#M310522</link>
      <description>&lt;P&gt;Are you expecting to find the lowest value in the row or in the column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If row&amp;nbsp;the command can&amp;nbsp;be MIN/MAX as in your subject line.&lt;/P&gt;
&lt;P&gt;You can use the LARGEST function but the first parameter is what order your looking for, 1 is the maximum and 2 is the second highest. If you only have 2 values then that would correspond to max/min. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = min(q1, q2);
y = max(q1, q2);

x_large = Largest(1, q1, q2);
y_large = Largest(2, q1, q2);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See the doc for LARGEST()&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002154862.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002154862.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;STRONG&gt;
LARGEST (k, value-1&amp;lt;, value-2 ...&amp;gt;)&lt;/STRONG&gt;

Arguments
k
is a numeric constant, variable, or expression that specifies which value to return.

value
specifies the value of a numeric constant, variable, or expression to be processed.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 May 2016 17:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269071#M310522</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-08T17:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Max and Min calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269073#M310523</link>
      <description>&lt;P&gt;Thank you, Reeza!&lt;/P&gt;&lt;P&gt;I understand&amp;nbsp;how the formula works now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 May 2016 18:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Max-and-Min-calculation/m-p/269073#M310523</guid>
      <dc:creator>Learner25</dc:creator>
      <dc:date>2016-05-08T18:37:53Z</dc:date>
    </item>
  </channel>
</rss>

