<?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: Grouping lowest to highest when blank value exists in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396725#M66547</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; title 'A UNION B';&lt;/P&gt;&lt;P&gt;&amp;nbsp;create table setup_summ as&lt;/P&gt;&lt;P&gt;select cost_ctr,count(cnt) as cnt1&lt;/P&gt;&lt;P&gt;from setup&lt;/P&gt;&lt;P&gt;where your_variable ne ' ' &lt;STRONG&gt;/*Please notice here and change accordingly*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;group by cost_ctr&lt;/P&gt;&lt;P&gt;order by cost_ctr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; union&lt;/P&gt;&lt;P&gt;&amp;nbsp; select cost_ctr,count(cnt) as cnt1&lt;/P&gt;&lt;P&gt;from setup&lt;/P&gt;&lt;P&gt;where your_variable=' ' &lt;STRONG&gt;/*Please notice here and change accordingly*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;group by cost_ctr;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 04:08:17 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2017-09-18T04:08:17Z</dc:date>
    <item>
      <title>Grouping lowest to highest when blank value exists</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396722#M66546</link>
      <description>&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;create table setup_summ as&lt;/P&gt;
&lt;P&gt;select cost_ctr,count(cnt) as cnt1&lt;/P&gt;
&lt;P&gt;from setup&lt;/P&gt;
&lt;P&gt;group by cost_ctr&lt;/P&gt;
&lt;P&gt;order by cost_ctr&lt;/P&gt;
&lt;P&gt;;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cost_ctr&amp;nbsp;&amp;nbsp; Cnt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;
&lt;P&gt;4320102&amp;nbsp;&amp;nbsp;&amp;nbsp; 133&lt;/P&gt;
&lt;P&gt;4320105&amp;nbsp;&amp;nbsp;&amp;nbsp; 294&lt;/P&gt;
&lt;P&gt;4320545&amp;nbsp;&amp;nbsp;&amp;nbsp; 957&lt;/P&gt;
&lt;P&gt;4327979&amp;nbsp;&amp;nbsp;&amp;nbsp; 619&lt;/P&gt;
&lt;P&gt;4327983&amp;nbsp;&amp;nbsp;&amp;nbsp; 489&lt;/P&gt;
&lt;P&gt;4327984&amp;nbsp;&amp;nbsp;&amp;nbsp; 493&lt;/P&gt;
&lt;P&gt;4327985&amp;nbsp;&amp;nbsp;&amp;nbsp; 529&lt;/P&gt;
&lt;P&gt;4327996&amp;nbsp;&amp;nbsp;&amp;nbsp; 51&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried defining cost_ctr as both numeric and text. As you can see if no cost_ctr exists the blank cost center goes to the top&lt;/P&gt;
&lt;P&gt;I want the blank cost center to show at the bottom however I still want to sort by cost center from lowest to the highest. The sequence should be the same except the blank one should show at the bottom.&amp;nbsp; How can I accomplish this&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 03:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396722#M66546</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2017-09-18T03:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping lowest to highest when blank value exists</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396725#M66547</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; title 'A UNION B';&lt;/P&gt;&lt;P&gt;&amp;nbsp;create table setup_summ as&lt;/P&gt;&lt;P&gt;select cost_ctr,count(cnt) as cnt1&lt;/P&gt;&lt;P&gt;from setup&lt;/P&gt;&lt;P&gt;where your_variable ne ' ' &lt;STRONG&gt;/*Please notice here and change accordingly*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;group by cost_ctr&lt;/P&gt;&lt;P&gt;order by cost_ctr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; union&lt;/P&gt;&lt;P&gt;&amp;nbsp; select cost_ctr,count(cnt) as cnt1&lt;/P&gt;&lt;P&gt;from setup&lt;/P&gt;&lt;P&gt;where your_variable=' ' &lt;STRONG&gt;/*Please notice here and change accordingly*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;group by cost_ctr;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 04:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396725#M66547</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-18T04:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping lowest to highest when blank value exists</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396730#M66548</link>
      <description>&lt;P&gt;In sql you can do something like this.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select a.cost_ctr, a.cnt from 
(select cost_ctr, cnt from have)a
cross join
(select  max(cost_ctr) +1 as nmax from have)b
order by coalesce(a.cost_ctr, nmax) ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 05:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Grouping-lowest-to-highest-when-blank-value-exists/m-p/396730#M66548</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-09-18T05:30:25Z</dc:date>
    </item>
  </channel>
</rss>

