<?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 Getting second lowest value By group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856534#M338434</link>
    <description>&lt;P&gt;I know that the following SQL code is used to get the second-lowest value overall from a table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
SELECT id, min (value) 
FROM table_name
WHERE value NOT IN (SELECT min (value) 
                          FROM table_name); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token datalines string"&gt;&lt;SPAN class="token punctuation"&gt;How can I modify the Sql code I have to achieve this? Or is there any other way to do this?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 20:25:12 GMT</pubDate>
    <dc:creator>nstdt</dc:creator>
    <dc:date>2023-01-31T20:25:12Z</dc:date>
    <item>
      <title>Getting second lowest value By group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856534#M338434</link>
      <description>&lt;P&gt;I know that the following SQL code is used to get the second-lowest value overall from a table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
SELECT id, min (value) 
FROM table_name
WHERE value NOT IN (SELECT min (value) 
                          FROM table_name); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token datalines string"&gt;&lt;SPAN class="token punctuation"&gt;How can I modify the Sql code I have to achieve this? Or is there any other way to do this?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 20:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856534#M338434</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-01-31T20:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting second lowest value By group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856535#M338435</link>
      <description>&lt;P&gt;Don't use SQL. Use PROC SORT or PROC RANK.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 20:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856535#M338435</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-31T20:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting second lowest value By group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856537#M338437</link>
      <description>&lt;P&gt;data step it for this task in SAS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id value;
cards;
1 1
1 2 
1 3
3 300
3 200
3 100
2 3
2 4 
2 5
;
run;
proc print data=have;
run;


proc sort data=have out=want;
  by id value;
run;

data want;
  set want;
  by id;

  if first.id then Marker=0;
  Marker+1;

  if marker = 2;
  drop Marker;
run;

proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 20:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-second-lowest-value-By-group/m-p/856537#M338437</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-01-31T20:37:34Z</dc:date>
    </item>
  </channel>
</rss>

