<?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 Order of rows by user define order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Order-of-rows-by-user-define-order/m-p/645099#M192770</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that I have a&amp;nbsp; data set (summary report) and I want to re-order the rows.&lt;/P&gt;
&lt;P&gt;The issue is that I don't want to order it by descending criteria and not by ascending criteria.&lt;/P&gt;
&lt;P&gt;I want to to order it by order that I want to define in advance.&lt;/P&gt;
&lt;P&gt;I want that order of rows will be by "team" :&lt;CODE class=" language-sas"&gt;bcbfb, jdjfj,asddd &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;and within each team by  Profit(from high value to low value).&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Report;
input team $ sub_team $ Profit;
cards;
asddd a 10 &lt;BR /&gt;asddd b 30&lt;BR /&gt;asddd c 20
jdjfj a 40&lt;BR /&gt;jdjfj b 50&lt;BR /&gt;jdjfj c 15
bcbfb a 35&lt;BR /&gt;bcbfb b 46&lt;BR /&gt;bcbfb c 90&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;
/*The required order of rows is
bcbfb 
jdjfj 
asddd 
*/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 May 2020 21:04:53 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2020-05-04T21:04:53Z</dc:date>
    <item>
      <title>Order of rows by user define order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-rows-by-user-define-order/m-p/645099#M192770</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that I have a&amp;nbsp; data set (summary report) and I want to re-order the rows.&lt;/P&gt;
&lt;P&gt;The issue is that I don't want to order it by descending criteria and not by ascending criteria.&lt;/P&gt;
&lt;P&gt;I want to to order it by order that I want to define in advance.&lt;/P&gt;
&lt;P&gt;I want that order of rows will be by "team" :&lt;CODE class=" language-sas"&gt;bcbfb, jdjfj,asddd &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;and within each team by  Profit(from high value to low value).&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Report;
input team $ sub_team $ Profit;
cards;
asddd a 10 &lt;BR /&gt;asddd b 30&lt;BR /&gt;asddd c 20
jdjfj a 40&lt;BR /&gt;jdjfj b 50&lt;BR /&gt;jdjfj c 15
bcbfb a 35&lt;BR /&gt;bcbfb b 46&lt;BR /&gt;bcbfb c 90&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;
/*The required order of rows is
bcbfb 
jdjfj 
asddd 
*/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 21:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-rows-by-user-define-order/m-p/645099#M192770</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-05-04T21:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Order of rows by user define order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-rows-by-user-define-order/m-p/645101#M192771</link>
      <description>&lt;P&gt;Create a team order variable and sort by that. Use PROC FORMAT to assign the order:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $team_order
  bcbfb = '1'
  jdjfj    = '2'
  asddd = '3'
  ;
run;

data want;
  set have;
  team_order = put(team, $team_order.);
run;

proc sort data = want;
  by team_order;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 May 2020 21:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-rows-by-user-define-order/m-p/645101#M192771</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-05-04T21:16:38Z</dc:date>
    </item>
  </channel>
</rss>

