<?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: highest value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280513#M56702</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71196"&gt;@MeganE﻿&lt;/a&gt;&amp;nbsp;I agree about downloading files and year variable. It's relatively easy to calculate year anyways. Either use Year() function or year format.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jun 2016 18:02:50 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-27T18:02:50Z</dc:date>
    <item>
      <title>highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280468#M56684</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set and i want to sellect only highest Profit from attached file,&lt;/P&gt;&lt;P&gt;Ex:- &amp;nbsp;Highest profit from 2009 2010 2011 2012.&lt;/P&gt;&lt;P&gt;the data set have 9000 Observation from that i have sorted profit by if statment and i got folling record.&lt;/P&gt;&lt;P&gt;if profit = &amp;gt; 15000;&lt;/P&gt;&lt;P&gt;but i need only one one&amp;nbsp;&lt;SPAN&gt;Highest profit from each year.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 16:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280468#M56684</guid>
      <dc:creator>Prashant_Ph</dc:creator>
      <dc:date>2016-06-27T16:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280476#M56687</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91730"&gt;@Prashant_Ph﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not entirely certain what you want. So I take a stab guessing you want the max profit per year. You can use proc means for that. Assign the YEAR. format to the date to specifiy the required aggregation level of year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data profit;
   infile cards dlm='#';
   length type $200;
   format pdate date9.;
   input pdate : mmddyy10. type $ profit;
cards;
1/6/2009#Delivery Truck#16413.8242
1/7/2009#Regular Air#18527.1684
1/22/2009#Delivery Truck#17506.2518
2/15/2009#Delivery Truck#15227.6924
3/21/2009#Regular Air#34399.4625
8/21/2009#Delivery Truck#15688.9425
1/3/2010#Delivery Truck#18052.4284
10/20/2010#Delivery Truck#15904.1736
5/22/2011#Delivery Truck#19200.9844
11/19/2011#Delivery Truck#18598.6608
12/21/2011#Delivery Truck#19200.9844
5/21/2012#Regular Air#21172.5384
8/7/2012#Delivery Truck#19952.96
10/16/2012#Regular Air#20065.9887
12/2/2012#Delivery Truck#15315.7884
12/12/2012#Delivery Truck#15321.409
;
proc means max;
   class pdate;
   format pdate year4.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is the output:&lt;/P&gt;
&lt;PRE&gt;The MEANS Procedure

Analysis Variable : profit  
pdate N Obs Maximum 
2009 6 34399.46 
2010 2 18052.43 
2011 3 19200.98 
2012 5 21172.54 
&lt;/PRE&gt;
&lt;P&gt;This should get you started. Proc means can create an output dataset if you like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I misinterpreted your question please elaborate and give a sample of the dersired output.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 16:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280476#M56687</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-06-27T16:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280481#M56690</link>
      <description>&lt;P&gt;If you want a subset dataset you can select off after the sort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=[my data];&amp;nbsp; by year profit; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data [my data2];&lt;/P&gt;&lt;P&gt;&amp;nbsp; set [my data];&lt;/P&gt;&lt;P&gt;&amp;nbsp; by year profit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.year and last.profit then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it's sorted by profit ascending per year, that should pull out the highest per year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 16:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280481#M56690</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-27T16:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280484#M56692</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71196"&gt;@MeganE﻿&lt;/a&gt;&amp;nbsp;You should take last.year for the highest profit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=[my data];  by year profit; run;
 
data [my data2];
  set [my data];
  by year;
  if last.year;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 16:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280484#M56692</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-27T16:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280486#M56693</link>
      <description>&lt;P&gt;Oh, look at that, i flipped them.&amp;nbsp; Yes, you're right!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 16:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280486#M56693</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-27T16:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280496#M56697</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71196"&gt;@MeganE﻿&lt;/a&gt; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt; there is no YEAR in the data that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91730"&gt;@Prashant_Ph﻿&lt;/a&gt; attached.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 17:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280496#M56697</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-06-27T17:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280500#M56699</link>
      <description>&lt;P&gt;Really?&amp;nbsp; I'll admit i didn't look b/c i'm not comfortable opening files like that from people i don't know out on the internet.&amp;nbsp; But wow.&amp;nbsp; The original post surely implied year was part of the data...&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 17:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280500#M56699</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-27T17:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280513#M56702</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71196"&gt;@MeganE﻿&lt;/a&gt;&amp;nbsp;I agree about downloading files and year variable. It's relatively easy to calculate year anyways. Either use Year() function or year format.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 18:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280513#M56702</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-27T18:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280768#M56793</link>
      <description>&lt;P&gt;Am really thank full&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12460"&gt;@jklaverstijn﻿&lt;/a&gt;&lt;SPAN class="login-bold"&gt;Jklaverstin&amp;nbsp;you have solved my question, actually i tried in many ways but you have given me perfect solution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;now i can continue my practice&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;And thanks for others too who replayed&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/highest-value/m-p/280768#M56793</guid>
      <dc:creator>Prashant_Ph</dc:creator>
      <dc:date>2016-06-28T13:14:08Z</dc:date>
    </item>
  </channel>
</rss>

