<?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: PROC REPORT Order Variable: integer vs. non-integer in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714575#M80075</link>
    <description>&lt;P&gt;Please show us the code you are using, and the output that is not correct.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 14:00:28 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-01-27T14:00:28Z</dc:date>
    <item>
      <title>PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714572#M80074</link>
      <description>&lt;P&gt;Quick question.&amp;nbsp; I had a simple sort variable in a proc report variable that contained only integers.&amp;nbsp; But yesterday I had to insert new values, and since there were no integers available for the slot I wanted the new values in, I used 4.5 (it went between existing 4 and existing 5 categories).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC REPORT would not put them in the right order.&amp;nbsp; It was a simple solution, I just renumbered the entire list so that they were all integers again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But is there any reason why PROC REPORT would not handle an ORDER = sortvariable when sortvariable contains a mix of integers and non-integers?&amp;nbsp; I feel like I have done that many times without issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...dave&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 13:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714572#M80074</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2021-01-27T13:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714575#M80075</link>
      <description>&lt;P&gt;Please show us the code you are using, and the output that is not correct.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 14:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714575#M80075</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-27T14:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714583#M80076</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/175401"&gt;@davehalltwp&lt;/a&gt;&amp;nbsp; Like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Please show your code, part of the output etc. I am intrigued as Proc report generally uses formatted value as the default order. Therefore, I would recommend to use an explicit numeric format to get the desired. Example-&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*Sample*/
data have;
 do i='a','b';
   do j=1 to 2 by .2;
    output;
   end;
 end;
run;
/*Rearrange in random order*/
proc sql;
 create table _have as
 select *
 from have
 order by i,rand('uniform');
quit;
/*Test the report*/
proc report data=_have;
 columns i j;
 define i/order;
 define j/order format=8.1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Report: Detailed and/or summarized report" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;i&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;j&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;a&lt;/TD&gt;
&lt;TD class="r data"&gt;1.0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;2.0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;b&lt;/TD&gt;
&lt;TD class="r data"&gt;1.0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1.8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="c data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;2.0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Jan 2021 14:22:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714583#M80076</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-27T14:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714607#M80077</link>
      <description>&lt;P&gt;What was the format assigned to the order variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if you have multiple order variables there might be conflicts.&lt;/P&gt;
&lt;P&gt;Which is just one reason to show the entire procedure code.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 15:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714607#M80077</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-27T15:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714610#M80078</link>
      <description>Yes, these are all good points, and there could be other factors in play. I will supply code and output when I can.&lt;BR /&gt;&lt;BR /&gt;But still, when I add the renumbering to integers-only immediately prior to the PROC REPORT, and then it works, it seems to me that the integer/non-integer mix is causing this. And I can't understand that.&lt;BR /&gt;&lt;BR /&gt;Thanks all...</description>
      <pubDate>Wed, 27 Jan 2021 15:19:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714610#M80078</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2021-01-27T15:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714623#M80080</link>
      <description>I forgot to mention that there is no format associated with the sort variable. It's there strictly for ordering, and is a NOPRINT.</description>
      <pubDate>Wed, 27 Jan 2021 15:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714623#M80080</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2021-01-27T15:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714658#M80082</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/175401"&gt;@davehalltwp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I forgot to mention that there is no format associated with the sort variable. It's there strictly for ordering, and is a NOPRINT.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS variables ALWAYS have a format. If you don't assign one SAS does. For numeric values usually something like BEST12. but it is always better to check/ verify.&lt;/P&gt;
&lt;P&gt;Formats can affect grouping behavior, is designed that way, and is a very powerful tool used correctly.&lt;/P&gt;
&lt;P&gt;And example:&lt;/P&gt;
&lt;PRE&gt;data example;
   input x;
datalines;
1.1
1.2
1.3
;

proc freq data=example;
   title "Default format";
   tables x;
run;

proc freq data=example;
   title "Overiding default format";
   tables x;
   format x f4.;
run;&lt;/PRE&gt;
&lt;P&gt;So if your variable had a format assigned that typically doesn't display decimal values it would have the affect you describe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also share your "renumbering" code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 16:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714658#M80082</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-27T16:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714662#M80083</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/175401"&gt;@davehalltwp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I forgot to mention that there is no format associated with the sort variable. It's there strictly for ordering, and is a NOPRINT.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The &lt;A href="http://If%20no format has been assigned to a class variable, then the default format, BEST12., is used." target="_blank" rel="noopener"&gt;documentation of the ORDER= option&lt;/A&gt; says that "FORMATTED" is the default &lt;EM&gt;and&lt;/EM&gt;: "&lt;SPAN&gt;If no format has been assigned to a class variable, then the default format, BEST12., is used."&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Which explains why 4.5 is sorted after 5 (and many other values greater than 4.5):&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;1719  data _null_;
1720  do x=4 to 5 by .5;
1721   put x best12.;
1722  end;
1723  run;

           4
         4.5
           5&lt;/PRE&gt;
&lt;P&gt;Using &lt;FONT face="courier new,courier"&gt;order=internal&lt;/FONT&gt;&amp;nbsp;in the DEFINE statement would apply the intended&amp;nbsp;&lt;EM&gt;numeric&lt;/EM&gt; order instead.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 16:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714662#M80083</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-27T16:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Order Variable: integer vs. non-integer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714666#M80084</link>
      <description>Wow, thank you, @FreelanceReinhard</description>
      <pubDate>Wed, 27 Jan 2021 16:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-Order-Variable-integer-vs-non-integer/m-p/714666#M80084</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2021-01-27T16:56:29Z</dc:date>
    </item>
  </channel>
</rss>

