<?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: Order of rows in Proc Report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Order-of-rows-in-Proc-Report/m-p/477059#M71258</link>
    <description>&lt;P&gt;The log says it all. To be more specific, you can't use a computed value for ordering, as ordering in proc report takes place before values are computed.&lt;/P&gt;
&lt;P&gt;Create the variable first, and then use it for ordering in proc report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input branch X1  X2  X3  X4;
total = sum(x1,x2,x3,x4);
cards;
1  10 20 30 40 
2  15 20 25 30
3  35 40 45 50
4  55 60 65 .
;
run;


proc report data=tbl  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch X1  X2  X3  X4  total;
define branch/ display 
	"Branch"  center;
define X1/  Display "X1 amount";
define X2/  Display "X2 amount";
define X3/  Display "X3 amount";
define X4/  Display "X4 amount";
define total/order descending;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Jul 2018 12:57:57 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-07-11T12:57:57Z</dc:date>
    <item>
      <title>Order of rows in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Order-of-rows-in-Proc-Report/m-p/477048#M71257</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am using proc report to display data and calculate a new field.&lt;/P&gt;&lt;P&gt;I want that the rows in the output of Proc Report will be ordered by value of total_x (descending&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Data tbl;
 input branch X1  X2  X3  X4;
 cards;
 1  10 20 30 40 
 2  15 20 25 30
 3  35 40 45 50
 4  55 60 65 .
 ;
 run;


proc report data=tbl  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch X1  X2  X3  X4  total;
define branch/ display 
	"Branch"  center;
define X1/  Display "X1 amount";
define X2/  Display "X2 amount";
define X3/  Display "X3 amount";
define X4/  Display "X4 amount";
define total/computed order=internal descending ;  
compute total;  
total=sum(x1,x2,x3,x4); 
endcomp;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 12:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Order-of-rows-in-Proc-Report/m-p/477048#M71257</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-07-11T12:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Order of rows in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Order-of-rows-in-Proc-Report/m-p/477059#M71258</link>
      <description>&lt;P&gt;The log says it all. To be more specific, you can't use a computed value for ordering, as ordering in proc report takes place before values are computed.&lt;/P&gt;
&lt;P&gt;Create the variable first, and then use it for ordering in proc report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input branch X1  X2  X3  X4;
total = sum(x1,x2,x3,x4);
cards;
1  10 20 30 40 
2  15 20 25 30
3  35 40 45 50
4  55 60 65 .
;
run;


proc report data=tbl  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch X1  X2  X3  X4  total;
define branch/ display 
	"Branch"  center;
define X1/  Display "X1 amount";
define X2/  Display "X2 amount";
define X3/  Display "X3 amount";
define X4/  Display "X4 amount";
define total/order descending;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Jul 2018 12:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Order-of-rows-in-Proc-Report/m-p/477059#M71258</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-11T12:57:57Z</dc:date>
    </item>
  </channel>
</rss>

