<?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 get Max(avg(Variable)) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307381#M65820</link>
    <description>&lt;P&gt;What does not working mean?&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2016 13:27:49 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-10-26T13:27:49Z</dc:date>
    <item>
      <title>how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307368#M65814</link>
      <description>&lt;P&gt;I want Section, Std who is having highest Avergare Marks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also please advice anyweblink/soft copy/ thru which i can improve proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you so much in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ds1;&lt;BR /&gt;input section $ std $Subject $ Marks;&lt;BR /&gt;datalines;&lt;BR /&gt;A Ramesh Maths 30&lt;BR /&gt;A Ramesh English 40&lt;BR /&gt;A Ramesh Hindi 50&lt;BR /&gt;A Suresh Maths 60&lt;BR /&gt;A Suresh English 70&lt;BR /&gt;A Suresh Hindi 80&lt;BR /&gt;B Mahesh Maths 30&lt;BR /&gt;B Mahesh English 60&lt;BR /&gt;B Mahesh Hindi 50&lt;BR /&gt;B Kailash Maths 80&lt;BR /&gt;B Kailash English 90&lt;BR /&gt;B Kailash Hindi 90&lt;BR /&gt;;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select max(Avg(Marks) from ds1 group by std;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 12:57:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307368#M65814</guid>
      <dc:creator>atul_desh</dc:creator>
      <dc:date>2016-10-26T12:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307372#M65816</link>
      <description>&lt;P&gt;Something like the below? &amp;nbsp;You haven't shown what the output should look like.&lt;/P&gt;
&lt;P&gt;To learn SQL, if that is your other question, there are many resources online, Google them. &amp;nbsp;W3 schools for instance is a good reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data ds1;
input section $ std $Subject $ Marks;
datalines;
A Ramesh Maths 30
A Ramesh English 40
A Ramesh Hindi 50
A Suresh Maths 60
A Suresh English 70
A Suresh Hindi 80
B Mahesh Maths 30
B Mahesh English 60
B Mahesh Hindi 50
B Kailash Maths 80
B Kailash English 90
B Kailash Hindi 90
;
run;
proc sql;
  create table WANT as
  select  SECTION,
          STD
  from    (select SECTION,
                  STD,
                  AVG(MARKS) as AVG_MARKS
           from   DS1 
           group by SECTION,
                    STD)
  group by SECTION,
           STD
  having  AVG_MARKS=max(AVG_MARKS);
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307372#M65816</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-26T13:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307377#M65819</link>
      <description>&lt;P&gt;I want section, Std in output who is having highest Average marks...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure but&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;having &amp;nbsp;AVG_MARKS=max(AVG_MARKS) is not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307377#M65819</guid>
      <dc:creator>atul_desh</dc:creator>
      <dc:date>2016-10-26T13:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307381#M65820</link>
      <description>&lt;P&gt;What does not working mean?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307381#M65820</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-26T13:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307384#M65822</link>
      <description>&lt;P&gt;Do you need to use SQL? PROC MEANS can compute the means for each section and student. Then just sort the data or use SQL on the output statistics:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* compute mean of each student in each section */
proc means data=ds1 noprint;
by section;
class std;
output mean= out=MeanOut(where=(_TYPE_=1) drop=_FREQ_);
run;

/* sort by mean marks */
proc sort data=MeanOut; by Marks; run;

proc print noobs data=MeanOut(obs=1 drop=_TYPE_); run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307384#M65822</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-10-26T13:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307394#M65826</link>
      <description>&lt;P&gt;Thanks Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but i want if it could done with proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your support !!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307394#M65826</guid>
      <dc:creator>atul_desh</dc:creator>
      <dc:date>2016-10-26T13:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307400#M65830</link>
      <description>&lt;P&gt;Per&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;, what is not working. &amp;nbsp;Are there log outputs? &amp;nbsp;What should the output look like, is it a logic problem?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307400#M65830</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-26T13:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to get Max(avg(Variable))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307410#M65833</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
input section $ std $Subject $ Marks;
datalines;
A Ramesh Maths 30
A Ramesh English 40
A Ramesh Hindi 50
A Suresh Maths 60
A Suresh English 70
A Suresh Hindi 80
B Mahesh Maths 30
B Mahesh English 60
B Mahesh Hindi 50
B Kailash Maths 80
B Kailash English 90
B Kailash Hindi 90
;
run;
proc sql;
  select  *
  from    (select SECTION,
                  STD,
                  AVG(MARKS) as AVG_MARKS
           from   DS1 
           group by SECTION,
                    STD)
  
  having  AVG_MARKS=max(AVG_MARKS);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Oct 2016 14:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-Max-avg-Variable/m-p/307410#M65833</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-26T14:17:23Z</dc:date>
    </item>
  </channel>
</rss>

