<?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 Want min of age from sashelp.class dataset using Proc SQL? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236132#M55197</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to find name of whose age is mininum in the sashelp.class dataset using proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying using below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select min(age), name from sashelp.class;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but is giving all 19 records with min 11 age on all records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want record/s with minimum age and their name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case.. 11th and 18th records in class dataset having age is 11, which is minimum .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2015 06:30:24 GMT</pubDate>
    <dc:creator>vandhan</dc:creator>
    <dc:date>2015-11-24T06:30:24Z</dc:date>
    <item>
      <title>Want min of age from sashelp.class dataset using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236132#M55197</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to find name of whose age is mininum in the sashelp.class dataset using proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying using below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select min(age), name from sashelp.class;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but is giving all 19 records with min 11 age on all records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want record/s with minimum age and their name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case.. 11th and 18th records in class dataset having age is 11, which is minimum .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 06:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236132#M55197</guid>
      <dc:creator>vandhan</dc:creator>
      <dc:date>2015-11-24T06:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Want min of age from sashelp.class dataset using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236134#M55198</link>
      <description>&lt;P&gt;One of the way is to use subquery in SQL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select&lt;BR /&gt;a.name,&lt;BR /&gt;a.age&lt;BR /&gt;from sashelp.class as a&lt;BR /&gt;where a.age in&lt;BR /&gt;(select min(age) from sashelp.class )&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 06:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236134#M55198</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2015-11-24T06:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Want min of age from sashelp.class dataset using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236136#M55199</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select name , age 
  from sashelp.class
 where age in (select min(age) 
 				 from sashelp.class); 

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It gives 2 rows as they both have age 11 which is the least.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	
        Name    Age
1	Joyce	11
2	Thomas	11&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2015 06:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236136#M55199</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-24T06:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Want min of age from sashelp.class dataset using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236137#M55200</link>
      <description>&lt;P&gt;The reason your query returned 19 rows because you selected min (age) for each name. Hence the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that explains.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good Luck...!!!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 06:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236137#M55200</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-24T06:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Want min of age from sashelp.class dataset using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236138#M55201</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select *
  from sashelp.class
  having min(age)=age
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2015 06:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Want-min-of-age-from-sashelp-class-dataset-using-Proc-SQL/m-p/236138#M55201</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-11-24T06:58:34Z</dc:date>
    </item>
  </channel>
</rss>

