<?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: 3 largest values per category output in three different rows.  How to get 3 largest values on one row. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194891#M36659</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up using the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA work.top_3_serv;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET work.top_3_allwd_a; By year attributed_tin_nm_rllp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * Tells SAS not to reset these variables to &lt;/P&gt;&lt;P&gt;&amp;nbsp; missing when going to top of datastep;&lt;/P&gt;&lt;P&gt;&amp;nbsp; FORMAT first second third $CHAR105.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; RETAIN first second third percent1 percent2 percent3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * Set variables to missing when reading new &lt;/P&gt;&lt;P&gt;&amp;nbsp; member - clear previous member's data!;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if FIRST.attributed_tin_nm_rllp = 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; first=''; second=''; third=''; &lt;/P&gt;&lt;P&gt;&amp;nbsp; percent1=.; percent2=.; percent3=.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if count = 1 then do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; first = prov_name_serv; percent1= percent_of_allwd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if count = 2 then do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; second = prov_name_serv; percent2= percent_of_allwd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if count = 3 then do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; third = prov_name_serv; percent3= percent_of_allwd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * Output variables only when done with member;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if LAST.attributed_tin_nm_rllp = 1 then OUTPUT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; KEEP year attributed_tin_nm_rllp first second third percent1 percent2 percent3;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jul 2015 15:13:11 GMT</pubDate>
    <dc:creator>acemanhattan</dc:creator>
    <dc:date>2015-07-10T15:13:11Z</dc:date>
    <item>
      <title>3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194886#M36654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I currently have a table that outputs top 3 servicing providers referred to by a given provider in the following fashion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Provider&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Servicer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Percent&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_1_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1st%_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_2_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2nd%_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_3_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3rd%_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_1_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1st%_2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_2_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2nd%_2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_3_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3rd%_2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_1_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1st%_K&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_2_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2nd%_K&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_3_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3rd%_K&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm hoping for is a table more like the following:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Provider&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Top Servicer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Top Percent&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Second Servicer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Second Percent&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Thrid Servicer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Third Percent&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_1_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1st%_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_2_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2nd%_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_3_1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3rd%_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider 2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_1_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1st%_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Sercicer_2_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2nd%_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_3_2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3rd%_2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Provider K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_1_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1st%_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_2_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2nd%_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Servicer_3_K&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3rd%_K&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 02:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194886#M36654</guid>
      <dc:creator>acemanhattan</dc:creator>
      <dc:date>2015-07-03T02:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: 3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194887#M36655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplest way is using proc means + idgroup .&lt;/P&gt;&lt;P&gt;Or you could try the MERGE skill me,Matt,Arthur.T have talked about it at :&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf" title="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf"&gt;http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #353535; font-family: Lato, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;H3&gt;Code: Program&lt;/H3&gt;&lt;DIV class="sce-html-export" style="font-family: 'Courier New', Menlo, 'Lucida Console';"&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;provider&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;service&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;percent&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;p1 s1 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;p1 s2 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;p1 s3 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;p2 s1 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;p2 s2 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;max&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;into&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;group&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;provider&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;provider&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;out&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;want&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;idgroup&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;out&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;service&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;percent&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 12:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194887#M36655</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-03T12:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: 3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194888#M36656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I forgot that for some of the providers there aren't 3 providers that have been referred to (e.g. one provider may have only every referred to themselves and one other clinic, or maybe they'd have only "referred" to themselves). Will this make a difference with respect to the code you've posted, or would it have to modified?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 21:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194888#M36656</guid>
      <dc:creator>acemanhattan</dc:creator>
      <dc:date>2015-07-03T21:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: 3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194889#M36657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What you're looking for is a Transpose.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Most solutions deal with the fact that there are less than the maximum number.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 21:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194889#M36657</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-03T21:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: 3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194890#M36658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem . proc mean + idgroup can handle the variety number of patient.&lt;/P&gt;&lt;P&gt;But you need pick up these 3 largest obs firstly .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 01:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194890#M36658</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-04T01:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: 3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194891#M36659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up using the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA work.top_3_serv;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET work.top_3_allwd_a; By year attributed_tin_nm_rllp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * Tells SAS not to reset these variables to &lt;/P&gt;&lt;P&gt;&amp;nbsp; missing when going to top of datastep;&lt;/P&gt;&lt;P&gt;&amp;nbsp; FORMAT first second third $CHAR105.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; RETAIN first second third percent1 percent2 percent3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * Set variables to missing when reading new &lt;/P&gt;&lt;P&gt;&amp;nbsp; member - clear previous member's data!;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if FIRST.attributed_tin_nm_rllp = 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; first=''; second=''; third=''; &lt;/P&gt;&lt;P&gt;&amp;nbsp; percent1=.; percent2=.; percent3=.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if count = 1 then do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; first = prov_name_serv; percent1= percent_of_allwd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if count = 2 then do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; second = prov_name_serv; percent2= percent_of_allwd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if count = 3 then do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; third = prov_name_serv; percent3= percent_of_allwd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * Output variables only when done with member;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if LAST.attributed_tin_nm_rllp = 1 then OUTPUT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; KEEP year attributed_tin_nm_rllp first second third percent1 percent2 percent3;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 15:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194891#M36659</guid>
      <dc:creator>acemanhattan</dc:creator>
      <dc:date>2015-07-10T15:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: 3 largest values per category output in three different rows.  How to get 3 largest values on one row.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194892#M36660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC SUMMARY with IDGROUP can be used to find the top three servicers(name) for any given variable(weight) and output the results in wide format.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;summary&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=sashelp.class &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;nway&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sex;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=top3wt &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;idgroup&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;max&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(weight) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;[&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;3&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;](weight name)=);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 17:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/3-largest-values-per-category-output-in-three-different-rows-How/m-p/194892#M36660</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-07-10T17:27:30Z</dc:date>
    </item>
  </channel>
</rss>

