<?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 sort in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548542#M152105</link>
    <description>&lt;P&gt;Input order can affect results for variables NOT on the by statement. Consider the result for :&lt;/P&gt;
&lt;PRE&gt;data awards;
input Fname$ Points Month;
datalines;
Wang 1 8
Amy 2 4
Amy 1 7
Gerard 3 3
Wang 3 3
Wang 1 12
;
proc sort data=awards;
by descending fname points;
run;&lt;/PRE&gt;</description>
    <pubDate>Thu, 04 Apr 2019 15:43:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-04-04T15:43:55Z</dc:date>
    <item>
      <title>proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548113#M151966</link>
      <description>&lt;DIV class="_1dwg _1w_m _q7o"&gt;&lt;DIV&gt;&lt;DIV class="_5pbx userContent _3ds9 _3576"&gt;&lt;DIV class="text_exposed_root text_exposed"&gt;&lt;P&gt;data awards;&lt;BR /&gt;input Fname$ Points Month;&lt;BR /&gt;datalines;&lt;BR /&gt;Amy 2 4&lt;BR /&gt;Amy 1 7&lt;SPAN class="text_exposed_show"&gt;&lt;BR /&gt;Gerard 3 3&lt;BR /&gt;Wang 3 3&lt;BR /&gt;Wang 1 12&lt;BR /&gt;Wang 1 8&lt;BR /&gt;;&lt;BR /&gt;proc sort data=awards;&lt;BR /&gt;by descending fname points;&lt;BR /&gt;run;&lt;BR /&gt;Output as&lt;BR /&gt;Wang 1 12&lt;BR /&gt;Wang 1 8&lt;BR /&gt;............&lt;BR /&gt;Why ( Wang 1 12 )but not (Wang 1 &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; as the begining record?&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="_3x-2"&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="_4299"&gt;&lt;DIV class="_5vsi"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="_78bu"&gt;&lt;DIV class="_68wo"&gt;&lt;DIV class="_3vum"&gt;&lt;DIV class="_66lg"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Apr 2019 06:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548113#M151966</guid>
      <dc:creator>swayto</dc:creator>
      <dc:date>2019-04-03T06:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548118#M151967</link>
      <description>&lt;P&gt;Because you do not sort by month. If you sort by Month also,&amp;nbsp;&lt;SPAN&gt;Wang 1 8 is the first row &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=awards;
by descending fname points Month;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 07:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548118#M151967</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-03T07:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548119#M151968</link>
      <description>&lt;P&gt;While sorting sas maintains the original order. You sort by Fname and Point, not by month.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 07:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548119#M151968</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-04-03T07:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548120#M151969</link>
      <description>&lt;P&gt;The variable "month" is not specified as BY variable at PROC SORT, this is why SAS will keep the original data arrangement for not specified variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can be resolved by following way to get the observation &lt;SPAN&gt;(Wang 1 &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; before&amp;nbsp;(Wang 1 12)&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc sort data=awards;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;by descending fname points month;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 07:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548120#M151969</guid>
      <dc:creator>zahir</dc:creator>
      <dc:date>2019-04-03T07:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548542#M152105</link>
      <description>&lt;P&gt;Input order can affect results for variables NOT on the by statement. Consider the result for :&lt;/P&gt;
&lt;PRE&gt;data awards;
input Fname$ Points Month;
datalines;
Wang 1 8
Amy 2 4
Amy 1 7
Gerard 3 3
Wang 3 3
Wang 1 12
;
proc sort data=awards;
by descending fname points;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Apr 2019 15:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sort/m-p/548542#M152105</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-04T15:43:55Z</dc:date>
    </item>
  </channel>
</rss>

