<?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 To find the second Highest Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26887#M4809</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data l;
input id ddmmyy10.;
format id ddmmyy10.;
cards;
12/01/2011
10/12/2010
19/02/2011
23/08/2011
;
run;
proc sort data=l out=temp nodupkey; by descending id;run;
data _null_;
 set temp ;
 if _n_ eq 2 then do; putlog 'Second Largest is : ' id ddmmyy10.;stop;end;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jan 2012 07:57:19 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-01-10T07:57:19Z</dc:date>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26886#M4808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data l;&lt;/P&gt;&lt;P&gt;input id anydtdte11.;&lt;/P&gt;&lt;P&gt;format id ddmmyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;12/01/2011&lt;/P&gt;&lt;P&gt;10/12/2010&lt;/P&gt;&lt;P&gt;19/02/2011&lt;/P&gt;&lt;P&gt;23/08/2011&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 07:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26886#M4808</guid>
      <dc:creator>sas_Forum</dc:creator>
      <dc:date>2012-01-10T07:08:37Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26887#M4809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data l;
input id ddmmyy10.;
format id ddmmyy10.;
cards;
12/01/2011
10/12/2010
19/02/2011
23/08/2011
;
run;
proc sort data=l out=temp nodupkey; by descending id;run;
data _null_;
 set temp ;
 if _n_ eq 2 then do; putlog 'Second Largest is : ' id ddmmyy10.;stop;end;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 07:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26887#M4809</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-10T07:57:19Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26888#M4810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or as a variation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=l out=temp nodupkey; by descending id;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set temp (obs=2 firstobs=2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; putlog 'Second Largest is : ' id ddmmyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 09:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26888#M4810</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-01-10T09:48:43Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26889#M4811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your data file is quite small (i.e., less than 5000 or so records) you might be able to get away with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data l;&lt;/P&gt;&lt;P&gt;input id anydtdte11.;&lt;/P&gt;&lt;P&gt;format id ddmmyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;12/01/2011&lt;/P&gt;&lt;P&gt;10/12/2010&lt;/P&gt;&lt;P&gt;19/02/2011&lt;/P&gt;&lt;P&gt;23/08/2011&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select id&amp;nbsp; format=best12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :ids separated by ','&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from l;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct largest(2,&amp;amp;ids.) format=date9.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; as highest&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from l;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 14:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26889#M4811</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-10T14:13:41Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26890#M4812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Here is method using hash objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; dt &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;ddmmyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;12/01/2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;10/12/2010&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;19/02/2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;23/08/2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;if&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;declare&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; hash foo(dataset:&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'have'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;,ordered:&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'d'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;declare&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; hiter iter(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'foo'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; foo.definekey(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'dt'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; foo.definedata(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'dt'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; foo.definedone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; iter.first(); iter.next();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;putlog&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'Second Largest is : '&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; dt &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 14:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26890#M4812</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-01-10T14:31:47Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26891#M4813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table l2 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct max(a.id) as id format=ddmmyy10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from l as a left join (select max(id) as id from l) as b on b.id &amp;gt; a.id;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 14:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26891#M4813</guid>
      <dc:creator>TD</dc:creator>
      <dc:date>2012-01-10T14:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26892#M4814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; another way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; l;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; id &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;anydtdte11.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; id &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;ddmmyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;12/01/2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;10/12/2010&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;19/02/2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;23/08/2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;transpose&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;=l &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;=temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; x(*) col:;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; sortn(of x(*));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;putlog&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'Second Largest is : '&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; x(dim(x)-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;ddmmyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;Linlin&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 14:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26892#M4814</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-01-10T14:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26893#M4815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... if you've already trasposed the data, how about just using the LARGEST function ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set temp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;second = largest(2,of col:);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;putlog 'Second Largest is : ' second ddmmyy10.;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 04:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26893#M4815</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-01-11T04:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26894#M4816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thank you Mike!&lt;/P&gt;&lt;P&gt;you are right, it is more efficient using "second=largest(2,of col:)";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 13:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26894#M4816</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-01-11T13:28:22Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26895#M4817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data l;&lt;/P&gt;&lt;P&gt;input id anydtdte11.;&lt;/P&gt;&lt;P&gt;format id ddmmyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;12/01/2011&lt;/P&gt;&lt;P&gt;10/12/2010&lt;/P&gt;&lt;P&gt;19/02/2011&lt;/P&gt;&lt;P&gt;23/08/2011&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select unique(id)&lt;/P&gt;&lt;P&gt;&amp;nbsp; into :id1 - :id2&lt;/P&gt;&lt;P&gt;&amp;nbsp; from work.l&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by id descending;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put ID2: &amp;amp;id2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 20:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26895#M4817</guid>
      <dc:creator>Jay_OAG</dc:creator>
      <dc:date>2012-01-11T20:50:59Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26896#M4818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;select&lt;/SPAN&gt; &lt;SPAN style="color: #008000;"&gt;/* distinct */&lt;/SPAN&gt; id&amp;nbsp; format=&lt;SPAN style="color: #008080;"&gt;best12.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;into&lt;/SPAN&gt; :ids separated &lt;SPAN style="color: #0000ff;"&gt;by&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;','&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;from&lt;/SPAN&gt; l;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;select&lt;/SPAN&gt; largest(&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;,&amp;amp;&lt;SPAN style="color: #008080;"&gt;ids.&lt;/SPAN&gt;) format=&lt;SPAN style="color: #008080;"&gt;date9.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;as&lt;/SPAN&gt; highest&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;from&lt;/SPAN&gt; sashelp.class(obs=&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use of DISTINCT in the first SELECT depends upon how ties are to be treated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No need for DISTINCT in the second SELECT if only one row is processed. The FROM clause can point to any table having at least one row and one column.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 02:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26896#M4818</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2012-01-12T02:35:32Z</dc:date>
    </item>
    <item>
      <title>To find the second Highest Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26897#M4819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data l;
input id ddmmyy10.;
format id ddmmyy10.;
cards;
12/01/2011
10/12/2010
19/02/2011
23/08/2011
;
run;
ods select extremevalues;
proc univariate nextrval=2;
 var id;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 05:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-find-the-second-Highest-Date/m-p/26897#M4819</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-12T05:10:21Z</dc:date>
    </item>
  </channel>
</rss>

