<?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: How to find the maximum value in a variable through data steps without using loop, min and max f in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426185#M281244</link>
    <description>&lt;P&gt;You want to have "&lt;STRONG&gt;FUN&lt;/STRONG&gt;" here? Hmm, I would like to learn from you. Do you know how to do it? If yes, please share. Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2018 18:02:25 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-01-09T18:02:25Z</dc:date>
    <item>
      <title>How to find the maximum value in a variable through data steps without using loop, min and max fun.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426177#M281243</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;input Name $ Age;&lt;BR /&gt;cards;&lt;BR /&gt;Jack 10&lt;BR /&gt;Joe 31&lt;BR /&gt;Tom 22&lt;BR /&gt;Roe 33&lt;BR /&gt;Rex 44&lt;BR /&gt;Tim 24&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to find the maximum value of AGE&amp;nbsp;variable through data steps without using loop, min and max function.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 17:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426177#M281243</guid>
      <dc:creator>ajay_mishra</dc:creator>
      <dc:date>2018-01-09T17:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426185#M281244</link>
      <description>&lt;P&gt;You want to have "&lt;STRONG&gt;FUN&lt;/STRONG&gt;" here? Hmm, I would like to learn from you. Do you know how to do it? If yes, please share. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426185#M281244</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-09T18:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426186#M281245</link>
      <description>&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Name $ Age;
cards;
Jack 10
Joe 31
Tom 22
Roe 33
Rex 44
Tim 24
;

proc sort;
	by descending age;
run;

data maxage;
	set have (obs= 1);
	drop name;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="105"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="105"&gt;The SAS System&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="105"&gt;Age&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="105"&gt;44&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426186#M281245</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-01-09T18:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426189#M281247</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Actually, you interpret it wrong. Not using the inbuilt&amp;nbsp;function max, min and loop.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426189#M281247</guid>
      <dc:creator>ajay_mishra</dc:creator>
      <dc:date>2018-01-09T18:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426198#M281248</link>
      <description>&lt;P&gt;Same "instructor" as referenced in this post perhaps? &lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/beginner-needs-help-with-min-max-function/m-p/426077#M104958" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/beginner-needs-help-with-min-max-function/m-p/426077#M104958&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426198#M281248</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-09T18:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426199#M281249</link>
      <description>&lt;P&gt;Why avoid built-in procedures to do this? It makes no sense. It makes your life more difficult. A pointless restriction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless it's a homework assignment, in which case you need to try it yourself, and ask questions when you get stuck. But it still makes no sense to do it this way.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426199#M281249</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-09T18:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426209#M281250</link>
      <description>&lt;P&gt;Does &amp;gt; and &amp;lt; logic count as max/min functions? Technically they're operators. And technically, the min/max function in a data step will not give you the min/max of a column without other logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159373"&gt;@ajay_mishra&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;data have;&lt;BR /&gt;input Name $ Age;&lt;BR /&gt;cards;&lt;BR /&gt;Jack 10&lt;BR /&gt;Joe 31&lt;BR /&gt;Tom 22&lt;BR /&gt;Roe 33&lt;BR /&gt;Rex 44&lt;BR /&gt;Tim 24&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to find the maximum value of AGE&amp;nbsp;variable through data steps without using loop, min and max function.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426209#M281250</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-09T19:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426210#M281251</link>
      <description>&lt;P&gt;No. It will act as an operator.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426210#M281251</guid>
      <dc:creator>ajay_mishra</dc:creator>
      <dc:date>2018-01-09T19:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426217#M281252</link>
      <description>&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;input Name $ Age;&lt;BR /&gt;cards;&lt;BR /&gt;Jack 10&lt;BR /&gt;Joe 31&lt;BR /&gt;Tom 22&lt;BR /&gt;Roe 33&lt;BR /&gt;Rex 44&lt;BR /&gt;Tim 24&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc transpose data=test out=w;&lt;BR /&gt;var age;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data wantt;&lt;BR /&gt;set w;&lt;BR /&gt;array c(*) col:;&lt;BR /&gt;call sortn(of c: );&lt;BR /&gt;keep col6;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data wantt2;&lt;BR /&gt;set test end=last;&lt;BR /&gt;array a(100) _temporary_;&lt;BR /&gt;retain a;&lt;BR /&gt;a(_n_)=age;&lt;BR /&gt;if last then do; call sortn(of a(*));max=a(dim(a));output;end;&lt;BR /&gt;keep max;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426217#M281252</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-09T19:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426218#M281253</link>
      <description>&lt;P&gt;One more:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data wantt3;&lt;BR /&gt;set test end=last;&lt;BR /&gt;retain max;&lt;BR /&gt;max=ifn(Age&amp;gt;max,age, max);&lt;BR /&gt;if last;&lt;BR /&gt;keep max;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426218#M281253</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-09T19:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426278#M281254</link>
      <description>&lt;P&gt;I doubt if your class has gotten to hash objects, so here's a solution I'm sure is not contemplated by your instructor, but which satisfies the criteria.&amp;nbsp; I don't recommend submitting it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Name $ Age;
cards;
Jack 10
Joe 31
Tom 22
Roe 33
Rex 44
Tim 24
run;

data want;
  if 0 then set have;

  declare hash h (dataset:"have",ordered:'D');
    h.definekey('age');
    h.definedata(all:'Y');
    h.definedone();
  declare hiter ih ('h');

  ih.first();
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jan 2018 00:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426278#M281254</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-10T00:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum value in a variable through data steps without using loop, min and max f</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426284#M281255</link>
      <description>&lt;P&gt;This is a commonly asked question when learning to program so it's within the realm of 'semi-decent' questions. It teaches you how information is carried across rows, conditional logic and how to identify the end of a file. There are automated ways, but often these basics are ignored. I suspect this is the answer your professor is looking for, since it's the most basic solution I can think of, besides the PROC SORT method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the test data from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;, the approach outlined below works well. It matches his answer with the IFN so that's another viable option as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-01-09 at 5.35.08 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17738iB1B5FE4357E7AABE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2018-01-09 at 5.35.08 PM.png" alt="Screen Shot 2018-01-09 at 5.35.08 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 00:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-value-in-a-variable-through-data-steps/m-p/426284#M281255</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-10T00:37:52Z</dc:date>
    </item>
  </channel>
</rss>

