<?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 PROC REPORT with default order option creates unwanted order in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927816#M83444</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;I can't figure out the reason for an unwanted result.&lt;/P&gt;&lt;P&gt;Here is my code and result. Why&amp;nbsp;VSSEQ=0.1 is behind&amp;nbsp;VSSEQ = 2 and 3 in the result?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data vitals;&lt;BR /&gt;input VSSEQ VSTEST $ VISIT;&lt;BR /&gt;datalines;&lt;BR /&gt;0.1 SBP 0&lt;BR /&gt;0.1 SBP 2&lt;BR /&gt;0.1 SBP 3&lt;BR /&gt;2 DBP 0&lt;BR /&gt;2 DBP 1&lt;BR /&gt;2 DBP 2&lt;BR /&gt;2 DBP 3&lt;BR /&gt;3 PULSE 0&lt;BR /&gt;3 PULSE 1&lt;BR /&gt;3 PULSE 2&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=vitals;&lt;BR /&gt;column VSSEQ vstest visit;&lt;BR /&gt;define VSSEQ /order &lt;SPAN&gt;ORDER=FORMATTED&lt;/SPAN&gt;;&lt;BR /&gt;define vstest /order order=data;&lt;BR /&gt;define visit /order order=data;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Derek_Hu_0-1715325177388.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96405iA3DD901C9D66DD0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Derek_Hu_0-1715325177388.png" alt="Derek_Hu_0-1715325177388.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2024 07:32:15 GMT</pubDate>
    <dc:creator>Derek_Hu</dc:creator>
    <dc:date>2024-05-10T07:32:15Z</dc:date>
    <item>
      <title>PROC REPORT with default order option creates unwanted order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927816#M83444</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I can't figure out the reason for an unwanted result.&lt;/P&gt;&lt;P&gt;Here is my code and result. Why&amp;nbsp;VSSEQ=0.1 is behind&amp;nbsp;VSSEQ = 2 and 3 in the result?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data vitals;&lt;BR /&gt;input VSSEQ VSTEST $ VISIT;&lt;BR /&gt;datalines;&lt;BR /&gt;0.1 SBP 0&lt;BR /&gt;0.1 SBP 2&lt;BR /&gt;0.1 SBP 3&lt;BR /&gt;2 DBP 0&lt;BR /&gt;2 DBP 1&lt;BR /&gt;2 DBP 2&lt;BR /&gt;2 DBP 3&lt;BR /&gt;3 PULSE 0&lt;BR /&gt;3 PULSE 1&lt;BR /&gt;3 PULSE 2&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=vitals;&lt;BR /&gt;column VSSEQ vstest visit;&lt;BR /&gt;define VSSEQ /order &lt;SPAN&gt;ORDER=FORMATTED&lt;/SPAN&gt;;&lt;BR /&gt;define vstest /order order=data;&lt;BR /&gt;define visit /order order=data;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Derek_Hu_0-1715325177388.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96405iA3DD901C9D66DD0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Derek_Hu_0-1715325177388.png" alt="Derek_Hu_0-1715325177388.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 07:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927816#M83444</guid>
      <dc:creator>Derek_Hu</dc:creator>
      <dc:date>2024-05-10T07:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT with default order option creates unwanted order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927817#M83445</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/196971"&gt;@Derek_Hu&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0wy1vqwvz43uhn1g77eb5xlvzqh.htm#p0vk3hzz34jjugn16qvlcc1bfuv4" target="_blank" rel="noopener"&gt;documentation of the ORDER= option&lt;/A&gt; explains it:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;H4 class="xisDoc-argument"&gt;FORMATTED&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;orders values by their formatted (external) values. If no format has been assigned to a class variable, then the default format, BEST12., is used.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The BEST12. formatted values of 0.1, 2 and 3 are:&lt;/P&gt;
&lt;PRE&gt;------------
         0.1
           2
           3
------------
&lt;/PRE&gt;
&lt;P&gt;So they are right-aligned in a 12-character field and the &lt;FONT face="courier new,courier"&gt;'0'&lt;/FONT&gt; (ASCII code &lt;STRONG&gt;48&lt;/STRONG&gt;) of &lt;FONT face="courier new,courier"&gt;'0.1'&lt;/FONT&gt; at character position 10 is sorted &lt;EM&gt;after&lt;/EM&gt; the leading blank &lt;FONT face="courier new,courier"&gt;' '&lt;/FONT&gt; (ASCII code &lt;STRONG&gt;32&lt;/STRONG&gt;) at the same position for the integer values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use ORDER=INTERNAL to obtain the desired numerical sort order.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 08:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927817#M83445</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-10T08:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT with default order option creates unwanted order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927818#M83446</link>
      <description>Thanks. That means ORDER=FORMATTED is equal to using the PUT function to convert the data into a specified format, instead of keeping the variable as numeric with the appearance of BEST12.. Please correct me if anything is wrong.</description>
      <pubDate>Fri, 10 May 2024 08:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927818#M83446</guid>
      <dc:creator>Derek_Hu</dc:creator>
      <dc:date>2024-05-10T08:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT with default order option creates unwanted order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927820#M83447</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/196971"&gt;@Derek_Hu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks. That means ORDER=FORMATTED is equal to using the PUT function to convert the data into a specified format, instead of keeping the variable as numeric with the appearance of BEST12.. Please correct me if anything is wrong.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I wouldn't say it is "equal". Using a corresponding character variable created by the PUT function would result in the same &lt;EM&gt;sort order&lt;/EM&gt;. However, this character variable could not be used, say, in arithmetic calculations in a COMPUTE block -- unlike the existing numeric variable, formatted or not.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 09:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927820#M83447</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-10T09:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT with default order option creates unwanted order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927879#M83448</link>
      <description>Thanks a lot.</description>
      <pubDate>Fri, 10 May 2024 16:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-with-default-order-option-creates-unwanted-order/m-p/927879#M83448</guid>
      <dc:creator>Derek_Hu</dc:creator>
      <dc:date>2024-05-10T16:27:00Z</dc:date>
    </item>
  </channel>
</rss>

