<?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: Reordering rows in a  dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500666#M72627</link>
    <description>&lt;P&gt;Use&lt;/P&gt;
&lt;P&gt;break &lt;STRONG&gt;before&lt;/STRONG&gt; cental/summarize;&lt;/P&gt;
&lt;P&gt;rbreak &lt;STRONG&gt;before&lt;/STRONG&gt; cental/summarize;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Oct 2018 10:47:05 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-10-02T10:47:05Z</dc:date>
    <item>
      <title>Reordering rows in a  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500590#M72617</link>
      <description>&lt;P&gt;Hello, I'm bit new in SAS. I have a dataset made via a proc report like this one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Central&lt;/U&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;U&gt;Generation&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Central1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 394&lt;/P&gt;&lt;P&gt;Central2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8384&lt;/P&gt;&lt;P&gt;Central3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 384&lt;/P&gt;&lt;P&gt;Total H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (sum)&lt;/P&gt;&lt;P&gt;Central4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2342&lt;/P&gt;&lt;P&gt;Central5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2321&lt;/P&gt;&lt;P&gt;Total T&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(sum)&lt;/P&gt;&lt;P&gt;Total Agent&amp;nbsp; &amp;nbsp;(total sum)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is change the position of the 'Total' rows to the beggining of each block. The original dataset has 52 of these blocks, I mean, somethig like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Central&lt;/U&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;U&gt;Generation&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Total Agent&amp;nbsp; &amp;nbsp;(total sum)&lt;/P&gt;&lt;P&gt;Total H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (sum)&lt;/P&gt;&lt;P&gt;Central1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 394&lt;/P&gt;&lt;P&gt;Central2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8384&lt;/P&gt;&lt;P&gt;Central3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 384&lt;/P&gt;&lt;P&gt;Total T&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(sum)&lt;/P&gt;&lt;P&gt;Central4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2342&lt;/P&gt;&lt;P&gt;Central5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2321&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to perform this? Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 22:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500590#M72617</guid>
      <dc:creator>MathJack901015</dc:creator>
      <dc:date>2018-10-01T22:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering rows in a  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500592#M72618</link>
      <description>Not easily. Add another variable that contains your sort order which has to be somewhat manual and then sort it.  In general, this is why there's a recommendation to not store totals and subtotals in data sets but calculate them in reporting procedures such as PROC REPORT.</description>
      <pubDate>Mon, 01 Oct 2018 22:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500592#M72618</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-01T22:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering rows in a  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500598#M72619</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/237482"&gt;@MathJack901015&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I'm bit new in SAS. I have a dataset made via a proc report like this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Central&lt;/U&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;U&gt;Generation&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Central1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 394&lt;/P&gt;
&lt;P&gt;Central2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8384&lt;/P&gt;
&lt;P&gt;Central3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 384&lt;/P&gt;
&lt;P&gt;Total H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (sum)&lt;/P&gt;
&lt;P&gt;Central4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2342&lt;/P&gt;
&lt;P&gt;Central5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2321&lt;/P&gt;
&lt;P&gt;Total T&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(sum)&lt;/P&gt;
&lt;P&gt;Total Agent&amp;nbsp; &amp;nbsp;(total sum)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want is change the position of the 'Total' rows to the beggining of each block. The original dataset has 52 of these blocks, I mean, somethig like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Central&lt;/U&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;U&gt;Generation&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Total Agent&amp;nbsp; &amp;nbsp;(total sum)&lt;/P&gt;
&lt;P&gt;Total H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (sum)&lt;/P&gt;
&lt;P&gt;Central1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 394&lt;/P&gt;
&lt;P&gt;Central2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8384&lt;/P&gt;
&lt;P&gt;Central3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 384&lt;/P&gt;
&lt;P&gt;Total T&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(sum)&lt;/P&gt;
&lt;P&gt;Central4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2342&lt;/P&gt;
&lt;P&gt;Central5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2321&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to perform this? Thanks in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You might be able to do the "report" with proc tabulate as that allows group totals to come first.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class age sex;
   table all='Overall Count' ( age='')*(all='Age Count' sex=''),
         n;
run;&lt;/PRE&gt;
&lt;P&gt;Proc tabulate also creates output data sets but working with them may be a tad daunting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 23:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500598#M72619</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-01T23:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering rows in a  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500666#M72627</link>
      <description>&lt;P&gt;Use&lt;/P&gt;
&lt;P&gt;break &lt;STRONG&gt;before&lt;/STRONG&gt; cental/summarize;&lt;/P&gt;
&lt;P&gt;rbreak &lt;STRONG&gt;before&lt;/STRONG&gt; cental/summarize;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 10:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reordering-rows-in-a-dataset/m-p/500666#M72627</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-10-02T10:47:05Z</dc:date>
    </item>
  </channel>
</rss>

