<?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: min obs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459185#M116604</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data min;
input stid marks;
datalines;
101 98
102 87
103 58
100 52
;

proc sql;
create table want as
select stid,(select min(marks) from min) as marks
from min
where calculated marks=marks;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I disagree with proc sort. Rather, look at &lt;STRONG&gt;proc rank.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 May 2018 05:11:43 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-05-02T05:11:43Z</dc:date>
    <item>
      <title>min obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459182#M116601</link>
      <description>&lt;P&gt;i have a dataset like following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data min;&lt;/P&gt;&lt;P&gt;input stid marks;&lt;/P&gt;&lt;P&gt;101 98&lt;/P&gt;&lt;P&gt;102 87&lt;/P&gt;&lt;P&gt;103 58&lt;/P&gt;&lt;P&gt;100 52&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;question::&amp;nbsp; i want least stid along with his marks using sql query...........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 04:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459182#M116601</guid>
      <dc:creator>raj143</dc:creator>
      <dc:date>2018-05-02T04:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: min obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459183#M116602</link>
      <description>&lt;P&gt;his marks? meaning whose marks? What is your expected output?&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 04:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459183#M116602</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-02T04:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: min obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459184#M116603</link>
      <description>&lt;P&gt;You want the stid and marks variables, but only for for the stid with the lowest marks value? A proc sort with the output only having 1 observation could do it. However it will only give you one result even if multiple stid have the same lowest marks value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=min out=lowest_marks (obs=1);by marks;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want all of the stid that have the same lowest marks value you can use an sql subquery to find the lowest marks value, and inner join on that to get all the relevant stid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table lowest_marks as
select *
from min as a
inner join (select min(marks) as lowest_marks from min) as b
	on a.marks = b.lowest_marks
;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 04:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459184#M116603</guid>
      <dc:creator>JChambo</dc:creator>
      <dc:date>2018-05-02T04:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: min obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459185#M116604</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data min;
input stid marks;
datalines;
101 98
102 87
103 58
100 52
;

proc sql;
create table want as
select stid,(select min(marks) from min) as marks
from min
where calculated marks=marks;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I disagree with proc sort. Rather, look at &lt;STRONG&gt;proc rank.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 05:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459185#M116604</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-02T05:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: min obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459291#M116641</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data min;
input stid marks;
datalines;
101 98
102 87
103 58
100 52
;

proc sql;
select *
from min
having marks=min(marks);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 13:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-obs/m-p/459291#M116641</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-05-02T13:14:46Z</dc:date>
    </item>
  </channel>
</rss>

