<?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 sorting proc report by the values in the individual across columns in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616196#M23667</link>
    <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to sort the sashelp.cars dataset by the values in the individuals type groups:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.cars;
	columns make type, horsepower;
	define make /group;
	define type /across;
	define horsepower /max;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So the final output should sort by Wagon BHP, then by Truck BHP, etc. Is this possible without having to transpose and pre-sort the dataset? Thank you for your help in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2020 14:05:14 GMT</pubDate>
    <dc:creator>js5</dc:creator>
    <dc:date>2020-01-09T14:05:14Z</dc:date>
    <item>
      <title>sorting proc report by the values in the individual across columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616196#M23667</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to sort the sashelp.cars dataset by the values in the individuals type groups:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.cars;
	columns make type, horsepower;
	define make /group;
	define type /across;
	define horsepower /max;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So the final output should sort by Wagon BHP, then by Truck BHP, etc. Is this possible without having to transpose and pre-sort the dataset? Thank you for your help in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 14:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616196#M23667</guid>
      <dc:creator>js5</dc:creator>
      <dc:date>2020-01-09T14:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: sorting proc report by the values in the individual across columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616204#M23668</link>
      <description>&lt;P&gt;If you can't do it with order= option such as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;define type /across order=data;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then it's far less trouble to just pre-sort the data in the way you want the across columns to appear.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 14:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616204#M23668</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-01-09T14:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: sorting proc report by the values in the individual across columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616219#M23671</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223838"&gt;@js5&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would add 'descending' to the DEFINE statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	define type /across descending;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="page" title="Page 2"&gt;
&lt;DIV class="section"&gt;
&lt;DIV class="layoutArea"&gt;
&lt;DIV class="column"&gt;
&lt;P&gt;&lt;SPAN&gt;In fact, order = data sorts the categories in the order that the variable values are encountered in the data set.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The default order, which is 'formatted' sort the data&amp;nbsp;&lt;/SPAN&gt;by the variable’s formatted values.&lt;/P&gt;
&lt;P&gt;in your case, I understand that you want an alphabetical descending order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jan 2020 14:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616219#M23671</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-01-09T14:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: sorting proc report by the values in the individual across columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616403#M23675</link>
      <description>&lt;P&gt;Thank you both for your responses! Unfortunately, all the options do is change the order of the type columns. What I need is to sort the make by the max BHP values in the specific colums:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;first by max SUV BHP&lt;/LI&gt;&lt;LI&gt;then by max Sedan BHP&lt;/LI&gt;&lt;LI&gt;then by max Sports BHP&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;etc. Is this possible with proc report alone, or would I need to transpose the data first?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616403#M23675</guid>
      <dc:creator>js5</dc:creator>
      <dc:date>2020-01-10T10:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: sorting proc report by the values in the individual across columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616554#M23678</link>
      <description>Hi:&lt;BR /&gt;  You cannot order the ACROSS items by the value of the statistic. In your program, you are asking PROC REPORT to calculate the MAX of horsepower, so PROC REPORT will not calculate the MAX and then also order by the calculated max. In this instance, you would need to make 2 passes through the data -- one to calculate the max horsepower for each type and then you'd sort by MAX horsepower within type. Then the next (probably using PROC REPORT) to display the already calculated max values and here's where ORDER=DATA will come in handy if you've already calculated the max and ordered.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Fri, 10 Jan 2020 17:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/sorting-proc-report-by-the-values-in-the-individual-across/m-p/616554#M23678</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-01-10T17:48:06Z</dc:date>
    </item>
  </channel>
</rss>

